mainwindow

objective c renderInContext crash on background thread

非 Y 不嫁゛ 提交于 2019-12-03 16:41:01
I have an app in which the screen continuously is capturing in background thread. Here is the code - (UIImage *) captureScreen { UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow]; CGRect rect = [keyWindow bounds]; UIGraphicsBeginImageContext(rect.size); CGContextRef context = UIGraphicsGetCurrentContext(); [[keyWindow layer] renderInContext:context]; UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIDeviceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; if ((orientation ==

Change WPF mainwindow label from another class and separate thread

大憨熊 提交于 2019-12-03 12:52:44
问题 Im working on a WPF application. I have a label called "Status_label" in MainWindow.xaml . and I want to change its content from a different class (signIn.cs). Normally I'm able to do this var mainWin = Application.Current.Windows.Cast<Window>().FirstOrDefault(window => window is MainWindow) as MainWindow; mainWin.status_lable.Content = "Irantha signed in"; But my problem is,when I'm trying to access it via different thread in signIn.cs class, it gives an error: The calling thread cannot

How do I access my Application Delegate's window accessor method from another object?

余生颓废 提交于 2019-12-03 07:30:52
问题 As mentioned before - I'm an Objective-C newbie of the first order but having read 4 physical books on the subject and a bucket-load of ebooks and documentation I still can't find what I'm looking for. I have a top-level content view controller that wants to configure its view property from the physical dimensions of the window property of the application delegate. This is something that several people have already asked questions on. ( [UIScreen mainScreen] doesn't cut it for reasons already

Change WPF mainwindow label from another class and separate thread

大城市里の小女人 提交于 2019-12-03 03:58:10
Im working on a WPF application. I have a label called "Status_label" in MainWindow.xaml . and I want to change its content from a different class (signIn.cs). Normally I'm able to do this var mainWin = Application.Current.Windows.Cast<Window>().FirstOrDefault(window => window is MainWindow) as MainWindow; mainWin.status_lable.Content = "Irantha signed in"; But my problem is,when I'm trying to access it via different thread in signIn.cs class, it gives an error: The calling thread cannot access this object because a different thread owns it. Can I solve this by using Dispatcher.Invoke(new

How do I access my Application Delegate's window accessor method from another object?

折月煮酒 提交于 2019-12-02 22:20:19
As mentioned before - I'm an Objective-C newbie of the first order but having read 4 physical books on the subject and a bucket-load of ebooks and documentation I still can't find what I'm looking for. I have a top-level content view controller that wants to configure its view property from the physical dimensions of the window property of the application delegate. This is something that several people have already asked questions on. ( [UIScreen mainScreen] doesn't cut it for reasons already aired many times before on this forum). Therefore, the logical approach would be for the content view

c# Get process window titles

杀马特。学长 韩版系。学妹 提交于 2019-12-02 08:20:46
问题 proc.MainWindowTitle.Contains("e") How does one get the window titles of all the current windows containing "e" open instead of just the Main Window using the "MainWindowTitle" and store them into a string array? EDIT: string[] toClose = {proc.MainWindowTitle}; for (int i = 0; i < toClose.Length; i++) { string s = toClose[i]; int hwnd = 0; hwnd = FindWindow(null, s); //send WM_CLOSE system message if (hwnd != 0) SendMessage(hwnd, WM_CLOSE, 0, IntPtr.Zero); 回答1: Code snippet string[] result =

c# Get process window titles

↘锁芯ラ 提交于 2019-12-02 07:29:46
proc.MainWindowTitle.Contains("e") How does one get the window titles of all the current windows containing "e" open instead of just the Main Window using the "MainWindowTitle" and store them into a string array? EDIT: string[] toClose = {proc.MainWindowTitle}; for (int i = 0; i < toClose.Length; i++) { string s = toClose[i]; int hwnd = 0; hwnd = FindWindow(null, s); //send WM_CLOSE system message if (hwnd != 0) SendMessage(hwnd, WM_CLOSE, 0, IntPtr.Zero); HuorSwords Code snippet string[] result = new string[50]; int count = 0; Process[] processes = Process.GetProcesses(); foreach(var process

How to add buttons to a main window in Qt?

蓝咒 提交于 2019-11-30 05:18:47
I'm new to qt programming so please don't mind if you find it a noob question. I've added a button to my main window but when I run the code the button is not displayed. Here's my code: mainwindow.cpp #include "mainwindow.h" #include "ui_mainwindow.h" #include <QtWidgets> MainWindow::MainWindow(QWidget *parent) { QPushButton *train_button = new QPushButton(this); train_button->setText(tr("something")); train_button->move(600, 600); train_button->show(); } mainwindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class MainWindow : public

How to add buttons to a main window in Qt?

淺唱寂寞╮ 提交于 2019-11-29 03:41:56
问题 I'm new to qt programming so please don't mind if you find it a noob question. I've added a button to my main window but when I run the code the button is not displayed. Here's my code: mainwindow.cpp #include "mainwindow.h" #include "ui_mainwindow.h" #include <QtWidgets> MainWindow::MainWindow(QWidget *parent) { QPushButton *train_button = new QPushButton(this); train_button->setText(tr("something")); train_button->move(600, 600); train_button->show(); } mainwindow.h #ifndef MAINWINDOW_H

How to make my WPF MainWindow a singleton?

女生的网名这么多〃 提交于 2019-11-28 07:05:11
I want to make my MainWindow a singleton because I want to make accessing it from all other windows in my app easier. But I couldn't make it run. Here is what I did. As usual, I made the MainWindow contractor private, and created a public static MainWindow Instance property to return a static instance. When I just run it without any other changes, I got "No Source Available" error. I googled the Internet and found one related topic at http://www.netframeworkdev.com/windows-presentation-foundation-wpf/xamlc-singleton-class-80578.shtml . However, I couldn't make it work as suggested there. Some