If your program need administrator rights, you can use:
if !wapi_IsUserAnAdmin() wapi_ShellExecute_Wait( Nil, "runas", HB_ARGV(0), cParams)
return 0 endif
wapi_ShellExecute_Wait() ?
perhaps a UDF that you have implemented for that purpose?
[I don't believe it is a hidden "Easter egg" of our good Harbour we ignore? ;-)]
regrads,
Pete
HB_FUNC( WAPI_SHELLEXECUTE_WAIT ){ void * hOperation; void * hFile; void * hParameters; void * hDirectory; BOOL retVal; SHELLEXECUTEINFO ShExecInfo = {0}; ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS; ShExecInfo.hwnd = ( HWND ) hb_parptr( 1 ); ShExecInfo.lpVerb = HB_PARSTR( 2, &hOperation, NULL ); ShExecInfo.lpFile = HB_PARSTRDEF( 3, &hFile, NULL ); ShExecInfo.lpParameters = HB_PARSTR( 4, &hParameters, NULL ); ShExecInfo.lpDirectory = HB_PARSTR( 5, &hDirectory, NULL ); ShExecInfo.nShow = hb_parnidef( 6, SW_SHOWNORMAL ); ShExecInfo.hInstApp = NULL; retVal = ShellExecuteEx(&ShExecInfo); hb_retl( retVal ); while( WaitForSingleObject(ShExecInfo.hProcess,1000) != WAIT_OBJECT_0 )
{ SysRefresh(); } hb_strfree( hOperation );
hb_strfree( hFile ); hb_strfree( hParameters ); hb_strfree( hDirectory );}
function WAPI_SHELLEXECUTE_WAIT does not compile and throws a lot of error. Could you please have a look.
hbwinfunctions.prg: In function 'HB_FUN_WAPI_SHELLEXECUTE_WAIT':
hbwinfunctions.prg:29:4: error: unknown type name 'BOOL'; did you mean 'HB_BOOL'?
hbwinfunctions.prg:30:4: error: unknown type name 'SHELLEXECUTEINFO'
hbwinfunctions.prg:31:14: error: request for member 'cbSize' in something not a structure or union
hbwinfunctions.prg:31:31: error: 'SHELLEXECUTEINFO' undeclared (first use in this function)
hbwinfunctions.prg:31:31: note: each undeclared identifier is reported only once for each function it appears in
hbwinfunctions.prg:32:14: error: request for member 'fMask' in something not a structure or union
hbwinfunctions.prg:32:23: error: 'SEE_MASK_NOCLOSEPROCESS' undeclared (first use in this function)
hbwinfunctions.prg:33:14: error: request for member 'hwnd' in something not a structure or union
hbwinfunctions.prg:33:24: error: 'HWND' undeclared (first use in this function)
hbwinfunctions.prg:33:30: error: expected ';' before 'hb_parptr'
hbwinfunctions.prg:34:14: error: request for member 'lpVerb' in something not a structure or union
hbwinfunctions.prg:34:24: warning: implicit declaration of function 'HB_PARSTR'; did you mean 'HB_PARAMNO'? [-Wimplicit-function-declaration]
hbwinfunctions.prg:35:14: error: request for member 'lpFile' in something not a structure or union
hbwinfunctions.prg:35:24: warning: implicit declaration of function 'HB_PARSTRDEF'; did you mean 'HB_CAST_INT'? [-Wimplicit-function-declaration]
hbwinfunctions.prg:36:14: error: request for member 'lpParameters' in something not a structure or union
hbwinfunctions.prg:37:14: error: request for member 'lpDirectory' in something not a structure or union
hbwinfunctions.prg:38:14: error: request for member 'nShow' in something not a structure or union
hbwinfunctions.prg:38:23: warning: implicit declaration of function 'hb_parnidef' [-Wimplicit-function-declaration]
hbwinfunctions.prg:38:39: error: 'SW_SHOWNORMAL' undeclared (first use in this function)
hbwinfunctions.prg:39:14: error: request for member 'hInstApp' in something not a structure or union
hbwinfunctions.prg:40:13: warning: implicit declaration of function 'ShellExecuteEx'; did you mean 'hb_vmExecute'? [-Wimplicit-function-declaration]
hbwinfunctions.prg:41:4: warning: implicit declaration of function 'hb_retl'; did you mean '_rotl'? [-Wimplicit-function-declaration]
hbwinfunctions.prg:42:11: warning: implicit declaration of function 'WaitForSingleObject' [-Wimplicit-function-declaration]
hbwinfunctions.prg:42:41: error: request for member 'hProcess' in something not a structure or union
hbwinfunctions.prg:42:60: error: 'WAIT_OBJECT_0' undeclared (first use in this function)
hbwinfunctions.prg:44:7: warning: implicit declaration of function 'SysRefresh' [-Wimplicit-function-declaration]
hbwinfunctions.prg:46:4: warning: implicit declaration of function 'hb_strfree'; did you mean '_strrev'? [-Wimplicit-function-declaration
Is some header missing ?
Warm regards,
Jayadev
--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/4edbe0b2-d732-45a1-80e6-96bd5c471238%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Unsubscribe: harbou...@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 harbou...@googlegroups.com.