Hi Francesco,
Okay, I see what you mean. We should fix hb_cmdline() to
work properly, it's a common need. I'm not 100% sure
where to touch current code, first we get the command line
directly from WinMain(), split the command line to pieces
in /include/hbwmain.c for GUI apps _or_ get the command
line already split from main() (I think that's what happens in
our current example). Later on, we reassemble the pieces
in /source/vm/cmdarg.c into the full command line.

Probably hb_cmdline() should be modified to use the
direct Windows API.

Could you help here?

Brgds,
Viktor

On Tue, Feb 17, 2009 at 9:33 AM, Francesco Saverio Giudice <
i...@fsgiudice.com> wrote:

> Hi Viktor,
>
> Il 17/02/2009 1.12, vszak...@users.sourceforge.net ha scritto:
>
>> 2009-02-17 01:03 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
>>  * contrib/hbblat/tests/blatcmd.prg
>>    % Replaced command line retrieval with hb_cmdline() call.
>>
>
>
> Thank you for other changes, but this should be reverted, as I will do but
> after a your reply to this mail, because hb_cmdline() doesn't work in same
> way of API GetCommandLine(), that I think should be used inside hb_cmdline()
> at Windows level.
>
> To understand the difference please try the below example and on command
> line try this command and see the difference (please change f...@address,
> my.smtp.server, t...@address with yours):
>
> blatcmd - -body "Message body" -t t...@address -s "test" -server
> my.smtp.server -debug -log blat.log -timestamp -q -f f...@address
>
> as you will see, in hb_cmdline() version '"' are lost and blat doesn't send
> the mail.
>
> Best regards
>
> Francesco
>
>
> -- start of blatcmd.prg --------------------------
> #include "common.ch"
>
> PROCEDURE Main()
>
>   LOCAL cCmd := hb_cmdline()
>   LOCAL cCmd1 := GetParams()
>   LOCAL nRet
>
>   ? "Simple BLAT Command interface"
>   ? "With hb_cmdline() paramenters: "
>   ? cCmd
>   ? "With WAPI_GetCommandLine() paramenters1: "
>   ? cCmd1
>   IF !Empty( cCmd )
>      ? "Sending parameters to blat"
>      nRet := hb_BlatSend( cCmd )
>      ? nRet
>   ENDIF
>
>   ? "Paramenters: ", cCmd
>   ? "Paramenters1: ", cCmd1
>   IF !Empty( cCmd1 )
>      ? "Sending parameters to blat"
>      nRet := hb_BlatSend( cCmd1 )
>      ? nRet
>
>   ENDIF
>
> RETURN
>
> STATIC FUNCTION GetParams()
>   LOCAL cCmd := WAPI_GetCommandLine()
>   LOCAL n
>
>   // Search first space after program name
>   n := AT( " ", cCmd )
>   IF n > 0
>      // remove program name
>      cCmd := SubStr( cCmd, n + 1 )
>   ELSE
>      // empty params list
>      cCmd := ""
>   ENDIF
>
> RETURN cCmd
>
> //-----------------------------------------
>
> // TODO: move to hbwin lib
> #pragma BEGINDUMP
>
> #define HB_OS_WIN_32_USED
>
> #include <windows.h>
>
> #include "hbapi.h"
> #include "hbapiitm.h"
> #include "hbstack.h"
> #include "hbapierr.h"
> #include "hbapifs.h"
>
> /* GetCommandLine() returns entire command line as a single string */
> HB_FUNC( WAPI_GETCOMMANDLINE )
> {
>   hb_retc( GetCommandLine() );
> }
>
> #pragma ENDDUMP
> --- end of blatcmd.prg --------------------------------
>
>
>
> _______________________________________________
> Harbour mailing list
> Harbour@harbour-project.org
> http://lists.harbour-project.org/mailman/listinfo/harbour
>
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to