Prev: Centralised MsgBox
Next: Updating the VB EXE
From: Nobody on 8 Oct 2009 13:20 "mayayana" <mayaXXyana(a)rcXXn.com> wrote in message news:OScwPJCSKHA.4568(a)TK2MSFTNGP06.phx.gbl... > Public Function EnumChildProc(ByVal hWnd As Long, lParam As Long) As Long The second parameter needs to be ByVal. Also, you don't need separate EnumWindows/EnumChildWindows callback routines. I use one for both, and use lParam to tell the callback what to do. I have lParam declared as Enum, so I don't have to type constants. Here is an example: Public Enum eEnumWindowsActions enumAllWindows enumAllChildWindows enumAllVisibleWindows enumAllVisibleChildWindows End Enum Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam _ As eEnumWindowsActions) As Long Public Function EnumWindowProc(ByVal hWnd As Long, ByVal lParam _ As eEnumWindowsActions) As Long
From: Jeff Johnson on 9 Oct 2009 16:30
"Mike Williams" <Mike(a)WhiskyAndCoke.com> wrote in message news:Ox98IQoRKHA.220(a)TK2MSFTNGP02.phx.gbl... >> Sorry I guess I wasn't as clear as I could be; the "FindWindow" >> & "FindWindowEx" functions are being issued from another >> App [some stuff snipped] I would still like to know if there is >> a way to always get the handle of a specific widget using the >> FindWindowEx function. > > If it is a VB6 Form and if you want a specific textbox (and if you know > it's name) then you can pass the name in the fourth parameter (for > example, "TextBox1"). If you just want the first TextBox it finds then you > can pass the class name in the third parameter ("ThunderTextBox") and a > null string in the fourth. Ideally I suppose you would pass both the class > name and the desired textbox name. According to MSDN, the fourth parameter is this: lpszWindow [in] Pointer to a null-terminated string that specifies the window name (the window's title). If this parameter is NULL, all window names match. That suggests you're looking for the window's text, not its VB control name, which I thought wasn't even compiled into the app in the first place. |