![]() ![]() 'This will need to read the textbox which will have z-orderĮnd SubI used txtfile.zorder 0 to bring the control to the top of the z-ordering, I know it should work because if I changed the control to a button that works fine. Auto ) public static extern int GetWindowTextLength( IntPtr hwnd ) DllImport( user32.dll ) private static extern int GetWindowText( IntPtr hWnd. GetWindowText win2, wintext, Len(wintext) ![]() Wintext = String(GetWindowTextLength(win2), Chr$(0)) In a Unicode build, GetWindowText is defined as GetWindowTextW. define GetWindowText GetWindowTextA in a non-Unicode build, GetWindowText and GetWindowTextA are the same thing. Windowhandle = FindWindow(vbNullString, "Truss window") GetWindowText is a preprocessor define: i.e. Almost all texts, such as those from Edit, Static, Groupbox - Controls, etc. ![]() Then simply hold the mouse over the window from which the text is to be read. Then, when you hit the WMCOMMAND case later in the program, you try to use the invalid handles. The reading can be started by clicking the left mouse button on the button with GetWindowText Icon and holding down the left mouse button (drag). Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long Well, what stands out right away is that you have defined your window handle variables as locals, so after the windows are created, the handles go out of scope and are lost. Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long Code: Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |