FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Pocket PC How to define a parameter
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
How to define a parameter
Posted: Sun Jan 02, 2011 10:08 PM
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 (fw): Select all Collapse
#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
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: How to define a parameter
Posted: Mon Jan 03, 2011 01:57 AM
Hello Mr. Otto

you need convert to wide

with Harbour try with hb_mbtowc (AnsiToWide)

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

Continue the discussion