Problem converting a CComBSTR to LPCTSTR with CW2CT
-
I have a problem converting a CComBSTR to LPCTSTR with CW2CT. Eveything works fine until my CComBSTR gets around 64 caracters... then the result of the convertion is a long "corrupted" string: "îþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþ" Please help me ! :(( ----- See comments between /* */ for more info ----- LRESULT CListBoxDlg::OnBnClickedBtngetselitems(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { LPCTSTR sTitle; // Message box title int arrSelList[12]; // Message buffer TCHAR pszBuf[128] = "";// Message buffer int iMaxNum = 12; // Max number of selected items LRESULT iSelCount = 0; // Total selected items in the list LPCTSTR sMsg = 0; // Message to put in the message box CComBSTR bsMessage; // Message accumulator iSelCount = this->SendDlgItemMessage(IDC_AVSCODES, LB_GETSELITEMS, WPARAM(iMaxNum), LPARAM(arrSelList)); if (iSelCount != LB_ERR) { bsMessage.Append("You have selected the fields: "); _stprintf(pszBuf, "%li", arrSelList[0]); bsMessage.Append(pszBuf); for (int i = 1; i < iSelCount; i++) { bsMessage.Append(", "); _stprintf(pszBuf, "%li", arrSelList[i]); bsMessage.Append(pszBuf); } bsMessage.Append("."); /* The following line will fails if bsMessage.m_str contains: "You have selected the fields: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11." But will not fail if it bsMessage.m_str contains: "You have selected the fields: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10." (4 caracter less) but long size is not suppose the cause problems with ATL 7.0 c
-
oops sorry, I kinda didn't notice I was in the wrong forum :) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= JiCi - http://www.grandmenhir.com/
-
That was a bit harse. Don't want to offend anyone. :)
-
That was a bit harse. Don't want to offend anyone. :)
-
Your english is fine, my humor is not:((
-
Your english is fine, my humor is not:((
-
That was a bit harse. Don't want to offend anyone. :)
-
That was a bit harse. Don't want to offend anyone. :)
Mark, No offense intended or anything, but are you naturally a prick or do you make a concious effort? ;P Can you imagine Darth Maul on speed?
-
Mark, No offense intended or anything, but are you naturally a prick or do you make a concious effort? ;P Can you imagine Darth Maul on speed?
No I've developed a thick foreskin.
-
not fine. Most of the time I cannot get the correct tone. Like when watching TV, cannot laugh when a joke was told. :-(
Try listening to a talk radio station. My wife, who came from Shanghai in her 20's, claims that listening to talk radio is the best way to really learn english, since it includes all of the slang. Of course being married to an Americian whose command of Chinese is limited to Ni Hou. also helps. :)
-
not fine. Most of the time I cannot get the correct tone. Like when watching TV, cannot laugh when a joke was told. :-(
...Most of the time I cannot get the correct tone. Like when watching TV, cannot laugh when a joke was told. Don't worry Lucy, if the comedy on TV up there in Canada is as bad here in the USA then the problem is the jokes ... not your sense of humor :) Steve T.
-
not fine. Most of the time I cannot get the correct tone. Like when watching TV, cannot laugh when a joke was told. :-(
lucy wrote: Like when watching TV, cannot laugh when a joke was told. Many people have this problem, as it can take months for the casual viewer to memorize all the jokes on TV, and many are easy to forget. That's what laugh tracks are for. ;) --------
You can change the extention so it reads ASP even though it is PHP which is kind of cool. - Martin Marvinski
--Shog9 --
-
lucy wrote: Like when watching TV, cannot laugh when a joke was told. Many people have this problem, as it can take months for the casual viewer to memorize all the jokes on TV, and many are easy to forget. That's what laugh tracks are for. ;) --------
You can change the extention so it reads ASP even though it is PHP which is kind of cool. - Martin Marvinski
--Shog9 --
I don't know why they don't put up a laugh placard like they do for audiences on Shows like the "Letterman Show" that way people at home could join in. Regardz Colin J Davies
Sonork ID 100.9197:Colin
More about me :-)