News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Get Window Handle of Created Process

Started by dedndave, October 26, 2011, 05:26:22 AM

Previous topic - Next topic

hutch--

 :bg

You will be seeing TCHAR real soon[tm].  :bdg
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dedndave

yes, sadly, i think i have to become more familiar with unicode
it will be interesting to see how it is implemented in the upcoming masm32 version
it will also be interesting to see how WINVER and _WIN32_WINNT are handled   :P

baltoro

...So,...DAVE !!!
...Did you get it to work ???

...And, HUTCH,...
Quote from: HUTCH...You will be seeing TCHAR real soon,...
THANK GOD !!!
Baltoro

dedndave

well - i have that part written - not tested yet
i was just noticing how much variation there can be in what the GetCommandLine function returns - lol

there are a number of ways to open a process...

;typing at command prompt
;batch file (with/without quotes on command and/or tail)
;shortcut (with/without quotes on command and/or tail)
;explorer double-click
;desktop double-click
;CreateProcess - extending the process string
;CreateProcess - command line tail parameter
;let's not forget - right-click - Open With

there are others - but those are the ones i am primarily concerned with (registry entries, ShellExecute)
you get different tail strings for different methods
most noticably, some methods give you the EXE filename - some do not   :'(
sometimes the EXE is a fully qualifed path - sometimes not
seems like MS could have been a little more consistent

i want to pass the command line tail to the browser

baltoro

Note: I have provided a suggestion in LARGE FONT, for enhanced readability
I ran into this cool blog entry over at Raymond Chen's, The Old New Thing: How Can I Get Notified When Some Other Window Is Destroyed ?.
...And, here,...are a listing of: Event Constants, MSDN
This might help you conceptually.   

...But, remember,...I'm usually WRONG about stuff like this,... :eek
Baltoro

dedndave

got it working - very cool

i wrote the EnumWindowsProc callback to be dual-mode
in one mode, it creates a list of matching handles
in the other mode, it looks for a new handle (that is not in already in the list)

so, i call it in the first mode
create the browser process
every 100 ms, i call it to see if a new matching handle appears
if it does, i have my window handle
i time out if it doesn't find it in 8 seconds (too bad - lol)

now, to play with GetCommandLine to see what the "rules" are
it is not at all documented on MSDN
surprisingly, no community content on the subject, either
i guess most of those guys write in C and use the arg() functions

EDIT: nice, baltoro, i can read that no prob

dedndave

oh no!   :eek

thought i had a virus
playing with my program - i ran it - it opened firefox - which opened 2 webpages automatically
www.and.com and www.settings.com
i thought i had one of those re-direction viruses

then, i noticed more closely the names of the sites
little bug in my program
as it turned out, the command line for opening firefox was....



oops


dedndave

having a small problem with CreateProcess
namely, setting the STARTUPINFO.dwFlags STARTF_FORCEOFFFEEDBACK bit does not turn off the hour-glass
has anyone else seen this problem before ?