-
Based on the supplementary information, the modifications are as follows:
Add the control command1 to the form, then copy the following**, run, start the drawing program, click command1, and you can find the handle of the drawing paper you want!
option explicit
private declare function findwindow lib "user32" alias "findwindowa" (byval lpclassname as string, byval lpwindowname as string) as long
private declare function findwindowex lib "user32" alias "findwindowexa" (byval hwnd1 as long, byval hwnd2 as long, byval lpsz1 as string, byval lpsz2 as string) as long
private sub command1_click()
dim huatu, huazi
dim i as integer
huatu = findwindowex(0, 0, vbnullstring, "Untitled—Paint")
do until huatu = 0
huazi = findwindowex(huatu, 0, "afxframeorview42u", vbnullstring)
huazi = findwindowex(huazi, 0, "afx:1000000:8", vbnullstring)
i = i + 1
msgbox "Find the section" & i & "A drawing paper, and its handle is:" & huazi
huatu = findwindowex(0, huatu, vbnullstring, "Untitled—Paint")
loopend sub
-
declare function findwindowex lib "user32" alias "findwindowexa" (byval hwnd1 as long, byval hwnd2 as long, byval lpsz1 as string, byval lpsz2 as string) as long
hwnd1 is the window sentence cake you find in Notepad.
dim hwnd2 as long
hwnd1 = findwindow(vbnullstring, "Hello")
hwnd2= findwindowex(hwnd1,0,vbnullstring,"Send")
-
private sub command1_click()dim h&
doh = findwindowex(, h, vbnullstring, vbnullstring)
if h <>0 then
hend if
loop until h = 0
end sub
For example, this is to enumerate all the child forms (controls) of the current form, and if you need to get the child form handles of other forms, you can change them to the parent form handles.
-
public declare function getwindow lib "user32" alias "getwindow" (byval hwnd as long, byval wcmd as long) as long
Gets a handle to a window that has a specific relationship to a source window.
Return value: long, the handle of a window determined by wcmd. If no matching window is found, or if an error is encountered, a zero value is returned. getlasterror is set
hwnd --long, the source window.
wcmd --long, specifies the relationship between the result window and the source window, which is based on the following constants:
gw_child
Look for the first child window of the source window.
gw_hwndfirst
Look for the first sibling (sibling) window for a source child window, or look for the first top-level window.
gw_hwndlast
Find the last sibling (sibling) window for a source child window, or the last top-level window.
gw_hwndnext
Find the next sibling window for the source window.
gw_hwndprev
Look for the previous sibling window for the source window.
gw_owner
Look for the owner of the window.
A sibling or sibling is a window that is at the same level throughout the hierarchy. If a window has five child windows, those five windows are sibling windows. Although GetWindow can be used to enumerate windows, EnumWindows and EnumChildWindows are more reliable if you want to relocate, create, and clear windows during the enumeration process.
Select gw owner (looking for the owner of the window) as a parameter.
-
getparent
in . Gets the handler of a window directly under the parent window
The immediate parent of a window can be chaotic, which means you can use setparent to set the parent of a window (but this may be dangerous and may be genetic).
-
declare function findwindowex lib "user32" alias "findwindowexa" (byval hwnd1 as long, byval hwnd2 as long, byval lpsz1 as string, byval lpsz2 as string) as long
hwnd1 is the window sentence cake you find in Notepad.
dim hwnd2 as long
hwnd1 = findwindow(vbnullstring, "Hello")
hwnd2= findwindowex(hwnd1,0,vbnullstring,"Send")
Amitabha. The old man is here. No problem for years ==+
Note. The first argument to getpixel is not a window handle. Don't be mistaken. >>>More
You can consider judging the system time. If you haven't been in contact with it for so long to change your password, if you only need to change it once a week, you can change it manually, which is safe. >>>More
I forgot what the ascii code is.,You just look for it.,This ** is very simple.,It's a case of imitation keyboard.。 >>>More
The following methods are for reference.
Method 1: Use the sendkeys statement. >>>More
I'll write in detail and remember the plus.
Medium Maximize and minimize button evaporation: >>>More