Postmessage for keys stroke and mouse click in VBA

Dear Expert,
I would like to ask serveral question
Question-1 how to do postmessage with simulation key stroke of Alt-s combined keys, and I tried the follows
it should work but it fail ?
PostMessage hdlg, WM_SYSKEYDOWN, &H73&, 0  'Alt-S Down
'PostMessage hdlg, WM_SYSTEMUP, &H73&, 0   'Alt-S Up
'Ascii of S in HEX shoule be 73.
Question-2, I read those post, sometimes, people are using sendmessage, sometime using postmessage
what is the major different, I tried sendmessage for sending alt-s  but it not repsone .
Question-3, Should we do coding to a must for including WM_SYSKEYUP/WM_LBUTTONUP   when doing WM_SYSKEYDOWN/WM_LBUTTONDOWN for simulating key-stroke and mouse-click that is similar our hand operation, press
key down and key up/( OR mouseclick down/up). I found sometimes the opertioan is also working even wihout
'PostMessage hdlg, WM_SYSTEMUP VBA statement , Why ?
Question-4, what is different we are between using sendmessage and sendlgitemmessage ?
Question-5, WHen we including API lib like Private Declare Function PostMessage Lib "user32" Alias "PostMessageA"
why using Alias ,?I know A is for ascill and W is for unicode, how to input the uncode for postmessage  when using
Private Declare Function PostMessageW Lib "user32"

Please advise

LVL 13
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use keybd_event() or SendInput() instead.

2 )
SendMessage() blocks the thread until the application processes the message.
PostMessage() sends the message and doesn't care about the return value of wheter the application processed the message, it doesn't block the thread.
Refer to #1

SendMessage() requires a handle to the control which in most cases requires you to walk the chain of controls until you find the one you need to automate.
SendDlgItemMessage() works differently, some windows mostly dialogs in windows have static control ID's associated with them that can be used. This eliminates the requirment of walking the chain of control since you can associate the control of interest with the control ID instead. It will find the particlar control by it's control ID and send the message to that control.

SendDlgItemMessage() is also the same as using SendMessage() and GetDlgItem()
Yes some API use ANSI and WIDE versions particular when dealing with marshaling strings. It's best to use the WIDE versions when possible on Windows NT. The "Alias" is a way to reference the API name and use a different name in your code. For example there is no API function named PostMessage but rather they are exported as PostMessageA and PostMessageW. You can either declare it directly and ignore the "Alias" member OR you can declare it as PostMessage() but then you must use "Alias" so the call knows how to call the *real exported function since PostMessage doesn't exist.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
duncanb7Author Commented:
THanks for your reply
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.