Article View: borland.public.cppbuilder.nativeapi
Article #2133Re: Storing UNICODE in mixed string resource
From: JF Jolin
Date: Tue, 10 Apr 2007 15:35
Date: Tue, 10 Apr 2007 15:35
64 lines
2405 bytes
2405 bytes
In addition to what poojo have said
Here are some precisions with UNICODE vs MBCS
http://www.codeproject.com/cpp/unicode.asp
10 Apr 2007 06:07:59 -0400, Mike Collins <its@TheBottomOfThePost> wrote:
> My first question is, how can i store these string in my string resource?
; String table
STRINGTABLE
BEGIN
#ifdef _UNICODE
IDS_FOLDER L"C:\\WINDOWS" // UNICODE string
#else
IDS_FOLDER "C:\\WINDOWS" // MBCS string
#endif
END
> My second question is, how do i modify the above call-back so that it can
> work with either UNI or ANSI without having to compile separate versions -
> I'm trying to make something generic that will work seamlessly on both
> platforms.
>
#include <tchar.h>
BOOL CALLBACK Main::EnumWinProc(HWND hWnd, long lParam)
{
TCHAR cCaption[255], cClassID[255];
GetWindowText(hWnd, cCaption, sizeof(&cCaption)/sizeof(TCHAR));
GetClassName(hWnd, cClassID, sizeof(&cClassID)/sizeof(TCHAR));
AnsiString sStoredCaption;
// Load caption from string table resource based on system local
if ((_tcscmp(cClassID, TEXT("#32770"))==0)
&&(_tcscmp(cCaption, sStoredCaption.c_str())==0))
{
PostMessage(hWnd, WM_CLOSE, 0, 0);
return FALSE;
}
else
return TRUE;
}
For compilation with UNICODE
Use the compiler switch -tWU
or make use of #define _UNICODE
Good day
__
JF Jolin
Technical Details
Message-ID:
<op.tqkqxxjnjr09w3@localhost>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<461b4e2f@newsgroups.borland.com> <461b931c@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,4f9f4ee974b60660 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Tue, 10 Apr 2007 11:35:47 -0400 Subject: Re: Storing UNICODE in mixed string resource From: "JF Jolin" <jfj@nospam.com> Content-Type: text/plain; charset=iso-8859-15 MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi References: <461b4e2f@newsgroups.borland.com> <461b931c@newsgroups.borland.com> Content-Transfer-Encoding: Quoted-Printable Message-ID: <op.tqkqxxjnjr09w3@localhost> User-Agent: Opera Mail/9.02 (Win32) NNTP-Posting-Host: 66.36.145.120 X-Trace: newsgroups.borland.com 1176219324 66.36.145.120 (10 Apr 2007 08:35:24 -0800) Lines: 64 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail