Page 2 of 2
Re: Hide external window
Posted: Thu Jan 07, 2010 8:48 pm
by UserOfPure
He said "like Notepad" which means "for example, Notepad" in English. So yes, he was referring to Notepad directly. As for the code, Fluid Byte's example using the Calculator's exact window caption will work. Fluid Byte used the class name instead (class is the first param, title is the second param) so something like FindWindow_(0,"Calculator") will do it.
Re: Hide external window
Posted: Thu Jan 07, 2010 9:00 pm
by RASHAD
OK run FindWindow_(0,"Notepad")
And tell me if it work or not
FindWindow_() it is not a reliable func
See Running one instance thread
Re: Hide external window
Posted: Thu Jan 07, 2010 9:27 pm
by mx101
RASHAD wrote:OK I am using Windows 7 x64
Please put some code using FindWindow_() to hide Calculator prog
mx101 did not say Notepad he said like NotePad so the choices are open
Please check
yes this is just example.
i need to hide a window that i call from another program is a console program.
thanks to all
Re: Hide external window
Posted: Thu Jan 07, 2010 9:29 pm
by Fluid Byte
RASHAD wrote:OK I am using Windows 7 x64
Please put some code using FindWindow_() to hide Calculator prog
Code: Select all
RunProgram("calc")
Delay(500)
hwndNotepad = FindWindow_("CalcFrame",0)
Delay(500)
ShowWindow_(hwndNotepad,#SW_HIDE)
:roll:
RASHAD wrote:FindWindow_() it is not a reliable func
Nonsense

Re: Hide external window
Posted: Thu Jan 07, 2010 9:51 pm
by RASHAD
MSDN
http://msdn.microsoft.com/en-us/librar ... .85).aspx
Remarks
If the lpWindowName parameter is not NULL, FindWindow calls the GetWindowText function to retrieve the window name for comparison. For a description of a potential problem that can arise, see the Remarks for GetWindowText.
For a description of a potential problem that can arise, see the Remarks for GetWindowText.
GetWindowText
http://msdn.microsoft.com/en-us/librar ... .85).aspx
Remarks
If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control. If the target window is owned by another process and has a caption, GetWindowText retrieves the window caption text. If the window does not have a caption, the return value is a null string. This behavior is by design. It allows applications to call GetWindowText without becoming unresponsive if the process that owns the target window is not responding. However, if the target window is not responding and it belongs to the calling application, GetWindowText will cause the calling application to become unresponsive.
To retrieve the text of a control in another process, send a WM_GETTEXT message directly instead of calling GetWindowText.
Depending on the Caption Text is the Nonsense and nothing else
Re: Hide external window
Posted: Thu Jan 07, 2010 10:28 pm
by Fluid Byte
You first posted a totally overkill solution for a pretty simple problem. I proved how to solve it easier. You also said it doesn't work with calc.exe on Windows 7, again I proved the opposite. Last but not least you say FindWindow_() is unreliable and post some irrelevant info from MSDN. Again you are missing the point since you continue to ignore the fact we are talking about the CLASSNAME, not the WINDOWTITLE.
Re: Hide external window
Posted: Thu Jan 07, 2010 10:52 pm
by RASHAD
I only have the prog. name for examole calc.exe
The Caption text will not be OK all times
And I do't want to hack the prog to get the ClassName 'Calcframe' for example
Your solutins are specific for special case And you do't like MSDN saying
So I will not argue with you anymore.
Chao
Re: Hide external window
Posted: Thu Jan 07, 2010 11:00 pm
by ts-soft
RASHAD wrote:And I do't want to hack the prog to get the ClassName 'Calcframe' for example
Code: Select all
Define ClassName.s{#MAX_PATH}
RunProgram("calc")
Delay(1000)
GetClassName_(GetForegroundWindow_(), @ClassName, #MAX_PATH)
Debug ClassName
Re: Hide external window
Posted: Thu Jan 07, 2010 11:09 pm
by RASHAD
@Thomas
You are using PureBasic to run the external prog (Not always will happen)
you assumed that the prog is focused (GetForegroundWindow_()) (Not always will happen)
If you will try to make a perfect code using that tech. you will come to a complicated one
No special case please
Have a good day
Re: Hide external window
Posted: Fri Jan 08, 2010 8:29 pm
by Rook Zimbabwe
Fluid Byte wrote:Be happy it's just Notepad and not some system critical application

Yeah or the AV or Malware scanners... THAT would be a different way of hooking it though...
Good thing we aren't helping with that!
Re: Hide external window
Posted: Wed Jul 07, 2010 11:18 am
by SeregaZ
why RunProgram with #PB_Program_Hide dont work?
Code: Select all
RunProgram("calc.exe", "", "", #PB_Program_Hide)
run then find window and then hide window - make some splash of this programm. it is not acceptably. who know how made it without this splashes? i mean start programm already hide. and then after some time show to user.
Re: Hide external window
Posted: Sun Aug 01, 2010 5:06 pm
by SeregaZ
i learn to hide window by ShowWindow_(HNDL, #SW_HIDE)
but - if this window is internet explorer window, and if after hiding in this window some thing happen - open.window or form.submit by javascripts - this window some time make show again, or this hide window take main focus, so if i write in this moment some text in word or playing full screen game - this hide window take focus, and it means i write text not to word but in this hide explorer or if it was full screen game - he is minimized.
so main question is - how to make this explorer - after hide - absolutly unfocusable? and if i unhide explorer - again to focusable.
something like if i run this explorer under another user in windows xp.