handle

How come some controls don't have a windows handle?

孤人 提交于 2019-12-08 18:31:24
I want to get the window handle of some controls to do some stuff with it (requiring a handle). The controls are in a different application. Strangely enough; I found out that many controls don't have a windows handle, like the buttons in the toolbar (?) in Windows Explorer. Just try to get a handle to the Folder/Search/(etc) buttons. It just gives me 0. So.. first question: how come that some controls have no windows handle? Aren't all controls windows, in their hearts? (Just talking about standard controls, like I would expect them in Windows Explorer, nothing customdrawn on a pane or the

How to check if an handle should be closed?

妖精的绣舞 提交于 2019-12-08 17:30:16
问题 In case which ShellExecuteEx returns false, should the handle be closed?: function EditAndWait(const AFileName : string) : boolean; var Info: TShellExecuteInfo; begin FillChar(Info, SizeOf(Info), 0); Info.cbSize := SizeOf(Info); Info.lpVerb := 'edit'; Info.lpFile := PAnsiChar(AFileName); Info.nShow := SW_SHOW; Info.fMask := SEE_MASK_NOCLOSEPROCESS; Result := ShellExecuteEx(@Info); if(Result) then begin WaitForSingleObject(Info.hProcess, Infinite); CloseHandle(Info.hProcess); end else begin /

Is zero ever a valid handle?

一笑奈何 提交于 2019-12-08 17:07:06
问题 There is a SafeHandleZeroOrMinusOneIsInvalid class in the .NET Framework, as well as a SafeHandleMinusOneIsInvalid class. Why is this? In which situations is zero ever a valid handle? 回答1: As additional lecture to the other answers, see this OldNewThing blog entry about inconsistent handle return values. 回答2: Yes. Zero is file handle for stdin. Non-kernel handles aren't valid if zero. 回答3: As put forth by Microsoft in their documentation (and demonstrated in description by Joshua,) it is

boost::thread causing small event handle leak?

限于喜欢 提交于 2019-12-08 14:26:22
I'm debugging this database project. It wraps access to SQLite for a higher level application. It's designed to run asynchronously, that is, it has methods like ExecuteRequestAsync() and IsRequestReady(). When ExecuteRequestAsync is called, it spawns a boost::thread to do the job and return the function immediately. When the higher level application decides that it no longer wants the result of a running request, it may call DumpRequest() to cancel it. Since it's difficult to gracefully cancel a database request, the implementation of DumpRequest just maintain a "cleanup monitor thread" that

Handle classes with Matlab parfor loops [closed]

我是研究僧i 提交于 2019-12-08 13:41:47
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I consult "Handle Classes" section of http://uk.mathworks.com/help/distcomp/objects-and-handles-in-parfor-loops.html and write this: parfor j = 1:length(stores) store = stores(j); dataj = somefunction(store.someproperty, data(data.store == store.id, :)); stores(j) = store.dosomething(dataj); end where

How can I output text to another console already open C++

半城伤御伤魂 提交于 2019-12-08 11:21:42
问题 Hi this is my first question on stack overflow (Im a junior programmer :P and french too...So apologies in advance for gramatical mistake I make) Im trying to start a elevated process to attach back to the console of the parent to write its output (no crash no error just plain nothingness) Here is my code: int main(int argc, char *argv[]) { HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE); if (UAC::IsAppRunningAsAdminMode()) { printf("Process Already elevated\nChecking if self invocated

boost::thread causing small event handle leak?

天大地大妈咪最大 提交于 2019-12-08 08:17:03
问题 I'm debugging this database project. It wraps access to SQLite for a higher level application. It's designed to run asynchronously, that is, it has methods like ExecuteRequestAsync() and IsRequestReady(). When ExecuteRequestAsync is called, it spawns a boost::thread to do the job and return the function immediately. When the higher level application decides that it no longer wants the result of a running request, it may call DumpRequest() to cancel it. Since it's difficult to gracefully

Grails checkbox handling

一笑奈何 提交于 2019-12-08 06:42:57
问题 Let's say, i have this scenerio: But let's say i have hundreds of those checkBoxes, which i need to handle everything at same time after submiting a form. I then will need to save to the BD something based on which boxes are checked, and the id of each block So, i need this: a) a way to know which checkboxes are checked, within hundreds of them b) each checkbox should be 'linked' with an id which im gona pass, so that a specific action will be performed. I have a <g:each> tag writing me the

Get Executable Path of Window by Handle - Access Denied

雨燕双飞 提交于 2019-12-08 05:27:05
问题 I am trying to get Executable Path of Window by Handle. I am using the following code to achieve: [DllImport("user32.dll")] private static extern int GetWindowThreadProcessId(IntPtr handle, out uint processId); public string GetFilePath(IntPtr hwnd) { try { uint pid = 0; GetWindowThreadProcessId(hwnd, out pid); Process proc = Process.GetProcessById((int)pid); //Gets the process by ID. return proc.MainModule.FileName.ToString(); //Returns the path. } catch (Exception ex) { return ex.ToString()

How to release a handle through C#?

只谈情不闲聊 提交于 2019-12-08 05:23:02
问题 I have an application that IMPLICITLY opens a handle on a dll/file. At some point in the application, I want to release this handle. How can I do it? My application is in C#. 回答1: use PInvoke if you have an handler that you want to close [System.Runtime.InteropServices.DllImport("Kernel32")] private extern static Boolean CloseHandle(IntPtr handle); 回答2: What exactly you are trying to do? If you want to load an assembly to do some stuff with that, and then unload it completely, you need to