Last years I write code twice a year and forgot almost everything about Windows programming.
I want to run browser with specified site after system boot and then close browser's window or browse's bookmark.

I tried to code something like that:

include 'win32ax.inc'
.data

adresik dd ?
.code


  start:

        invoke ShellExecute, NULL, "open", "http://www.ippp.pl", NULL, NULL, SW_SHOWNORMAL
        mov ,eax
invoke Sleep, 10000


        invoke  MessageBox,HWND_DESKTOP,"You can click to close the browsing site!",invoke GetCommandLine,MB_OK
        invoke Sleep, 2000
        invoke FindWindow,"","???"    ; How to find and close the browser or last opened bookmark ?
        invoke  CloseWindow,eax

        invoke  ExitProcess,0

.end start     

but it can't do what i want...
Could You improve my mistakes ?

______________________________
the trouble is that i have only Instance Handle (from ShellExecute) and i don't know:

How To Find a Window Handle from an Instance Handle to call SendMessage WM_QUIT ?

MSDN: use a GetWinHandle() function to return a Window handle based on an Instance handle
but there is no such a function inside of win32dlls...

_____________
Second solution: TerminateProcess wants handle to the process.
I have no hProcess.

what is relation between Process handle, Instance Handle, Windows handle and Process Id ?
_____________
what is the easiest way to do what I want ?

best regards!
Posted on 2010-07-21 03:15:33 by etn
I'm not 100% certain but I believe if you examine the return values from the Windows function calls you will find an ERROR_ACCESS_DENIED (0X05) in there somewhere. I've ran into this a few times especially when developing for Vista and Windows 7.

For starters, you probably want to look at this documenthttp://msdn.microsoft.com/en-us/library/aa446619(VS.85).aspx
Posted on 2010-07-24 16:05:11 by p1ranha