handle

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

冷暖自知 提交于 2019-11-27 07:51:42
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. Jorge Ferreira Use LoadLibrary and NtQueryKey exported function as in the following code snippet. #include <windows.h> #include <string> typedef LONG NTSTATUS; #ifndef STATUS_SUCCESS #define STATUS_SUCCESS ((NTSTATUS)0x00000000L) #endif #ifndef

Return Window handle by it's name / title

被刻印的时光 ゝ 提交于 2019-11-27 04:41:10
问题 I can't solve this problem. I get an error: The name 'hWnd' does not exist in the current context It sounds very easy and probably is... sorry for asking so obvious questions. Here's my code: public static IntPtr WinGetHandle(string wName) { foreach (Process pList in Process.GetProcesses()) { if (pList.MainWindowTitle.Contains(wName)) { IntPtr hWnd = pList.MainWindowHandle; } } return hWnd; } I tried with many different ways and each fails. Thanks in advance. 回答1: Don't forget you're

Register to be default app for custom file type

陌路散爱 提交于 2019-11-27 04:31:38
Register to be able to open files of custom type. Say i have .cool files, and if the user tries to open it, Android asks if they would like to open it with my application. How? I think that you don't choose that. This is handle by the system. Same thing when you send an intent to be handled by a map, If you have skyfire for instance, the system pops up a window an you can choose the application and choose if you want it to always open this kind of file. Unless of course if your application is the only one to open this kind of file. Edit I think if you want your app to say "hey I'm able to open

What is a handle in C++?

情到浓时终转凉″ 提交于 2019-11-27 02:45:22
I have been told that a handle is sort of a pointer, but not, and that it allows you to keep a reference to an object, rather than the object itself. What is a more elaborate explanation? A handle can be anything from an integer index to a pointer to a resource in kernel space. The idea is that they provide an abstraction of a resource, so you don't need to know much about the resource itself to use it. For instance, the HWND in the Win32 API is a handle for a Window. By itself it's useless: you can't glean any information from it. But pass it to the right API functions, and you can perform a

Under which circumstances does the System process (PID 4) retain an open file handle?

六眼飞鱼酱① 提交于 2019-11-27 01:47:30
问题 My application running on a Windows server makes use of a Jet/Access database. For some reasons around every two weeks that database file gets locked by the System process (PID 4, seems to be fixed) After some googling I found some other users having their files locked by that special process, but different files (of course). What's the general reason for the System process to keep an open file handle? Is my application the cause for this locking situation? Are all handles implicitly opened

Is there a proper 'ownership-in-a-package' for 'handles' available?

孤人 提交于 2019-11-26 22:26:57
问题 Handles have proper semantics other than pointers. So for me an example like this (extracted from the Rule of Zero): class module { public: explicit module(std::wstring const& name) : handle { ::LoadLibrary(name.c_str()), &::FreeLibrary } {} // other module related functions go here private: using module_handle = std::unique_ptr<void, decltype(&::FreeLibrary)>; module_handle handle; }; using unique_ptr as an 'ownership-in-a-package' for handles is a bad example. First, it makes use of

Matlab ode45. How to change a parameter inside it while calling it?

我只是一个虾纸丫 提交于 2019-11-26 18:33:01
问题 I'm new with Matlab. I hope you can help me. I have to solve a system of ODEs using ODE45 function. Here is the function which describes my equitions. function dNdt = rateEquations(t, y) %populations of corresponding state Ng = y(1); Ns = y(2); Nt = y(3); %All constants used are dropped for the sake of easy reading. Note the parameter F. %rate equations dNs = s0 * Ng * F - Ns/ t_S1; dNt = Ns / t_ISC - Nt / t_T1; dNg = -dNt - dNs; dNdt = [dNg; dNs; dNt]; end Then, in my script .m-file i call

In fortran 90, how do I program the equivalent of a handle in matlab [duplicate]

一个人想着一个人 提交于 2019-11-26 17:25:00
问题 This question already has answers here : Passing external function of multiple variables as a function of one variable in Fortran (2 answers) Closed 3 years ago . I have a Fortran90 function f(a,b). I need to use a 1D root finder that requires a function g(a), with only one variable a, to find the roots of f for various values of b. In Matlab, I can build a new function g with only one variable a, with parameter b, g = @(a) f(a, b); with b being a parameter that can change in the main program

What is the range of a Windows HANDLE on a 64 bits application?

允我心安 提交于 2019-11-26 16:33:16
问题 On WinAPI, the HANDLE type is defined as a void* , thus on a 64 bit application the HANDLE value may range from 0 to 18446744073709551615 . But is that true in practice? Does any documentation specify the integral range of such a HANDLE ? If for instance one wants to store this HANDLE as an int32_t on a 32 bit application that's completely fine, but on a 64 bit application the doubts sticks. 回答1: MSDN states: Interprocess Communication Between 32-bit and 64-bit Applications 64-bit versions of

What is a Windows Handle?

ε祈祈猫儿з 提交于 2019-11-26 12:43:00
What is a "Handle" when discussing resources in Windows? How do they work? It's an abstract reference value to a resource, often memory or an open file, or a pipe. Properly , in Windows, (and generally in computing) a handle is an abstraction which hides a real memory address from the API user, allowing the system to reorganize physical memory transparently to the program. Resolving a handle into a pointer locks the memory, and releasing the handle invalidates the pointer. In this case think of it as an index into a table of pointers... you use the index for the system API calls, and the