|
-
Sep 11th, 2001, 04:36 AM
#1
Thread Starter
Monday Morning Lunatic
Well, if it's in your program can't you just use the normal VB syntax?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 11th, 2001, 08:33 AM
#2
Junior Member
It is not in my program. What I want to do is check the message box of another program and click on its button. I have the code to do the check for the program and the click. I just need to be able to check the message now.
-
Sep 12th, 2001, 02:45 PM
#3
Lively Member
Here ya go.
PHP Code:
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
public function gettext(hwnd as long) as string
Dim sz as integer
sz=SendMessage(hwnd,WM_GETTEXTLENGTH,0,0)
sz=sz+1
call SendMessage(hwnd,WM_GETTEXT,sz,gettext)
end function
public sub settext(hwnd as long, text as string)
SendMessage(hwnd,WM_SETTEXT,0,text)
end sub
'To set a string, do this:
call settext(Text1.hwnd,"This is the new text")
'To get a string, do this:
text = gettext(Text1.hwnd)
'There ya have it! Of course, you COULD do this:
Text1.text = "This is the new text"
'and
text=Text1.text
'But, the API version is much more fun, doncha think?
if(GetWindowLong(hwnd,GWL_ID)==IDC_MICROSOFT_APPLICATION)
{
SetWindowText(hwnd,"I suck.");
SendMessage(hwnd,WM_START_SUCKING,0,0);
SendMessage(hwnd,WM_CRASH,0,0);
}
-
Sep 13th, 2001, 07:31 AM
#4
Junior Member
Thanks I will try this
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|