Page 1 of 1
DIRECTORY() and ShellExecute()
Posted: Fri Oct 21, 2022 4:58 am
by Jimmy
hi,
Code: Select all | Expand
aDir := DIRECTORY( cPath + "\*.*", "DHS" )
oGrid:aSource := aDir
cFile := oGrid:aSource[nRow][nCol]
IF FILE(cPath + cFile )
// open with associate App
MsgInfo( TRIM( cPath+cFile ))
nRet := ShellExecute( oWnd:hWnd, "open", CHR(34)+ TRIM( cPath+cFile ) +CHR(34) )
MsgInfo() show right Path+Filename
nRet is 42
this does open PRG File (with NPP++) but not TXT (with Notepad)
--
does DIRECTORY() return UNICODE or ANSI or OEM
do i use ShellExecute() wrong
total confuse ...
Re: DIRECTORY() and ShellExecute()
Posted: Fri Oct 21, 2022 7:53 am
by Enrico Maria Giordano
I need a complete sample to test it here.
Re: DIRECTORY() and ShellExecute()
Posted: Fri Oct 21, 2022 9:39 pm
by Jimmy
hi Enrico,
Enrico Maria Giordano wrote:I need a complete sample to test it here.
Code: Select all | Expand
#include "FiveWin.ch"
FUNCTION MAIN()
LOCAL oWnd
LOCAL aDir := DIRECTORY( "DSL*.*" )
LOCAL cFile
msginfo(hb_valToExp(aDir))
cFile := aDir[1][1]
msginfo(cFile)
DEFINE WINDOW oWnd
ACTIVATE WINDOW oWnd;
ON INIT MsgInfo ( oWnd: ReadImage ( "DSL_Verfügbarkeit2.JPG" ) [ 1 ] )
RETURN NIL
as i can say the Problem are German "Umlaut ü " in Filename
Re: DIRECTORY() and ShellExecute()
Posted: Sat Oct 22, 2022 12:13 am
by Jimmy
Re: DIRECTORY() and ShellExecute()
Posted: Sat Oct 22, 2022 4:45 am
by Jimmy
hi,
i have now test this
i have a File TEXT.TXT but it still does not "open"
Code: Select all | Expand
IF FILE(cPath + cFile )
MsgInfo( cPath + cFile )
nRet := ShellExecute( oWnd:hWnd, "open", TRIM( cPath+cFile ) )
File() des exist
MsgInfo() show full Path and Filename
nRet is 42
what i´m doing wrong

Re: DIRECTORY() and ShellExecute()
Posted: Sat Oct 22, 2022 5:43 am
by Antonio Linares
Dear Jimmy,
This is working fine here:
Code: Select all | Expand
#include "FiveWin.ch"
function Main()
ShellExecute( 0, "open", "checkres.txt" )
return nil
Re: DIRECTORY() and ShellExecute()
Posted: Sat Oct 22, 2022 7:17 am
by Jimmy
hi Antonio,
Antonio Linares wrote:This is working fine here:
Code: Select all | Expand
#include "FiveWin.ch"
function Main()
ShellExecute( 0, "open", "checkres.txt" )
return nil
it seems i have a big Problem while your Sample does not work on my PC (under 32 Bit OS )
i have create a File "checkres.txt" and "fill" it but when run your CODE it does not "open"
i know that TXT is assign to NotePad.EXE and it work under Xbase++ and HMG
i will try it on other PC and under 64 Bit
---
i use c:\fwh\samples\buildh.bat under 32 Bit OS with BCC7
i saw that my INCLUDE and LIB Environment still point to Xbase++ and HMG but not to FiveWin
BCDIR=c:\bcc7
FWDIR=c:\fwh
fwh=c:\fwh
GT=gtgui
HBDIR=C:\HARBOUR
hdir=C:\HARBOUR
hdirl=C:\HARBOUR\lib\win\bcc
INCLUDE=C:\ALASKA\XPPW32\INCLUDE;c:\ALASKA\XBTW32\INCLUDE\;c:\exp19\Include\;c:\hmg.3.4.4\INCLUDE\;
LIB=C:\ALASKA\XPPW32\LIB;c:\ALASKA\XBTW32\LIB\;c:\exp19\Lib\;c:\hmg.3.4.4\lib\;
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\ALASKA\XPPW32\BIN;C:\ALASKA\XPPW32\LIB;C:\ALASKA\XBTW32\BIN;C:\ALASKA\XBTW32\LIB;c:\exp19\bin19_sl1\;c:\exp19\Lib\;D:\DOS\BAT;D:\DOS\NC;D:\DOS\TOOL;D:\DOS\ETP;D:\DB3U;C:\Users\a\AppData\Local\Microsoft\WindowsApps;c:\HMG.3.5\2\hmg_webview2\WebView2\Win32;c:\fwh\dll;
do i need to change INCLUDE and LIB Environment

Re: DIRECTORY() and ShellExecute()
Posted: Sat Oct 22, 2022 7:58 am
by Antonio Linares
better clean those environment variables and lets see if that makes the difference
Re: DIRECTORY() and ShellExecute()
Posted: Sat Oct 22, 2022 8:42 am
by Jimmy
hi Antonio,
i saw in Taskmanager / User many "Editor" ... but i can´t "see" them ... hm
so i change CODE to
and voila Notepad appear
i guess also other have work but it was "hidden" ...

Re: DIRECTORY() and ShellExecute()
Posted: Sat Oct 22, 2022 8:49 am
by Enrico Maria Giordano
Right, forgot that parameter, sorry.