How to define a parameter

Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

How to define a parameter

Post by Otto »

Can someone help me to pass the parameter to the messageBox.
I would like to show cTest inside the messagebox.

Thanks in advance
Otto

Code: Select all

#include "FWCE.ch"
//----------------------------------------------------------------------------//
function Main()
   local oDlg, cText := "Hello world!   "
  local hReturn := "" 

  hReturn = TESTFUNKTION( "216.117.77.7" )

  msginfo(hReturn)
    
return nil

//----------------------------------------------------------------------------//

#pragma BEGINDUMP 

#include <windows.h> 
#include <hbapi.h> 

HB_FUNC( TESTFUNKTION )
{
   LPSTR cTest=  ( hb_parc( 1 ) ) ;
   
//MessageBox( GetActiveWindow(), ( char * ) cTest, ( char * ) cAgent,0);

//MessageBox (NULL,  _T( &cTest) , _T("Hello"), 0);

MessageBox (NULL,  _T("Hello") , _T("Hello"), 0);


hb_retc( ( char * ) cTest);
}

#pragma ENDDUMP
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: How to define a parameter

Post by Daniel Garcia-Gil »

Hello Mr. Otto

you need convert to wide

with Harbour try with hb_mbtowc (AnsiToWide)

Code: Select all


#include "FWCE.ch"
//----------------------------------------------------------------------------//
function Main()
   local oDlg, cText := "Hello world!   "
  local hReturn := "" 

  hReturn = TESTFUNKTION( "216.117.77.7" )

  msginfo(hReturn)
    
return nil

//----------------------------------------------------------------------------//

#pragma BEGINDUMP 

#include <windows.h> 
#include <hbapi.h> 

HB_FUNC( TESTFUNKTION )
{
   WCHAR * cTest = hb_mbtowc( hb_parc( 1 ) ) ;
   
   MessageBox ( 0, cTest , cTest, 0 );
   
   HB_TCHAR_FREE( cTest );

}

#pragma ENDDUMP

 
i didn't tested...
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Post Reply