DIRECTORY() and ShellExecute()

DIRECTORY() and ShellExecute()

Postby Jimmy » Fri Oct 21, 2022 4:58 am

hi,

Code: Select all  Expand view
  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) :shock:

--

does DIRECTORY() return UNICODE or ANSI or OEM :?:
do i use ShellExecute() wrong :?:

total confuse ...
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: DIRECTORY() and ShellExecute()

Postby Enrico Maria Giordano » Fri Oct 21, 2022 7:53 am

I need a complete sample to test it here.
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: DIRECTORY() and ShellExecute()

Postby Jimmy » Fri Oct 21, 2022 9:39 pm

hi Enrico,
Enrico Maria Giordano wrote:I need a complete sample to test it here.


Code: Select all  Expand view
#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
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: DIRECTORY() and ShellExecute()

Postby Jimmy » 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
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: DIRECTORY() and ShellExecute()

Postby Jimmy » Sat Oct 22, 2022 4:45 am

hi,

i have now test this

i have a File TEXT.TXT but it still does not "open"
Code: Select all  Expand view
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
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: DIRECTORY() and ShellExecute()

Postby Antonio Linares » Sat Oct 22, 2022 5:43 am

Dear Jimmy,

This is working fine here:
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

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

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: DIRECTORY() and ShellExecute()

Postby Jimmy » Sat Oct 22, 2022 7:17 am

hi Antonio,
Antonio Linares wrote:This is working fine here:
Code: Select all  Expand view
#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
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: DIRECTORY() and ShellExecute()

Postby Antonio Linares » Sat Oct 22, 2022 7:58 am

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: DIRECTORY() and ShellExecute()

Postby Jimmy » Sat Oct 22, 2022 8:42 am

hi Antonio,

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

and voila Notepad appear :D

i guess also other have work but it was "hidden" ... :roll:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1585
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: DIRECTORY() and ShellExecute()

Postby Enrico Maria Giordano » Sat Oct 22, 2022 8:49 am

Right, forgot that parameter, sorry.
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 104 guests