Tech Support > Microsoft Windows > Development Resources > unicode .. ?
unicode .. ?
Posted by GTi on January 15th, 2005


I have implemented a 3. party tool window control (located in a DLL) and
this control sends me data with the WM_NOTIFY
The problem is that this data include a text buffer that seems to be UNICODE
formatted.
I should NOT be that.
Is there any chance that it beleeve my application is Unicode and therfore
send me unicode strings?
And if so - how can I tell the 3. party tool that i am not UNICODE

And how can I transform a UNICODE string to a "normal" string?



Posted by Tim Robinson on January 15th, 2005


GTi wrote:
It depends on the control. What kind of control is it?

Use the Windows WideCharToMultiByte function, or the C runtime wcstombs
function.

--
Tim Robinson (MVP, Windows SDK)
http://mobius.sourceforge.net/

Posted by Matt Gregory on January 15th, 2005


GTi wrote:
You're not giving us enough information to answer this. It depends
on the third party tool and if it support ANSI text.

You can use WideCharToMultiByte(), just set the code page to CP_ACP
if you want ANSI text. Just note that you'll be taking text from a
set of 65535 characters and mapping them to a set with 255 characters,
so beware.

Matt Gregory

Posted by GTi on January 15th, 2005


The 3. part tool I use is QHTML (Simple and easy HTML control).
http://www.gipsysoft.com/qhtm/

They have a callback function for hyperlinks.
When a user press a hyperlink the control sends a WM_NOITIFY to
me and I can handle it my self of let the control handle it.

The lParam parameter struct:
typedef struct tagNMQHTM
{
NMHDR hdr;
LPCTSTR pcszLinkText;
LRESULT resReturnValue;
LPCTSTR pcszLinkID;
} NMQHTM, FAR *LPNMQHTM;


This is my code:
if(code==QHTMN_HYPERLINK)
{
//LPNMQHTM pnm = reinterpret_cast<LPNMQHTM>(lParam);
LPNMQHTM pnm = (LPNMQHTM)lParam;
pnm->resReturnValue = TRUE; // pass it as default
if(pnm->pcszLinkText)
{
if(StrStrI(pnm->pcszLinkText,"mailto:"))
{
pnm->resReturnValue = FALSE; // I hanlde it
MessageBox(NULL,pnm->pcszLinkText,pnm->pcszLinkText,0);
}
}
}
}




"GTi" <bill@gates.com> skrev i melding
news:vhdGd.1414$VR2.1127@amstwist00...



Similar Posts