Click here to Skip to main content
15,896,118 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Open File with default program Pin
RicoH12-May-06 4:48
RicoH12-May-06 4:48 
GeneralRe: Open File with default program Pin
marcogja12-May-06 10:50
marcogja12-May-06 10:50 
Questionactivex controls Pin
troythetech11-May-06 12:21
troythetech11-May-06 12:21 
QuestionProblem with grayscale palette Pin
Jim Crafton11-May-06 11:46
Jim Crafton11-May-06 11:46 
AnswerRe: Problem with grayscale palette - SOLVED! Pin
Jim Crafton11-May-06 13:29
Jim Crafton11-May-06 13:29 
QuestionHow To Convert UNICODE to Base64 Pin
benm9999999911-May-06 8:37
benm9999999911-May-06 8:37 
AnswerRe: How To Convert UNICODE to Base64 Pin
led mike11-May-06 10:14
led mike11-May-06 10:14 
GeneralRe: How To Convert UNICODE to Base64 Pin
benm9999999912-May-06 3:31
benm9999999912-May-06 3:31 
Are you compiling this in a Multibyte project ? then it works.... but if I try to compile it in a UNICODE project, I get this error:

error C2440: 'initializing' : cannot convert from 'CString' to 'LPCSTR'

on the line where you set LPCSTR inPtr = s;

since s, the CString, is LPCTSTR.

I ended up using something like this, which converts the unicode to LPSTR first, but not sure if it's the best... (also on my Decode function, I needed to convert the decoded string from MultiByte back to WCHAR to get it to match the original:

//since we're unicode, first let's convert to UTF-8
int iRes = WideCharToMultiByte(CP_UTF8, NULL, csSource, csSource.GetLength()*sizeof(TCHAR), NULL, 0, NULL, NULL);
LPSTR szMultiByte = new CHAR[iRes];
iRes = WideCharToMultiByte(CP_UTF8, NULL, csSource, csSource.GetLength()*sizeof(TCHAR), szMultiByte, iRes, NULL, NULL);

//convert to b64
int iDestLen = Base64EncodeGetRequiredLength(iRes);
LPSTR szDest = new CHAR[iDestLen];
Base64Encode((BYTE*)szMultiByte, iRes, szDest, &iDestLen, NULL);
CString csDest(szDest);

delete szMultiByte;
delete szDest;

return csDest;

GeneralRe: How To Convert UNICODE to Base64 Pin
led mike12-May-06 5:55
led mike12-May-06 5:55 
GeneralRe: How To Convert UNICODE to Base64 Pin
benm9999999915-May-06 7:37
benm9999999915-May-06 7:37 
Question[Message Deleted] Pin
Sachin .S .Potdar11-May-06 8:25
Sachin .S .Potdar11-May-06 8:25 
AnswerRe: RC4 implemantation in VC++ Pin
Chris Losinger11-May-06 8:44
professionalChris Losinger11-May-06 8:44 
AnswerRe: RC4 implemantation in VC++ Pin
ThatsAlok12-May-06 2:03
ThatsAlok12-May-06 2:03 
Questionmsflexgrid Pin
abdoush11-May-06 7:32
abdoush11-May-06 7:32 
QuestionGetting notification of a button being held down Pin
DRHuff11-May-06 7:23
DRHuff11-May-06 7:23 
AnswerRe: Getting notification of a button being held down Pin
Maxwell Chen11-May-06 7:46
Maxwell Chen11-May-06 7:46 
Questionwindow capture Pin
hariramesh11-May-06 5:04
hariramesh11-May-06 5:04 
AnswerRe: window capture Pin
Andy Moore11-May-06 8:33
Andy Moore11-May-06 8:33 
Questionvisual c++ change button code Pin
xcar11-May-06 4:58
xcar11-May-06 4:58 
AnswerRe: visual c++ change button code Pin
toxcct11-May-06 5:00
toxcct11-May-06 5:00 
GeneralRe: visual c++ change button code Pin
Hamid_RT11-May-06 5:11
Hamid_RT11-May-06 5:11 
GeneralRe: visual c++ change button code Pin
toxcct11-May-06 5:14
toxcct11-May-06 5:14 
GeneralRe: visual c++ change button code Pin
Hamid_RT11-May-06 5:36
Hamid_RT11-May-06 5:36 
AnswerRe: visual c++ change button code Pin
Cedric Moonen11-May-06 5:00
Cedric Moonen11-May-06 5:00 
GeneralRe: visual c++ change button code Pin
toxcct11-May-06 22:56
toxcct11-May-06 22:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.