Page 3 of 3
Re: How to execute a google/yahoo/duckduck search from command line, or Harbour?
Posted: Wed Aug 31, 2022 3:50 pm
by HGAutomator
No. No. That's one of the things that I'm trying to say, Serge. It really doesn't work.
First,
EXECUTE FILE isn't understood by the compiler. _HB_FUN__EXECUTE is reported as an unresolved external, when the application is compiled as a console app.
In fact, I can't even find EXECUTE FILE defined anywhere. I did a global search through all the .CH files, and it's nowhere in the Minigui distribution.
Second,
Yesterday I was able to include ShellExecute (although I don't recall how). However, when the application is run, the text mode/console menu doesn't display.
Right now, I can't figure out how to include ShellExecute. It's reported as undefined.
At any rate, Pete's solution worked perfectly. It uses standard HB_RUN().
https://drive.google.com/file/d/126Z-Kf ... sp=sharing
serge_girard wrote: ↑Wed Aug 31, 2022 3:26 pm
HGAut
What is text-mode app? You mean DOS screen? Then this works:
Code: Select all
FUNCTION Main
REQUEST HB_GT_WIN_DEFAULT
cAPP := 'c:\Progra~1\Google\Chrome\Application\chrome.exe '
EXECUTE FILE "&cAPP " PARAMETERS 'www.google.com/search?q=what+the'
return
Re: How to execute a google/yahoo/duckduck search from command line, or Harbour?
Posted: Wed Aug 31, 2022 6:36 pm
by hansmarc
Hi hmg'ers,
some information concerning 'Execute File' and 'ShellExecute' for those who are interested.
'Execute file' is translated by \minigui\include\i_exec.ch to 'WaitRunTerm' or '_Execute'.
The source of '_Execute' can be found in \minigui\source\h_winapimisc.prg.
And '_Execute' calls 'ShellExecute' that you can find in \minigui\source\c_winapimisc.c
This function is compiled in \minigui\harbour\lib\hbwin.lib.
If you want to use 'Execute file' or 'ShellExecute' include this lib when you compile your program.
Regards
Hans
Re: How to execute a google/yahoo/duckduck search from command line, or Harbour?
Posted: Wed Aug 31, 2022 7:15 pm
by HGAutomator
I see it, thanks Hans. It's defined as 'EXECUTE' with a 'FILE' parameter.
Unfortunately, I already tried linking in the hbwin library. After that compiles, the application runs but it doesn't display anything.
I'll look closer at it, in the debugger. Maybe there's something else that's happening, prior to displaying the menu.
Thanks and regards,
hansmarc wrote: ↑Wed Aug 31, 2022 6:36 pm
Hi hmg'ers,
some information concerning 'Execute File' and 'ShellExecute' for those who are interested.
'Execute file' is translated by \minigui\include\i_exec.ch to '
WaitRunTerm' or '
_Execute'.
The source of '
_Execute' can be found in \minigui\source\h_winapimisc.prg.
And '_Execute' calls '
ShellExecute' that you can find in \minigui\source\c_winapimisc.c
This function is compiled in \minigui\harbour\lib\hbwin.lib.
If you want to use 'Execute file' or 'ShellExecute' include this lib when you compile your program.
Regards
Hans
Re: How to execute a google/yahoo/duckduck search from command line, or Harbour?
Posted: Wed Aug 31, 2022 9:19 pm
by AUGE_OHR
hi,
i´m not a Internet Guru but i "think" you are using "ShellExecuteA()" wrong.
"normal" Files are assassinate with App so it will call EGDE, FireFox or Chrome when got a "http" or "https"
so you need "only" to call URL
---
this is a Sample how to get "Location" of a Adresse using Google Maps
Code: Select all
PROCEDURE ShowMap( cTab )
// http://maps.google.com/maps?q=Helstorfer%20Str.%207%2030625%20Hannover
LOCAL cURL := "http://maps.google.com/maps?q="
cURL += STRTRAN( ( TRIM( XPPTEL->STRASSE ) ), " ", "%20" ) + "%20"
cURL += STRTRAN( ( TRIM( XPPTEL->PLZ ) ), " ", "%20" ) + "%20"
cURL += STRTRAN( ( TRIM( XPPTEL->STADT ) ), " ", "%20" )
SHELLOPENFILE( cURL )
RETURN
here my ""ShellExecuteA()" Function using DllCall
Code: Select all
STATIC FUNCTION SHELLOPENFILE( cCmd, cParameter )
LOCAL lSuccess
LOCAL Retvar := .F.
IF EMPTY( cCmd )
RETURN .F.
ENDIF
lSuccess := DllCall( "SHELL32.DLL", DLL_STDCALL, ;
"ShellExecuteA",;
0,;
"open",;
cCmd, ;
cParameter,;
CURDIR(),;
SW_NORMAL ) // SW_MAXIMIZE
DO CASE
CASE lSuccess > 32 // Aufruf erfolgreich
Retvar := .T.
CASE lSuccess = SE_ERR_NOASSOC // Keine verknpfte Anwendung
// Falls ShowOpenWithDialog = True, wird der Dialog
// "™ffnen mit" fr diese Datei angezeigt:
// Shell "RunDLL32 shell32.dll,OpenAs_RunDLL " & Filename
DllCall( "SHELL32.DLL", DLL_STDCALL, ;
"OpenAs_RunDLL", 0, NIL, cCmd, ;
NIL, CURDIR(), SW_NORMAL ) // SW_MAXIMIZE
// Die Auswahlm”glichkeit wird als Erfolg gewertet:
Retvar := .T.
OTHERWISE
// ShellExecute war erfolglos.
// Boolean-Standardwert False zurckgeben
Retvar := .F.
ENDCASE
RETURN Retvar
Re: How to execute a google/yahoo/duckduck search from command line, or Harbour?
Posted: Thu Sep 01, 2022 5:49 am
by serge_girard
Jimmy,
Where is DllCall ?
Compile complains....
Serge
Re: How to execute a google/yahoo/duckduck search from command line, or Harbour?
Posted: Thu Sep 01, 2022 6:00 am
by AUGE_OHR
oh, sorry ... Xbase++ Syntax
use this for HMG
Code: Select all
#xtranslate DllCall => HMG_CallDLL
and DLL_STDCALL -> DLL_OSAPI
Re: How to execute a google/yahoo/duckduck search from command line, or Harbour?
Posted: Thu Sep 01, 2022 6:11 am
by serge_girard
Thanks, and this "DLL_STDCALL -> DLL_OSAPI"?
Serge
Re: How to execute a google/yahoo/duckduck search from command line, or Harbour?
Posted: Thu Sep 01, 2022 6:21 am
by AUGE_OHR
serge_girard wrote: ↑Thu Sep 01, 2022 6:11 am
and this "DLL_STDCALL -> DLL_OSAPI"?
i´m getting old ...
it is from c:\hmg.3.4.4\HARBOUR\contrib\hbxpp\dll.ch to use Xbase++ Code under harbour
Code: Select all
#define DLL_STDCALL 0x20
#define DLL_SYSTEM 0x04
#if defined( __PLATFORM__WINDOWS )
#define DLL_OSAPI DLL_STDCALL
#elif defined( __PLATFORM__OS2 )
#define DLL_OSAPI DLL_SYSTEM
#else
#define DLL_OSAPI DLL_CDECL
#endif
Re: How to execute a google/yahoo/duckduck search from command line, or Harbour?
Posted: Thu Sep 01, 2022 6:39 am
by serge_girard
Great, now it works!
Serge
Re: How to execute a google/yahoo/duckduck search from command line, or Harbour?
Posted: Thu Dec 15, 2022 10:34 pm
by Claudio Ricardo
Hello, I just saw this thread and I want to comment that I have been able to pass parameters like this:
Execute File "Update_C.exe" Parameters "t"
To run it from the command line I would write:
Update_C /t