I have a text in the clipboard
I wish to see it with 'wordpad.exe'
I don't know how to make to wait that 'wordpad.exe' is completly launched
then copy the clipboard
can you help me ?

This is the code that I use:

;edition avec wordpad

;szText Entete,"Entete"
;szText Extdoc,".doc"

invoke lstrcpy,ADDR buffer,ADDR Entete
invoke lstrcat,ADDR buffer,ADDR Extdoc ;ajoute extension:buffer="Entete.doc"

invoke GetAppPath,ADDR bufferdd ;chemin actuel

;szText szCheminWordPad,"C:\Program Files\Accessoires\WordPad.exe"

mov sei.cbSize,sizeof SHELLEXECUTEINFO
mov eax,hWndEAD
mov sei.hwnd,eax
mov sei.lpVerb,OFFSET BtOpen
mov sei.lpFile,OFFSET szCheminWordPad ;="C:\Program Files\Accessoires\WordPad.exe"
mov sei.lpParameters ,OFFSET buffer ;="Entete.doc"
mov sei.lpDirectory,OFFSET bufferdd ;=actual path
mov eax,hInstance
mov sei.hInstApp,eax

invoke ShellExecuteEx,ADDR sei
;I try this code to wait the launch of wordpad.exe , but it's don't work

;mov eax,sei.hProcess
;invoke GetExitCodeProcess,eax,ADDR ExitCode
;xor eax,eax
;invoke atodw,ADDR ExitCode

;invoke dwtoa, eax,ADDR BufferPw

;invoke MessageBox,hInstance,ADDR BufferPw,ADDR AppName,MB_OK

;I put 'sleep' to wait ,but it is not nice way and this don't work at each time
invoke Sleep ,2000

;cherche "WordPadClass" sur le bureau
;szText WordPadClassName,"WordPadClass"
invoke FindWindowEx, NULL, NULL, ADDR WordPadClassName, NULL
mov hWordPad,eax

push eax
invoke Sleep ,600
;cherche RichEdit20A" dans WordPad

;szText szRich,"RichEdit20A" ;diff?rent dans 2000?

invoke FindWindowEx, hWordPad, NULL, ADDR szRich, 0

;put the cursor after one header (entete.doc)
invoke SendMessage, eax, EM_SETSEL,0fffh,0fffh ;diff?rent dans 2000?
;invoke SendMessage,eax,WM_VSCROLL,SB_ENDSCROLL ,15

pop eax
;copie clipboard dans le RichEdit
invoke SendMessage,eax,WM_PASTE,0,0
Posted on 2001-09-02 04:01:47 by franlou
is the clipboard copy operation lost, if done too early?
I think it will hang around in the message queue until
the program is completely started.
Posted on 2001-09-03 04:21:26 by beaster
No the data of clipboard are not lost;i can copy it in an instance of notepad ,making CRTL+V;

but the application continue the instructions and not wait that wordpad.exe is launched
so when wordpad.exe is opened the data from the clipboard are not copied because the instructions go quickly
I can see the file that i import ("entete.doc")
the cursor is waiting for at the end of this file.
that's all.
the data from clipboard are not copied
Posted on 2001-09-03 05:54:01 by franlou
I made someting similar some time ago

; TEXT macro from EliCZ APImacros
TEXT Class, #32770/0
TEXT Mp3Title, r@diomp3/0


; launch RadioWiz
invoke WinExec, addr szWizCmdLine, SW_SHOWNORMAL
cmp eax, 32
jb @err_wiz

; wait for RadioWiz to fire up [email]r@dio.mp[/email]3
invoke Sleep, 500
invoke FindWindow, offset szClass, offset szMp3Title
test eax, eax
jz @B


Posted on 2001-09-03 16:56:50 by -SMK-