Re: win32api SendMessage()

2012-03-21 Thread Man-wai Chang
In court, I would be nailed by the other side's lawyers. The whole point of a trial is to find mistakes. :) On Tue, Mar 20, 2012 at 8:03 PM, Frank Cazabon frank.caza...@gmail.com wrote: LOL! I wondered about that On 20/03/2012 07:41 AM, Man-wai Chang wrote: Just noticed my message left out an

Re: win32api SendMessage()

2012-03-20 Thread Man-wai Chang
Just noticed my message left out an important word: I am NOT building a malware just want to send text from my little Foxpro tool to other windows. :) On Wed, Mar 14, 2012 at 5:09 PM, Man-wai Chang chan...@gmail.com wrote: What I would like to know is whether there is a way to find the caret

Re: win32api SendMessage()

2012-03-20 Thread Frank Cazabon
LOL! I wondered about that Frank. Frank Cazabon On 20/03/2012 07:41 AM, Man-wai Chang wrote: Just noticed my message left out an important word: I am NOT building a malware just want to send text from my little Foxpro tool to other windows. :) On Wed, Mar 14, 2012 at 5:09 PM, Man-wai

Re: win32api SendMessage()

2012-03-14 Thread Man-wai Chang
I noticed by SetForegroundWindow(), the caret of the target window would gain keyboard focus, and then I could use GetTUIThreadInfo() to find the hWnd of the caret in the target window. The trick is to give time (maybe using Sleep()) for the caret to gain keyboard focus. What I would like to know

Re: win32api SendMessage()

2012-03-13 Thread Man-wai Chang
Do you have a solution that need not use SetForegroundWindow()? Microsoft's chinese input methods doesn't seem to set the foreground window before dumping text into the target window. I saw no flash of window title bar. On Mon, Mar 12, 2012 at 11:21 PM, Dave Crozier da...@flexipol.co.uk wrote:

RE: win32api SendMessage()

2012-03-13 Thread Dave Crozier
...@leafe.com] On Behalf Of Man-wai Chang Sent: 13 March 2012 08:22 To: profox@leafe.com Subject: Re: win32api SendMessage() Do you have a solution that need not use SetForegroundWindow()? Microsoft's chinese input methods doesn't seem to set the foreground window before dumping text

Re: win32api SendMessage()

2012-03-12 Thread Man-wai Chang
Ha ha.. I found the problem. I must Sleep(aWhile) after SetForegroundWindow(hWnd) to give time for hWnd to turn on its caret and capture keyboard input, BEFORE calling GetGUIThreadInfo(GetWIndowThreadProcessId(hWhd)). Also, Micro$oft Word does not respond to SendMessage(WM_CHAR) but

Re: win32api SendMessage()

2012-03-11 Thread Man-wai Chang
Oh well... I just discovered WritePad and Word don't report any GUIThreadInfo at all the example that worked with Notepad's caret failed with them. --  .~. Might, Courage, Vision. SINCERITY! / v \ 64-bit Ubuntu 9.10 (Linux kernel 2.6.39.3) /( _ )\ http://sites.google.com/site/changmw ^ ^ May

Re: win32api SendMessage()

2012-03-10 Thread Man-wai Chang
Oh well, I just learnt that there is something called caret in Windows. So what I should do is to find the hWnd of the class that got the caret. Now the problem is: I must SetForegroundWIndow() first in order to find the hWnd that got the caret. Using SetForegroundWindow() will cause the window

Re: win32api SendMessage()

2012-03-10 Thread Tracy Pearson
Man-wai Chang chan...@gmail.com wrote: Oh well, I just learnt that there is something called caret in Windows. So what I should do is to find the hWnd of the class that got the caret. Now the problem is: I must SetForegroundWIndow() first in order to find the hWnd that got the caret. Using

Re: win32api SendMessage()

2012-03-10 Thread Man-wai Chang
Yes, Your Honor. But when I run my Foxpro app, the ForegroundWindow would become my app, The ForegroundWindow always have the caret if and only if it accepts keyboard input! So does Windows remember the thread holding the caret before launching a new window? And if it does, how could I read that

Re: win32api SendMessage()

2012-03-10 Thread Tracy Pearson
Man-wai Chang chan...@gmail.com wrote: Yes, Your Honor. But when I run my Foxpro app, the ForegroundWindow would become my app, The ForegroundWindow always have the caret if and only if it accepts keyboard input! So does Windows remember the thread holding the caret before launching a new

Re: win32api SendMessage()

2012-03-10 Thread Man-wai Chang
On Sat, Mar 10, 2012 at 11:43 PM, Tracy Pearson tr...@powerchurch.com wrote: I got an idea: If I could code my Foxpro app such that it did NOT accept any input in the very beginning (no edit, no textbox, ..), then the Foxpro app would not show a caret. That way, I could find out the last

Re: win32api SendMessage()

2012-03-07 Thread Tracy Pearson
Man-wai Chang chan...@gmail.com wrote: I would like to use SendMessage() to send keystrokes to another window #define WM_KEYDOWN0x0100 #define WM_KEYUP 0x0101 DECLARE INTEGER SendMessage IN user32; INTEGER hWnd,; INTEGER Msg,; INTEGER wParam,; INTEGER lParam

RE: win32api SendMessage()

2012-03-07 Thread Dave Crozier
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

Re: win32api SendMessage()

2012-03-07 Thread Christof Wollenhaupt
I would like to use SendMessage() to send keystrokes to another window That might be easier using the keybd_event function ( http://msdn.microsoft.com/en-us/library/windows/desktop/ms646304(v=vs.85).aspx ). Christof --- StripMime Report -- processed MIME parts --- multipart/alternative

Re: win32api SendMessage()

2012-03-07 Thread Man-wai Chang
Yes, I am running both programs (sender and receiver) at normal user level. On Wed, Mar 7, 2012 at 10:09 PM, Dave Crozier da...@flexipol.co.uk wrote: 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

Re: win32api SendMessage()

2012-03-07 Thread Man-wai Chang
I found the original MSDN article suggesting your method. http://social.msdn.microsoft.com/Forums/en/visualfoxprogeneral/thread/f46be74c-c3b9-4c71-b1b5-d648626ca744 I copied the codes from that MSDN. First time I hit the button, the keybd_event() worked. Then on the next button push to activate

Re: win32api SendMessage()

2012-03-07 Thread Man-wai Chang
Sorry, I forgot to mention one thing: I had added SetForegroundWindow(), SetActiveWindow() and SetFocusAPI() to switch focus from the receiver back to the sender's hWnd. If I didn't reset the focus/activewindow/foreground, the example codes worked flawlessly. On Wed, Mar 7, 2012 at 11:22 PM,

Re: win32api SendMessage()

2012-03-07 Thread Man-wai Chang
I am doing everything from the same user login session. On Wed, Mar 7, 2012 at 9:46 PM, Tracy Pearson tr...@powerchurch.com wrote: I know some security related changes came with Vista that may prevent that. Does this code work on XP, but not Vista/7? --  .~. Might, Courage, Vision.

Re: win32api SendMessage()

2012-03-07 Thread Man-wai Chang
After a lot of doing Google serach, problem solved by a message from a Delphi forum: http://delphi.xcjc.net/viewthread.php?tid=479 I need to add an WM_CHAR message between WM_KEYDOWN WM_KEYUP. m.yy=VkKeyScan(asc(A)) SendMessage(ln_current_window,WM_KEYDOWN, m.yy, 0)

Re: win32api SendMessage()

2012-03-07 Thread Sytze de Boer
Would you be interested in now sharing the complete code by posting it ? S On Thu, Mar 8, 2012 at 8:05 AM, Man-wai Chang chan...@gmail.com wrote: After a lot of doing Google serach, problem solved by a message from a Delphi forum: http://delphi.xcjc.net/viewthread.php?tid=479 I need to