Hb_ProcessRun & hidden console window

513 views
Skip to first unread message

Zeljko

unread,
Feb 8, 2013, 5:26:36 AM2/8/13
to harbou...@googlegroups.com
When I call HB_ProcessRun("PCL6",,,,.f.) on a Windows machine, a small console window is displayed where the EXE is being run. Is there a way to prevent this cosmetic nuisance and hide the console window, i.e. run it in "silent" mode?

Brunello Pulix

unread,
Feb 8, 2013, 10:53:55 AM2/8/13
to harbou...@googlegroups.com
Hi
you can try this example

Greetings
brunello pulix



Procedure RUN_SHELL(cCommand,mode,waitprocess)
LOCAL o
*
Default(@mode,1)
Default(@waitprocess)
*
o := CreateObject('WScript.Shell')
o:Run(cCommand,mode,waitprocess)
o:Destroy()
*
/*********************************************************************
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("calc.exe"),1,TRUE
Wscript.Echo "Script completed."

0 - Hides the window and activates another window.
1 - Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
2 - Activates the window and displays it as a minimized window.
3 - Activates the window and displays it as a maximized window.
4 - Displays a window in its most recent size and position. The active window remains active.
5 - Activates the window and displays it in its current size and position.
6 - Minimizes the specified window and activates the next top-level window in the Z order. The Z order is nothing more than the list detailing the order in which windows are to be activated. If you press ALT+TAB, you will see a graphical representation of the Z list.
7 - Displays the window as a minimized window. The active window remains active.
8 - Displays the window in its current state. The active window remains active.
9 - Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
10- Sets the show-state based on the state of the program that started the application.
*/


Zeljko

unread,
Feb 9, 2013, 4:45:50 AM2/9/13
to harbou...@googlegroups.com
@Brunell. What exactly is the Default() function? When compiling, I get a HB_FUN_DEFAULT undefined reference error. If I understand correctly, I should call your run_shell function like this:
run_shell ("DIR", 0, .t.)

Zeljko

unread,
Feb 9, 2013, 4:53:45 AM2/9/13
to harbou...@googlegroups.com
I also get an undefined reference for the CreateObject function.

Brunello Pulix

unread,
Feb 9, 2013, 10:06:39 AM2/9/13
to harbou...@googlegroups.com

Change:
Default Mode TO 1
Default waitprocess To .T.
*
and run: 
RUN_SHELL(exefile,0,.F.)

or:
RUN_SHELL(batfile,1,.T.)

vszakats

unread,
Feb 9, 2013, 10:36:46 AM2/9/13
to harbou...@googlegroups.com


On Friday, February 8, 2013 11:26:36 AM UTC+1, Zeljko wrote:
When I call HB_ProcessRun("PCL6",,,,.f.) on a Windows machine, a small console window is displayed where the EXE is being run. Is there a way to prevent this cosmetic nuisance and hide the console window, i.e. run it in "silent" mode?

win_RunDetached( [<cCmdName>], <cCmdLine>, [@<nProcessID>], [<lHidden>] ) -> <lSuccess>

Zeljko

unread,
Feb 9, 2013, 2:11:11 PM2/9/13
to harbou...@googlegroups.com
Hi Viktor. Your suggestion seems quite interesting. My problem is, though, that I may not run the command asynchronously. From the name of the function I guess it is asynchronous? To be precise, I have to rung PCL GHOST and wait for the process to finish before my APP can continue. Is there some function like win_Run (without the detached keyword) that can be run in a hidden consoel windows? Also, what are cCmdName and cCmdLine arguments in the function? Which of the two arguments is used to specify the shell command to run?

vszakats

unread,
Feb 9, 2013, 4:20:30 PM2/9/13
to harbou...@googlegroups.com
On Saturday, February 9, 2013 8:11:11 PM UTC+1, Zeljko wrote:
Hi Viktor. Your suggestion seems quite interesting. My problem is, though, that I may not run the command asynchronously. From the name of the function I guess it is asynchronous? To be precise, I have to rung PCL GHOST and wait for the process to finish before my APP can continue. Is there some function like win_Run (without the detached keyword) that can be run in a hidden

Not that I know of.

consoel windows? Also, what are cCmdName and cCmdLine arguments in the function? Which of the two arguments is used to specify the shell command to run?

See CreateProcess() MSDN documentation about them, in 
practice I've found it's enough to use the second parameter.

-- Viktor

Zeljko

unread,
Feb 10, 2013, 1:42:53 AM2/10/13
to harbou...@googlegroups.com
@Viktor. OK. Found this interesting function:
     HB_ProcessValue(nProcessId,.t.)
If this is doing what I think it is (halting the process until the process with nProcessId handle has finished), then putting it after 
     win_RunDetached( , "C:\PCL_GHOST\PCL6",@nProcessId , .t. )  
seems to be what I was looking for.

Evangelos Tsakalidis

unread,
Sep 2, 2014, 3:12:29 AM9/2/14
to harbou...@googlegroups.com
Hi Zeljko.
Can you give me an example using of these two functions ( HB_ProcessValue - win_RunDetached)?
I can't halt the process until the process with nProcessId handle has finished.

Evangelos


--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users
 
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Bernard Mouille [w]

unread,
Sep 2, 2014, 6:15:14 AM9/2/14
to harbou...@googlegroups.com

Hello Evangelos

 

For HB_ProcessValue, look

 

Sources\harbour_Night_20120913\extras\httpsrv\uhttpd.prg

Sources\harbour_Night_20130301\utils\hbmk2\hbmk2.prg

Sources\harbour_Night_20130301\ChangeLog.txt

 

Bernard

 


De : harbou...@googlegroups.com [mailto:harbou...@googlegroups.com] De la part de Evangelos Tsakalidis
Envoyé : mardi 2 septembre 2014 09:12
À : harbou...@googlegroups.com
Objet : Re: [harbour-users] Re: Hb_ProcessRun & hidden console window

Evangelos Tsakalidis

unread,
Sep 2, 2014, 12:19:50 PM9/2/14
to harbou...@googlegroups.com
Bernard thank you, but I can't find what I need.

Evangelos


--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages