handle

Why do I need to save handle to an old bitmap while drawing with Win32 GDI?

大城市里の小女人 提交于 2021-02-10 11:53:58
问题 Here is the code from switch in WndProc function I've been given as an example: case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // Create a system memory device context. bmHDC = CreateCompatibleDC(hdc); // Hook up the bitmap to the bmHDC. oldBM = (HBITMAP)SelectObject(bmHDC, ghBitMap); // Now copy the pixels from the bitmap bmHDC has selected // to the pixels from the client area hdc has selected. BitBlt( hdc, // Destination DC. 0, // 'left' coordinate of destination rectangle. 0, // 'top'

How can I modify my subplot positions to stop them overwriting each other?

a 夏天 提交于 2021-02-05 09:24:06
问题 I am trying to create a subplot (6 plots) of world maps into which I am writing chosen shapefiles. My issue is with my placement of subplots: They are overwriting each other. I understand from the other questions like this on stackoverflow, that it is because the axes are overlapping somehow. But I thought I had created positions that they would just be 'side-by-side' (see code below). I have tried to make the axes transparent and that doesn't seem to help. My question is: how can I modify

Fileserver directory for dynamic route

心不动则不痛 提交于 2021-01-29 20:06:37
问题 My scenario Compiled angular projects are saved like . ├── branch1 │ ├── commitC │ │ ├── app1 │ │ │ ├── index.html │ │ │ └── stylesheet.css │ └── commitD │ ├── app1 │ │ ├── index.html │ │ └── stylesheet.css │ └── app2 │ ├── index.html │ └── stylesheet.css ├── branch2 │ ├── commitE │ ├── app1 │ │ ├── index.html │ │ └── stylesheet.css │ └── app2 │ ├── index.html │ └── stylesheet.css └── master ├── commitA │ ├── app1 │ │ ├── index.html │ │ └── stylesheet.css └── commitB ├── app1 ├── index.html └

Get MainWindowHandle of spawned process in .NET Core

不羁的心 提交于 2021-01-29 11:25:12
问题 I have this code: private static void Start(String path) { var process = Process.Start(new ProcessStartInfo(path) { WindowStyle = ProcessWindowStyle.Maximized, UseShellExecute = true, }); ThreadPool.QueueUserWorkItem(Tick, process); } private static void Tick(Object obj) { var process = (Process) obj; while (true) { Debug.WriteLine($"HWND: {process.MainWindowHandle}"); Thread.Sleep(TimeSpan.FromMilliseconds(10)); } } This starts a process and then displays the MainWindowHandle property every

Why does Kernel32 OpenProcess function return null?

两盒软妹~` 提交于 2021-01-28 19:37:18
问题 I'm trying to make an application that reads the memory of another (non-Java & 32bit) application using JNA. So far I know how to find process ID and base address of modules. And right before reading memory I need to open process and the OpenProcess function simply returns null. Also, I'm using Windows 10. // process id (pid) is known final int PROCESS_VM_READ=0x0010; final int PROCESS_QUERY_INFORMATION=0x0400; WinNT.HANDLE processHandle = Kernel32.INSTANCE.OpenProcess(PROCESS_VM_READ |

LPHANDLE vs. HANDLE

穿精又带淫゛_ 提交于 2021-01-27 14:16:37
问题 While browsing some code I found a call to OpenPrinter(). The code compiles and works fine. But, we are passing a HANDLE instead of LPHANDLE (as specified in MSDN). I found out that in windef.h the following declaration exists: typedef HANDLE FAR *LPHANDLE; What does LP stand for? Should I use a LPHANDLE , or keep HANDLE ? 回答1: LP stands for Long Pointer. It's a pointer to a handle in this case. HANDLE h = <winapi function>(); LPHANDLE ph = &h; You can use it the same way you would a handle

Handle for ShellExecute() - Parent Window?

寵の児 提交于 2021-01-27 11:28:50
问题 I am trying to use ShellExecute to open a file in Excel. I was reading about the function on MSDN forums, and I found the folowing information about the handle, which is the first parameter: "hwnd [in] A handle to the owner window used for displaying a user interface (UI) or error messages. This value can be NULL if the operation is not associated with a window." I have also heard this referred to as the handle to the parent window. What is the parent/owner window? As you see below I am using

What are the side-affects of ensuring every control created has a handle in .NET?

混江龙づ霸主 提交于 2021-01-27 06:31:40
问题 In the past, I've suffered from a freezing issue that was the result of a Control being used to marshall calls on the UI thread before a handle has been created for that control. (See Kim Greenlee's blog for more info). Using this method - implemented recursively - I ensure all controls that are created in our application have handles when they are constructed. Specifically, this is done after the designer call to initialise the GUI for the control. My question is: Q - Aside from performance,

What are the side-affects of ensuring every control created has a handle in .NET?

安稳与你 提交于 2021-01-27 06:31:16
问题 In the past, I've suffered from a freezing issue that was the result of a Control being used to marshall calls on the UI thread before a handle has been created for that control. (See Kim Greenlee's blog for more info). Using this method - implemented recursively - I ensure all controls that are created in our application have handles when they are constructed. Specifically, this is done after the designer call to initialise the GUI for the control. My question is: Q - Aside from performance,

What is the difference between: Handle, Pointer and Reference

99封情书 提交于 2021-01-20 14:15:33
问题 How does a handle differ from a pointer to an object and also why can't we have a reference to a reference? 回答1: A handle is usually an opaque reference to an object. The type of the handle is unrelated to the element referenced. Consider for example a file descriptor returned by open() system call. The type is int but it represents an entry in the open files table. The actual data stored in the table is unrelated to the int that was returned by open() freeing the implementation from having