-
June 26th, 2003, 02:56 AM
#1
Senior Member
Pressing Alt Key With Win Api
How would you simulate the pressing of the Alt key to a program?
Code:
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const VK_MENU = &H12
Public Const WM_KEYDOWN = &H100
Public Const WM_KEYUP = &H101
SendMessageLong lhWnd, WM_KEYDOWN, VK_MENU, 0
SendMessageLong lhWnd, WM_KEYUP, VK_MENU, 0
That's the code i have right now, but it doesn't seem to select the menu
-
June 26th, 2003, 11:42 AM
#2
I know how to do this but before I tell you I want a legitimate reason as I notice you have negative points.
No Offence I'm sure you are a nice guy I just want to make sure your not just another malicious little turd sponging knowledge off the good guys.
-
June 26th, 2003, 12:02 PM
#3
I'm wondering if you need to send WM_SYS* messages to active the menu of a window... just an idea
I don't see any reason for suspecting that you have less than honourable intentions... presumably it's just to try and automate a program which doesn't provide a convenient interface for automation.
Slarty
-
June 26th, 2003, 06:36 PM
#4
Senior Member
i'm trying to make a bot for MSN6 that will automate the changing of the Display Pictures.
Since the MSN6 API doesn't have any options to do so, i'm trying to find another way around this.
I'm just trying to bring the menu up so that i can bring the Display Picture window up.
Honest, I won't do anything bad with it. =D
-
June 26th, 2003, 06:50 PM
#5
ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long
hWnd is the window id, wMsg is the Alt key value, et cetera...
you need to obtain the hWnd of the Application you want to send Alt to... This can be done many ways, i'd suggest reading up on your win API...
yeah, I\'m gonna need that by friday...
-
June 27th, 2003, 01:31 AM
#6
Senior Member
I don't need to know what the params stand for, I already know that. I just don't seem to be sending the command to the application properly or with the right params. It just doesn't seem to be selecting the menu. And yes, i have looked up the use of the command but i've found nothing with selecting the menu. That's why i'm seeking your expertise.
-
June 27th, 2003, 02:23 PM
#7
i haven't messed with windows API in a while, you should be able to find many tutorials, bas, etc...
in fact a fellow named Dos32 wrote some really nice tutorials and BAS files on complicated Windows API (most of it is from back in the day of AOL Progz)
yeah, I\'m gonna need that by friday...
-
June 27th, 2003, 04:56 PM
#8
Junior Member
in VC++ or SDK its simple just Send a Message
::SendMessage(hWnd,WM_KEYDOWN,VK_MENU,0);
::SendMessage(hWnd,WM_KEYUP,VK_MENU,0);
here the Hwnd is the Handle to the Window to which u want to send the Message
To send the message to Desktop Window
use GetDesktopwindow();
for VC++ Querys Email me at thevampirea@yahoo.co.in
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
|
|