|
-
Mar 16th, 2000, 04:22 AM
#1
Thread Starter
Hyperactive Member
Hello everybody!
I would like to click a button or menu from my application (like a BuzOf). I have only handle (by FindWindowEx). How to do it?
-----------
Thanks,
Johnny (753187 sec. to 15th birthday !)
-
Mar 16th, 2000, 04:37 AM
#2
Frenzied Member
You can use the SendMessag API but I can't tell you how unless I know exactly what you're trying to do.
If you post more Details I'll see if I can Help.
-
Mar 17th, 2000, 01:27 AM
#3
Thread Starter
Hyperactive Member
OK. I would like to monitore the window and press any button in it, when it shows.
For example:
I will be looking by FindWindow to 'Security warning' window (showed by IE when recieving a cookie). When I found it, I would like to press a 'More Details' button (by my application, of course).
Who is friendly with BuzOf (www.basta.com) knows what I want.
Or:
I would like to change a 'Show images' option in IE accesing the registry. Then, if an instance of IE is running, press the View/Refresh menu. Please do not help me with such things like SendKeys "{F5}". I need to run any of menu items in various applications.
If it is clear, now, please help me...
----------------
Thanks,
Johnny (677428 sec. to 15th birhtday !)
-
Mar 17th, 2000, 02:26 AM
#4
Well, assuming you have got the windowhandle (lets call it hWind), you can send the WM_LBUTTONDOWN message followed by a WM_LBUTTONUP message
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any) As Long
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
Private Sub Command1_Click()
Dim retVal as long
retVal = SendMessage(hWind, WM_LBUTTONDOWN, 0&, &H10001) ' we click at an offset of 1 pixel by 1
retVal = SendMessage(hWind, WM_LBUTTONUP, 0&, &H10001)
End Sub
Edited by Frans C on 03-17-2000 at 02:51 PM
-
Mar 20th, 2000, 04:38 AM
#5
Thread Starter
Hyperactive Member
But...
This works well, but only if the window is enabled. I need to call its click subroutine, even it is disabled.
?
----------
Thanks,
John (406655 sec. to 15th birthday !)
-
Mar 28th, 2000, 04:15 AM
#6
Hyperactive Member
Can this be used to select a menu that's in another app? I need to select the Edit menu from another app. I have the correct handle but GetLastError returns 1400 (Invalid Window Handle). Is that because it's a menu?
Thanks,
Wade
-
Mar 29th, 2000, 02:47 AM
#7
Thread Starter
Hyperactive Member
To enable item do this (change "TITLE" to app's title):
w = FindWindow(vbNullString, "TITLE")
m = GetMenu(w)
sm = GetSubMenu(m,2) 'Change 2 to &Edit's index
'first submenu is 0
'first submenu can be an icon in MDI app(!)
EnableMenuItem sm, its index, &H400 or &H0
You type select; would you like to click the whole Edit menu or run a specified item? To run item, use SendMessage.
-----------------
To my problem:
Is done 
1. the do..loop method helped
2. as well (maybe not so) as SendMesage
-
Mar 29th, 2000, 03:18 AM
#8
Hyperactive Member
I'd like to select the whole Edit menu. I can use SendMessage to select it, but I need to dropdown the menu instead. That's when it enables/disables its submenus.
Thanks,
Wade
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
|