hi,
is your App 32 Bit or 64 Bit
i guess App is 32 run on 64 Bit OS
if yes : you need to disable "Wow64 Redirection"
this Xbase++ Code using Ot4xb Syntax show how to call it from 32 Bit App under 64 Bit OS
#include "common.ch"
#include "ot4xb.ch"
#define SW_NORMAL 1
* --------------------------------------- *
PROCEDURE Main()
SHELLOPENFILE( "C:\WINDOWS\system32\" , "osk.exe")
RETURN
FUNCTION SHELLOPENFILE( cPath, cFile, cPara )
LOCAL lSuccess
LOCAL bSaveError
LOCAL oError
LOCAL Retvar := .F.
DEFAULT cPath TO ""
DEFAULT cFILE TO ""
DEFAULT cPara TO ""
IF Is64Bit()
@ Kernel32:Wow64EnableWow64FsRedirection( .F. ) // disable bevor API Call
ENDIF
bSaveError := ERRORBLOCK( { | e | BREAK( e ) } )
BEGIN SEQUENCE
lSuccess := @SHELL32:ShellExecuteA( APPDESKTOP() :GetHWND(), ;
"open", ;
cPath + cFile, ;
cPara, ;
CURDIR(), ;
SW_NORMAL )
DO CASE
CASE lSuccess > 32 // OK
Retvar := .T.
OTHERWISE
BREAK
ENDCASE
RECOVER USING oError
ERRORBLOCK( bSaveError )
IF !EMPTY(oError)
MSGBOX( DosErrorMessage( oError:osCode ), "Error osCode " + LTRIM( STR( oError:osCode ) ) )
ELSE
MSGBOX( "Error open "+ cPath + cFile, IF(Is64Bit(),"64 Bit", "32 Bit"))
ENDIF
END SEQUENCE
ERRORBLOCK( bSaveError )
IF Is64Bit()
@ Kernel32:Wow64EnableWow64FsRedirection( .T. ) // enable again
ENDIF
RETURN Retvar
FUNCTION Is64Bit()
RETURN IF( FILE( "C:\WINDOWS\SysWOW64\Format.COM" ), .T., .F. )