Page 1 of 1

Process ProgramDisplay()

Posted: Tue Apr 23, 2013 2:00 am
by IdeasVacuum
I would like to be able to RunProgram(An.exe,#PB_Program_Hide), if necessary change it's screen location, then un-hide it.

Re: Process ProgramDisplay()

Posted: Tue Apr 23, 2013 4:59 am
by jassing
Here's something (very simplified) I did for a similar situation... While it's not a "native" PB feature, it may get you by -- based on debugging I did, there is no way to "un hide" the program just based on the process handle...

Code: Select all

Procedure UnHideWindow(hwnd,*cTitle)
	Protected cTitle.s{128}
	Protected bContinue = #True 
  
	SendMessage_(hwnd,#WM_GETTEXT,128,@cTitle) 
  If Len(cTitle) And cTitle = PeekS(*cTitle)
  	ShowWindow(hWnd,#SW_SHOW)
  	bContinue = #False 
  EndIf
  
  ProcedureReturn bContinue
EndProcedure

hProgram = RunProgram("notepad.exe","","c:\temp",#PB_Program_Open|#PB_Program_Hide)
Delay(100) ; Needed to allow notepad to open it's window

EnumWindows_(@UnHideWindow(),@"Untitled - Notepad")

While ProgramRunning(hProgram)
	Delay(10)	
Wend