FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour DIRECTORY() and ShellExecute()
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
DIRECTORY() and ShellExecute()
Posted: Fri Oct 21, 2022 04:58 AM
hi,

Code (fw): Select all Collapse
   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 ...
greeting,

Jimmy
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: DIRECTORY() and ShellExecute()
Posted: Fri Oct 21, 2022 07:53 AM

I need a complete sample to test it here.

Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: DIRECTORY() and ShellExecute()
Posted: Fri Oct 21, 2022 09:39 PM
hi Enrico,
Enrico Maria Giordano wrote:I need a complete sample to test it here.


Code (fw): Select all Collapse
#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
greeting,

Jimmy
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: DIRECTORY() and ShellExecute()
Posted: Sat Oct 22, 2022 12:13 AM
hi,

have got Answer here
https://forums.fivetechsupport.com/viewtopic.php?f=3&t=42330

but still no Solution
greeting,

Jimmy
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: DIRECTORY() and ShellExecute()
Posted: Sat Oct 22, 2022 04:45 AM
hi,

i have now test this

i have a File TEXT.TXT but it still does not "open"
Code (fw): Select all Collapse
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 :-)
greeting,

Jimmy
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: DIRECTORY() and ShellExecute()
Posted: Sat Oct 22, 2022 05:43 AM
Dear Jimmy,

This is working fine here:
Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

   ShellExecute( 0, "open", "checkres.txt" )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: DIRECTORY() and ShellExecute()
Posted: Sat Oct 22, 2022 07:17 AM
hi Antonio,
Antonio Linares wrote:
This is working fine here:
Code (fw): Select all Collapse
#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 :-)
greeting,

Jimmy
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: DIRECTORY() and ShellExecute()
Posted: Sat Oct 22, 2022 07:58 AM

better clean those environment variables and lets see if that makes the difference

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: DIRECTORY() and ShellExecute()
Posted: Sat Oct 22, 2022 08:42 AM
hi Antonio,

i saw in Taskmanager / User many "Editor" ... but i can´t "see" them ... hm
so i change CODE to
Code (fw): Select all Collapse
   ShellExecute( 0, "open", "checkres.txt" ,,,SW_SHOW)

and voila Notepad appear :-)

i guess also other have work but it was "hidden" ... :-)
greeting,

Jimmy
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: DIRECTORY() and ShellExecute()
Posted: Sat Oct 22, 2022 08:49 AM

Right, forgot that parameter, sorry.

Continue the discussion