I use SendMessage() all the time in controlling an external video application 
and I'm on Windows 7 Enterprise 64Bit so I can't initially see what is going 
wrong for you.

it could be to do with permissions as VFP has the same problem with drag and 
drop. You can't run VFP as "administrator" and drag and drop onto your 
application from a non "administrator" loaded application.

Have you checked out running the application in purely runtime mode, where both 
VFP and Notepad are run as a standard user?

I'd love to know how to load an external application using the WinAPI but as an 
administrator as opposed to a standard user which it defaults to but that is 
another thread...

Dave


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of 
Man-wai Chang
Sent: 07 March 2012 13:09
To: ProFox Email List
Subject: win32api SendMessage()

I would like to use SendMessage() to send keystrokes to another window

#define WM_KEYDOWN        0x0100
#define WM_KEYUP              0x0101

DECLARE INTEGER SendMessage IN user32;
    INTEGER hWnd,;
    INTEGER Msg,;
    INTEGER wParam,;
    INTEGER lParam

DECLARE SHORT VkKeyScan IN user32;
    INTEGER ch

m.xx=VkKeyScan(asc("A"))
SendMessage( ln_current_window,  WM_KEYDOWN,  m.xx, 0) SendMessage( 
ln_current_window,  WM_KEYUP,  m.xx, 0)

It didn't work. Tried it on Notepad as well as Command Prompt.

What's wrong with my codes?

--
 .~. Might, Courage, Vision. SINCERITY!
/ v \ 64-bit Ubuntu 9.10 (Linux kernel 2.6.39.3) /( _ )\ 
http://sites.google.com/site/changmw
^ ^ May the Force and farces be with you!

[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to