Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-09-2001, 01:16 AM
rwblinn rwblinn is offline
Junior Member
 
Join Date: Jan 2001
Posts: 2
Default Sending Text to another Application using sendmessage

I want to sent text using sendmessage and wm_paste to another app like notepad or outlook memo-field. this works fine for notepad, but not for outlook or winword. what do i do wrong. I use
1/Memo1.CopyToClipboard;
to send selected text from memo field to clipboard.

2/hWndParent := FindWindow(nil, PChar(sWindow));
to find the window where the text should go. sWindow is f.e.'notepad' or 'new message' for outlook
3/hWndChild := ChildWindowFromPoint(hWndParent, point(50,50));
to get the handle of the window I want to sent text to.
4/SendMessage(hWndChild, WM_PASTE, 1, 0);
to paste the text into the window

Note: I tried using wm_char. Same result as described above
Reply With Quote
  #2  
Old 01-09-2001, 04:37 AM
Tonny Tonny is offline
Junior Member
 
Join Date: Jan 2001
Posts: 3
Default RE: Sending Text to another Application using sendmessage

According to the Win32 Programmer's Reference both wParam and lParam should be zero. So :
SendMessage(hWndChild,WM_PASTE,0,0);
If it still doesn't work then check if the data in the clipboard is in CF_TEXT format.
Reply With Quote
  #3  
Old 01-10-2001, 04:34 AM
osamaao osamaao is offline
Member
 
Join Date: Jan 2001
Posts: 94
Default RE: Sending Text to another Application using sendmessage

Hi :
Try this, it may be a better aproach,

With the help of the API function GlobalAddAtom its possible to send a string via the Windows API. The function returns a number, which can be used at wParam or lParam from PostMessage (or SendMessage).

Sender:

wParam = GlobalAddAtom('string...')
PostMessage(HWnd, WM_XYZ, wParam, 0)


Receiver:

str = GlobalGetAtomName(wParam)
GlobalDeleteAtom(wParam)

Good luck, Osama.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 10:45 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.