 |
|
 |
Contains both a CStringA and CStringW implementation of the CStringT class. Maybe at the time of this article this was not the case?
|
|
|
|
 |
|
 |
I too would love to know how to compile these files without errors. A new dialog project gave me 204 errors!
e.g:
..stringa.h(1816) : error C2804: binary 'operator ==' has too many parameters
What #includes are needed?
If it would compile, this is just what I'm looking for!
Any help anyone?
|
|
|
|
 |
|
 |
HI I want to use the CStringA class
I Include both the files StringA.h and StringW.h
but Compiler Gives 10 errors
So if any one Used it
then plz send me one example
|
|
|
|
 |
|
|
 |
|
 |
how can i convert my application UNICODE SUPPORTED application.
I used a lot CString variables and string manipulations... ,but now i want my application to be multi lingual support.
I tried by
#define CString CStringW
but i got lot of errors... what can do?
|
|
|
|
 |
|
 |
Try to set "Charset Set" in General page in project properties to "Use Unicode Character Set". When you set it in your app all CString will be UNICODE. If assign text to CString without _T() macro you must write it i.e.:
CString strText = _T("text");
-----------------------------------------------------------------
Surely without war there would be no loss
Hence no mourning, no grief, no pain, no misery
No sleepless nights missing the dead... Oh, no more
No more war
[Sleepless - Cradle of Filth]
|
|
|
|
 |
|
 |
Hi
I have two CString variables - one is ANSI and another UINCODE . I want to make both of them ANSI . So I declared CStringA temp= strUnicode;
CStringA temp1=strAnsi;
But the debugger shows "????" to temp . why ? How can I Copy them properly ?
Pls help me
redindian
|
|
|
|
 |
|
 |
THANK YOU KIND SIR... I was having nightmares at the thought of enabling _UNICODE in my app and and patch oh, say, 25,000 lines of code only to have UTF-8 support for small things like labels.
|
|
|
|
 |
|
 |
CStringW wString1(L"Test1");
CStringW wFormat;
wFormat.Format(L"%s",wString1);
MessageBoxW(this->m_hWnd,wFormat,L"CStringW Test",MB_OK);
Nice classes but Format is not working correctly.
In the sample code the ‘%s’ is displayed as ‘s’ the correct output wood be ‘Test1’
Ps: The function CStringW::Format uses FormatMessageW this function is not supported by Win9x systems without the Microsoft Layer for Unicode.
Quote:
Windows Me/98/95: FormatMessageW is supported by the Microsoft Layer for Unicode.
Something like this is maybe a solution it uses vswprintf an that is supported by Win9x.
// simple formatting
BOOL __cdecl Format(LPCWSTR lpszFormat, ...)
{
// format message into temporary buffer lpszTemp
va_list argList;
va_start(argList, lpszFormat);
BOOL bRet = TRUE;
int iBufLen = 0;
iBufLen = ((wcslen(lpszFormat)+2) * sizeof(wchar_t));
wchar_t *wpBuff = new wchar_t[iBufLen];
::ZeroMemory(wpBuff, iBufLen);
if(!vswprintf(wpBuff, lpszFormat, argList))
bRet = FALSE;
// assign wpBuff into the resulting string and delete the temporary
va_end(argList);
*this = wpBuff;
delete [iBufLen]wpBuff;
wpBuff = NULL;
return bRet;
}
|
|
|
|
 |
|
 |
I have a simple DLL ATL COM class with a dual interface.
I have an ATL COMTEST project with Ctestobj as simple ATL object embedded.
The testmethods can be called from JavaScript.
Now I seek for a way to register the Ctestobj into the ROT when sombody is
using the COM interface Ctestobj.
My first guess was RegisterActiveObject but this never worked.
A colleage said sth about CreateFileMoniker and then
HRESULT hr = GetRunningObjectTable(0, &pROT);
with pROT->Register();
But still no success.
class ATL_NO_VTABLE Ctestobj :
public CComObjectRootEx,
public CComCoClass,
public IDispatchImpl
{
private:
public:
Ctestobj()
{
dwRegister = 0;
LPRUNNINGOBJECTTABLE pROT=NULL;
//Creating an own item moniker, and register the contolling IUnknown with this Item Moniker
LPMONIKER p_moniker=NULL;
HRESULT hres =NULL;
hres = CreatePointerMoniker(this,p_moniker);
if (FAILED (hres))
{
AfxMessageBox(_T("Could not create moniker!"));
return;
}
HRESULT hr = GetRunningObjectTable(0, &pROT);
if (SUCCEEDED (hr) && (pROT != NULL))
{
//Register the Dispatchobject with the ItemMoniker(p_unk)
hr = pROT->Register(ROTFLAGS_REGISTRATIONKEEPSALIVE,this,p_moniker,&dwRegister);
if (FAILED (hr))
{
TRACE1("Register an object and its identifying moniker in the ROT failed with %d",hr);
AfxMessageBox(_T("Registration failed"));
}
(void) pROT->Release();
DECLARE_REGISTRY_RESOURCEID(IDR_TESTOBJ)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(Ctestobj)
COM_INTERFACE_ENTRY(Itestobj)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
// Itestobj
public:
STDMETHOD(testmeth)();
};
I dont know if I should pass the this pointer to the CreatePointerMoniker or
the m_pOuterUnkown. Is in an ATL simple object class after it was created
a valid IUnkown ptr ? Or is sth still missing ?
|
|
|
|
 |
|
 |
How is this useful ?
Why would you want to split Unicode and ANSI ?
|
|
|
|
 |
|
 |
It is very useful for Unicode applications. I was planning similar thing the other day myself. I wanted to code the internal data handling of the crystal editor update in Unicode. The classes use CString in many places making the task difficult.
Yes, I could define _UNICODE to compile the Unicode version of the classes, but that is not what I wanted. I wanted an application which can handle Unicode on Win9x. Therefore decided to handle all the internal characters as wchar_t. An the entry point, I will convert all to Unicode and that ends it. On exit convert back to the required code page. No need to have two applications, Unicode and ANSI (ASCII).
I hope you get one such application of these classes.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
 |
|
 |
I think there exists a unicode layer for win9x nowdays.
But i dont get either why you would want to split it up.
You must get a performance penalty running apps on W9x that
handles strings internally as wchar_t
/Magnus
|
|
|
|
 |
|
 |
Do you Mean UNICOWS.DLL ?
http://www.microsoft.com/downloads/release.asp?ReleaseID=30039
|
|
|
|
 |
|
 |
Yes thats the one
..with the fun name.
/Magnus
|
|
|
|
 |
|
 |
Hi Rashid,
you are right. I don't want to split it either.
But there are some funtions in the Windows API that behave different on ASCII and UNICODE, FindFirstFile is one of them.
Then as far as I know all network functions take and return only unicode strings. With the two classes you can get rid of these dependencies and keep the ability of compiling a unicode version.
Oskar
|
|
|
|
 |