handle

Finding the handle to a WPF window

╄→尐↘猪︶ㄣ 提交于 2019-12-17 07:14:23
问题 Windows forms had a property win1.Handle which, if I recall, returns the handle of the main window handle? Is there an equivalent way to get the handle of a WPF Window? I found the following code online, IntPtr windowHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle; but I don't think that will help me because my application has multiple windows. Thanks!! 回答1: Well, instead of passing Application.Current.MainWindow , just pass a reference to whichever window it is you

Handler+Looper+MessageQueue深入详解(根据源码)

霸气de小男生 提交于 2019-12-15 17:39:44
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> Android应用程序都运行在一个dalvik虚拟机进程中,进程开始的时候会启动一个主线程(MainThread),主线程负责处理和ui相关的事件,因此主线程通常又叫UI线程。而由于Android采用UI单线程模型,所以只能在主线程中对UI元素进行操作, 简单的例子如下: package com.fangdo.android.ui; import org.slf4j.Logger; public class LoginActivity extends BaseActivity { Logger logger = LoggerFactory.getLogger(LoginActivity.class); /** Called when the activity is first created. */ private EditText phoneidET; private EditText passwordET; private Button logBT; private CheckBox savePasswordCB; private String phoneid; private String password; private Handler mHandler ; /** Called when the

handle button click event inside gridview

Deadly 提交于 2019-12-13 21:24:59
问题 I am writing asp.net project in C#. The page consists of gridview, it is filled from database initially. The buttons, textboxes and dropdownlists are inside gridview as in the picture picture. I want to handle button(сообщить) click event so that I know what row of gridview is clicked in order to get the selected value of dropdowlnist and value of textbox from that row to update the database. Does someone know how to do this? Thanks! 回答1: My first thought is that if you are using the <asp

Unable to extract processID from GetProcessId(.. hWnd) (pInvoke)

孤街醉人 提交于 2019-12-13 15:25:12
问题 im using the following method [DllImport("kernel32.dll", SetLastError=true)] static extern int GetProcessId(IntPtr hWnd); to try and get the processId for a running process and the only information I have is the HWND. My problem is that it is always returning error code 6 which is ERROR_INVALID_HANDLE. I thought i might change the parameter to be of type int but that also didnt work. Im not able to enumerate the running processes because there may be more than 1 instance running at any one

Why we must handle exception for method not throwing exceptions? [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 06:21:41
问题 This question already has answers here : use of exception in inheritance (6 answers) Closed 6 years ago . Given public class ToBeTestHandleException{ static class A { void process() throws Exception { throw new Exception(); } } static class B extends A { void process() { System.out.println("B "); } } public static void main(String[] args) { A a = new B(); a.process(); } } Why we should handle the exception at line (a.process()) ?.The method process of class B does not throw exception at all?

.NET WebBrowser control - get active contextmenu

家住魔仙堡 提交于 2019-12-13 04:05:37
问题 I have WebBrowser control and i want when right button is clicked and context menu appear to get the handle of that context menu. is that possible? 回答1: Yes. You could reference the following code. //this code assumes WebBrowser object(_webBrowser) is already initiated //in class scope. //this method is needed to execute when form is loaded. //Register it to load event private void Loaded(object sender, RoutedEventArgs e) { _webBrowser.LoadCompleted += _webBrowser_LoadCompleted; } private

DirectX full screen window to windowed by window handle with use Windows API functions

南笙酒味 提交于 2019-12-13 02:38:56
问题 Short story A game is started fullscreen but is a fullscreen directX window. The game supports windowed but I have to do it manually. I made a program in Delphi that stretch/resize any window to fit the screen (with use of a system-wide hotkey) without border and caption so it looks like a fullscreen but doesn't trigger direct hardware access. This is important because I'm using a DisplayLink adapter that doesn't support the tricks used by direct hardware access but want to play it full

Managed C++ ^ (handle) --> What is it and how does it relate to references and pointers

久未见 提交于 2019-12-13 02:01:27
问题 What is the difference between a handle to an object in Managed C++ such as: System::String^ str = gcnew System::String(); and the ordinary C++ pointers? Also how do they relate to references we have in C#? 回答1: You are not talking about (the older) Managed C++, but about C++/CLI, right? In C#, your code is equivalent to System.String str=new System.String(); In C++/CLI, a handle to an object is just the same as a reference in C# - you have reference counting, garbage collector etc. Ordinary

Win32 C++ Can Extra Info be Sent with a Procedure

主宰稳场 提交于 2019-12-12 16:00:07
问题 I have been trying to avoid storing any window handles as a global. Up to this point I have been fine. I am using a keyboard hook procedure now, and I am trying to find, if there is a way, to pass my main windows handle to it. If it can't really be done in a simple way, I can just make the main window handle global. LRESULT CALLBACK KeyboardProc(int code, WPARAM wParam, LPARAM lParam); Is there a way I can include the handle within one of the parameters? Thanks. 回答1: No, there is not. The

Winapi :: Get available handles count

被刻印的时光 ゝ 提交于 2019-12-12 15:04:57
问题 I want to create test that run my program for long time and output the count of available handles time to time. How can I do this with some WINAPI function? This is a great article of how to debug handle leaks http://blogs.technet.com/b/yongrhee/archive/2011/12/19/how-to-troubleshoot-a-handle-leak.aspx but it didn't suitable in my case. I didn't have idea of how to automate debugger in my test. 回答1: That's not how it works. The number of handles you can consume is limited by a quota, by