handle

How to initialize a vector of class handles?

隐身守侯 提交于 2019-12-19 09:27:22
问题 I have a handle-based class that I need to create a vector of. An easy method of doing this is to dynamically construct the vector in a for loop, but this causes mlint to complain about the changing vector size. classdef HandleClass < handle ... end ... for i = 1:10 foo(i) = HandleClass(); end I'm suspicious of the resource-hit required to use this method to allocate large arrays of complicated objects. A comment in a previous thread described a useful method to create a vector using the

Get running process given process handle

我怕爱的太早我们不能终老 提交于 2019-12-19 05:48:38
问题 can someone tell me how i can capture a running process in c# using the process class if i already know the handle? Id rather not have not have to enumerate the getrunning processes method either. pInvoke is ok if possible. 回答1: In plain C#, it looks like you have to loop through them all: // IntPtr myHandle = ... Process myProcess = Process.GetProcesses().Single( p => p.Id != 0 && p.Handle == myHandle); The above example intentionally fails if the handle isn't found. Otherwise, you could of

STDERR? What is it? What are its common uses?

六月ゝ 毕业季﹏ 提交于 2019-12-18 17:29:12
问题 Curious about how the handle STDERR works? Lets keep it down to say Batch Files to keep it simple and focused? I know that many programming languages accept STDERR, so I don't know if maybe uses are different across the board or maybe there is a common function for all programming languages? If anyone can provide some examples on common usage that you have seen or an explanation of why someone may utilize it for ??? situation that would be awesome. Thanks in advance! 回答1: Usually you would

Communicate With Command Prompt Through Delphi

一世执手 提交于 2019-12-18 17:16:13
问题 I have tried to use delphi to send commands to the command prompt. However, i am not able to do so as i used CreateProcess method to do it. I have tried to change the StdOutPipeWrite, however, the CreateProcess seems to not allow commands after the initial command from CreateProcess to be passed through. Is there any way to make use of the handle to continue to send and receive commands and messages to and fro the command prompt and delphi? 回答1: My fellow member Glenn9999 from tek-tips.com

What can cause section handle leaks?

北城余情 提交于 2019-12-18 05:54:08
问题 This is a follow-up question to my previous question. As suggested in this answer to my previous question, I used ProcessExplorer to analyze a list of handles that my application is using to find a handle leak. The handles that are leaking are of type Section . What exactly is a section handle, where is it used and what can cause section handles to leak? I'm not using memory mapped files in my code. 回答1: Quoting Mark Russinovich's Inside Windows 2000 (what is now called Windows Internals),

C# compile error: “Invoke or BeginInvoke cannot be called on a control until the window handle has been created.”

折月煮酒 提交于 2019-12-18 04:11:07
问题 I just posted a question about how to get a delegate to update a textbox on another form. Just when I thought I had the answer using Invoke...this happens. Here is my code: Main Form Code: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using System.Data.OleDb; using System.Collections.Specialized; using System.Text; using System.Threading; delegate void logAdd(string message); namespace

How to handle a webview confirm dialog?

一世执手 提交于 2019-12-17 21:56:32
问题 I'm displaying a webpage in a WebView and on the webpage, there is a button. When you click the button, a confirmation dialog is supposed to popup, but it doesn't show in my WebView. It does popup if I go to the same webpage in the android browser. Anyone know how to handle popup dialogs coming from a webpage inside your WebView? 回答1: Ok, found the answer and here it is! In order to handle a popup confirmation coming from a webpage in your WebView, you need to override the onJsConfirm method

C# get child handles using FindWindowEx by name and ordinal number

回眸只為那壹抹淺笑 提交于 2019-12-17 16:25:07
问题 According to http://msdn.microsoft.com/en-us/library/ms633500(v=vs.85).aspx I define FindWindowEx function. using System.Runtime.InteropServices; [DllImport("user32.dll", CharSet=CharSet.Unicode)] static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle); Now I am able to find first handle of "Button" control (get name from Spy++) setting childAfter as IntPtr.Zero . IntPtr hWndParent = new IntPtr(2032496); // providing parent window

How to get hWnd of window opened by ShellExecuteEx.. hProcess?

我怕爱的太早我们不能终老 提交于 2019-12-17 13:54:27
问题 This "simple" issue seems to be fraught with side issues. eg. Does the new process open multiple windows; Does it have a splash screen? Is there a simple way? (I'm starting a new instance of Notepad++) ... std::tstring tstrNotepad_exe = tstrProgramFiles + _T("\\Notepad++\\notepad++.exe"); SHELLEXECUTEINFO SEI={0}; sei.cbSize = sizeof(SHELLEXECUTEINFO); sei.fMask = SEE_MASK_NOCLOSEPROCESS; sei.hwnd = hWndMe; // This app's window handle sei.lpVerb = _T("open"); sei.lpFile = tstrNotepad_exe.c

Determine path to registry key from HKEY handle in C++

大城市里の小女人 提交于 2019-12-17 09:34:04
问题 Given a handle to a Windows Registry Key, such as the ones that are set by ::RegOpenKeyEx(), is it possible to determine the full path to that key? I realize that in a simple application all you have to do is look up 5 or 10 lines and read... but in a complex app like the one I'm debugging, the key I'm interested in can be opened from a series of calls. 回答1: Use LoadLibrary and NtQueryKey exported function as in the following code snippet. #include <windows.h> #include <string> typedef LONG