Quote:Original post by stenny
ok. So we'll have to scrap that option. Wait...Can't I just create LPCWSTR's from scratch? Like:
const LPCWSTR g_szClass = "Classname";
- Stenny
const LPCWSTR g_szClass = L"Classname"; [smile]
Quote:Original post by stenny
ok. So we'll have to scrap that option. Wait...Can't I just create LPCWSTR's from scratch? Like:
const LPCWSTR g_szClass = "Classname";
- Stenny
Quote:Original post by stenny
ok. So we'll have to scrap that option. Wait...Can't I just create LPCWSTR's from scratch? Like:
const LPCWSTR g_szClass = "Classname";
- Stenny
Quote:EDIT: Nevermind, Emmanuel Deloget got it. I should actually refresh the page to see what new replies there are instead of just deciding no one will post before me :).
Quote:Original post by stenny
Thanks, but what if I don't declare it from start, like in AppError? I have the same problem here again. I'll try something out.
Quote:Original post by dhm
Hi,
Sounds like you need some string conversion functions. Have a look at http://msdn2.microsoft.com/en-US/library/ms235631.aspx for some inspiration.
Cheers,
dhm
// (Long) Pointer to a Constant Tchar STRingLPCTSTR myString = _T("teh string content");
#include <windows.h>#include <tchar.h>#include <string.h>// PWSTR is assumed to be already allocatedvoid tstr2wstr(PCTSTR tstr, PWSTR wstr){#ifdef UNICODE // really: unicode to unicode; we only need to copy the string wcscpy(wstr, tstr);#else // not in unicode: conversion needed mbstowcs(wstr, tstr, _tcslen(tstr)+1);#endif}// PTSTR is assumed to be already allocatedvoid wstr2tstr(PCWSTR wstr, PTSTR tstr){#ifdef UNICODE // really: unicode to unicode; we only need to copy the string wcscpy(tstr, wstr);#else // not in unicode: conversion needed wcstombs(tstr, wstr, wcslen(wstr)+1);#endif}// PSTR is assumed to be already allocatedvoid tstr2str(PCTSTR tstr, PSTR str){#ifdef UNICODE // in unicode: conversion needed mbstowcs(str, tstr, _tcslen(tstr)+1);#else // not in unicode, no conversion needed _tcscpy(str, tstr);#endif}// PWSTR is assumed to be already allocatedvoid str2tstr(PCSTR str, PTSTR tstr){#ifdef UNICODE // in unicode: conversion needed wcstombs(tstr, wstr, wcslen(wstr)+1);#else // not in unicode, copy the data _tcscpy(tstr, str);#endif}
Quote:Original post by EasilyConfused
... M Delagot's ...
Quote:Original post by stenny
what are the advantages and disadvantages of unicode or non-unicode then?
-Stenny
Quote:Original post by Emmanuel DelogetQuote:Original post by EasilyConfused
... M Delagot's ...
Oh My Gee you mispelled my n4m3!!!!!111one [grin]
BTW you can call me Emmanuel [smile]