Finally, on the Lantern Festival, the "Process Viewer 1.3" is released, and it will change its Chinese version of the name to "05 yuan". "Process Viewer" has always been encoded with rest time, although the 1.3 version has not increased, but it has been taken for several days. During the development process, there is still something like something to record, so as not to forget it. First, find the main form to find a main form through a specific form handle, this is the previous function, and write the following code with hand:
IF hwnd <> 0 THEN GETPARENT (HWND) <> Null Do HWnd: = getParent (hwnd) I used to answer this question in 9CBS and found that I didn't remember myself. Second, the maximized window The rectangular area of the window is calculated by the form handle and draw the dotted line prompt box. It is the previously available function, but the source code is at home, this is only rewritten. However, in my current Win2000 system, the maximized form is in the upper left corner of (-4, -4), and the width is more than the width of the screen. It may be that Windows intentionally handles the form, let Its 3D border is displayed outside the screen. I didn't have this problem when I did this function last time, I didn't know if I didn't pay attention. Third, the amount of memory usage is easy to implement under Win2000, and it is possible with GetProcessMemoryInfo, and there is a task manager to be compared. And there is more trouble under Win98 / ME, and finally use the following code, but the value obtained is very large, and it can only be the case.
iFlag: = VirtualQueryEx (hndProcess, lpAddr, mi, SizeOf (mi)); repeat LongWord (lpAddr): = LongWord (mi.BaseAddress) mi.RegionSize; if LongWord (lpAddr)> $ 7fffffff then break; if mi.State = MEM_COMMIT then Inc (iTotalCommit, mi.RegionSize); iFlag: = VirtualQueryEx (hndProcess, lpAddr, mi, SizeOf (mi)); until iFlag <> sizeof (mi); four, GetWindowThreadProcessId DWORD GetWindowThreadProcessId (HWND, LPDWORD) can return Two values, one is the return value of the function itself, the other LPDWORD point to the variable, the LPDWORD process ID. The above memo, please do not reprint, thank you!