I said:
because in the changelog.txt says CueBanner only works in Unicode.srvet_claudio wrote:SETCUEBANNER of the HMG.3.1.4, works also in ANSI because this portion of the code is forced to compile always in Unicode.
Moderator: Rathinagiri
because in the changelog.txt says CueBanner only works in Unicode.srvet_claudio wrote:SETCUEBANNER of the HMG.3.1.4, works also in ANSI because this portion of the code is forced to compile always in Unicode.
Code: Select all
#include "hbapi.h"
#include <tchar.h>
#include <wingdi.h>
Code: Select all
#define Edit_SetCueBannerText(hwnd, lpcwText) \
(BOOL)SNDMSG((hwnd), EM_SETCUEBANNER, 0, (LPARAM)(lpcwText))
#define EM_GETCUEBANNER (ECM_FIRST + 2) // Set the cue banner with the lParm = LPCWSTR
#define Edit_GetCueBannerText(hwnd, lpwText, cchText) \
(BOOL)SNDMSG((hwnd), EM_GETCUEBANNER, (WPARAM)(lpwText), (LPARAM)(cchText))
Code: Select all
#include <hmg.ch>
Function Main
Define window Form_1 at 0, 0 width 400 height 300 main
Define TextBox name
Row 10
Col 10
Width 200
End Textbox
Define TextBox address
Row 40
Col 10
Width 200
End Textbox
End window
SetTextBoxCueBanner("Form_1","name","Enter your name here")
SetTextBoxCueBanner("Form_1","address","Enter address here")
Form_1.center
Form_1.activate
Return Nil
Function SetTextBoxCueBanner(cParent,cControl,cText)
Local nHandle := GetControlHandle(cControl,cParent)
// _SetTextBoxCueBanner(nHandle,cText)
Setcuebanner(nHandle,cText)
Return Nil
#pragma BEGINDUMP
#include <HMG_UNICODE.h>
#include <windows.h>
#include <commctrl.h>
#define COMPILE_HMG_UNICODE
// #define _WIN32_IE 0x0500
// #define _WIN32_WINNT 0x0501
#define ECM_FIRST 0x1500 // Edit control messages
#define EM_SETCUEBANNER (ECM_FIRST + 1) // Set the cue banner with the lParm = LPCWSTR
HB_FUNC ( _SETTEXTBOXCUEBANNER )
{
HWND hWnd1;
hWnd1 = (HWND) hb_parnl (1);
SendMessage((HWND) hWnd1,EM_SETCUEBANNER, (WPARAM)(int) 1,(LPARAM) HMG_parc(2) );
}
HB_FUNC( SETCUEBANNER ) // ( editHandle, cMsg ) -> nil
{
#ifdef UNICODE
LPWSTR lpWCStr = HMG_parc(2) ;
#else
LPWSTR lpWCStr = (LPCWSTR) ( hb_parc(2) == NULL ) ? NULL : hb_mbtowc( (const char *) hb_parc(2) ) ;
#endif
SendMessage( (HWND) hb_parnl(1), EM_SETCUEBANNER, (WPARAM) 0, (LPARAM) (LPCWSTR) lpWCStr ) ;
SysFreeString( lpWCStr );
}
#pragma ENDDUMP
Pablo César wrote:
Carlos, what do you mean about #ifdef IGH_UNICODE (here in red is it something wrong ?)
Pablo, change:
Code:
#ifdef IGH_UNICODE
for:
Code:
#ifdef UNICODE
Pablo, this always should be:Pablo César wrote: #pragma BEGINDUMP
#include <HMG_UNICODE.h>
#include <windows.h>
#include <commctrl.h>
#define COMPILE_HMG_UNICODE
Code: Select all
#pragma BEGINDUMP <---- first line
#define COMPILE_HMG_UNICODE <---- second line
#include "HMG_UNICODE.h" <---- third line
...
#include <windows.h>
...
Gracias Carlos.Carlos Britos wrote:Pablo César wrote:
Carlos, what do you mean about #ifdef IGH_UNICODE (here in red is it something wrong ?)
Pablo, change:
Code:
#ifdef IGH_UNICODE
for:
Code:
#ifdef UNICODE
Hi this is because is not a HMG code, I´ve extracted from another code, and I forget to remove it.
Hola Claudio
Es porque no es un codigo HMG y olvidé borrarlo. Es parte de un codigo que tengo hecho.
Thank you Claudio, this is the right way, very much appreciated and important instruction. Now is working for WIN7 but still not in WinXP.srvet_claudio wrote:Pablo, this always should be:Code: Select all
#pragma BEGINDUMP <---- first line #define COMPILE_HMG_UNICODE <---- second line #include "HMG_UNICODE.h" <---- third line ... #include <windows.h> ...
Yes Carlos, but the good thing is working for HMG UNICODE and ANSI too. Of course is not working for WinXP.Carlos Britos wrote:Hi this is because is not a HMG code, I´ve extracted from another code, and I forget to remove it.
Hola Claudio
Es porque no es un codigo HMG y olvidé borrarlo. Es parte de un codigo que tengo hecho.
Ohhh thank you Rathi, I had not seen that differance in parameter. This we could let it optional for users. So I will teste for other components and revert.Rathinagiri wrote:The behaviour is optional. You have to change WPARAM to 0 or 1 to change the behaviour of your choice.
SendMessage((HWND) hWnd1,EM_SETCUEBANNER, (WPARAM)(int) 1,(LPARAM) HMG_parc(2) );
or
SendMessage((HWND) hWnd1,EM_SETCUEBANNER, (WPARAM)(int) 0,(LPARAM) HMG_parc(2) );