Page 5 of 15
Re: HMG 3.1.4 (Test)
Posted: Thu Jun 20, 2013 3:12 pm
by srvet_claudio
Pablo, recent I understand your question.
I said:
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.
because in the changelog.txt says CueBanner only works in Unicode.
HMG 3.1.4 (Test)
Posted: Thu Jun 20, 2013 3:25 pm
by Pablo César
There is something wrong comparing Rathi example with Carlos one. I have dried Rathis codes. I have changed includes and defines original positions and I cut off following lines:
Code: Select all
#include "hbapi.h"
#include <tchar.h>
#include <wingdi.h>
and
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))
See dried source code:
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
With this code is coming japonese characters... what I have done wrong ? (see my example there both samples: Rathi + Carlos ones).
I have ordered before includes then declares constants and seems stop working (see below source cod). Probably this happing due a duplicity of var declarations. By on the other hand, in same code, Carlos example works properly in WIN7 even with includes before declares...
Anyway, both of examples is not working in XP.

Re: HMG 3.1.4 (Test)
Posted: Thu Jun 20, 2013 4:00 pm
by Carlos Britos
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.
Re: HMG 3.1.4 (Test)
Posted: Thu Jun 20, 2013 4:02 pm
by srvet_claudio
Pablo César wrote:
#pragma BEGINDUMP
#include <HMG_UNICODE.h>
#include <windows.h>
#include <commctrl.h>
#define COMPILE_HMG_UNICODE
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>
...
Re: HMG 3.1.4 (Test)
Posted: Thu Jun 20, 2013 4:03 pm
by srvet_claudio
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.
Gracias Carlos.
Re: HMG 3.1.4 (Test)
Posted: Thu Jun 20, 2013 4:12 pm
by Pablo César
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>
...
Thank you Claudio, this is the right way, very much appreciated and important instruction. Now is working for WIN7 but still not in WinXP.
HMG 3.1.4 (Test)
Posted: Thu Jun 20, 2013 4:22 pm
by Pablo César
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.
Yes Carlos, but the good thing is working for HMG UNICODE and ANSI too. Of course is not working for WinXP.
I liked more Rathi example, because it is only dissapear the cue text by using keyboard when we start typing. But in Carlos example when we get in focus of TextBox its dissapear. By the other hand seems Carlos example works with rest of others components, which it will be useful. I think we can keep both as example for next release.
The bad thing, both examples are not working in XP...

Re: HMG 3.1.4 (Test)
Posted: Thu Jun 20, 2013 4:27 pm
by Rathinagiri
Hi Pablo,
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) );
CueBanner is supported in XP as declared in MSDN here.
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Re: HMG 3.1.4 (Test)
Posted: Thu Jun 20, 2013 4:29 pm
by Rathinagiri
And as the MSDN suggests,
"Note To use this API, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see Enabling Visual Styles."
We have a manifest file in HMG Resource path. But how to enable!?
HMG 3.1.4 (Test)
Posted: Thu Jun 20, 2013 4:41 pm
by Pablo César
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) );
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.