Send xHarbour string through window message
Publicado: Vie May 23, 2008 2:06 pm
Dear developers!
Can you help me? I need to pass a xHarbour string from one Xailer
application to another through window message.
I send message with this code:
...
SendMessage(hAnotherAppWnd, WM_USER+55, 0, chr2ptr(cStr))
...
XA_FUNC( CHR2PTR )
{
hb_retnl( (long) hb_parc(1) );
}
I receive this message with this code:
METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TSample
if nMsg==WM_USER+55
::oStatusBar:aItems[1]:cText:=chr2ptr(nLParam)
::oStatusBar:aItems[2]:cText:=str(nWParam,3,0)+'%'
return 1
endif
return NIL
.....
XA_FUNC( CHR2PTR )
{
char far * buf;
buf = (char *) hb_parnl(1);
hb_retcAdopt( hb_strdup(buf ) );
}
The message is catched by HandleEvent but chr2ptr returns garbage.
Regards, Oleg
Can you help me? I need to pass a xHarbour string from one Xailer
application to another through window message.
I send message with this code:
...
SendMessage(hAnotherAppWnd, WM_USER+55, 0, chr2ptr(cStr))
...
XA_FUNC( CHR2PTR )
{
hb_retnl( (long) hb_parc(1) );
}
I receive this message with this code:
METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TSample
if nMsg==WM_USER+55
::oStatusBar:aItems[1]:cText:=chr2ptr(nLParam)
::oStatusBar:aItems[2]:cText:=str(nWParam,3,0)+'%'
return 1
endif
return NIL
.....
XA_FUNC( CHR2PTR )
{
char far * buf;
buf = (char *) hb_parnl(1);
hb_retcAdopt( hb_strdup(buf ) );
}
The message is catched by HandleEvent but chr2ptr returns garbage.
Regards, Oleg