Click here to Skip to main content
15,914,905 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionI want a file DLL write by VC++ used in VisualBasic ? Pin
Thangnc19-Aug-05 0:30
Thangnc19-Aug-05 0:30 
AnswerRe: I want a file DLL write by VC++ used in VisualBasic ? Pin
David Crow19-Aug-05 2:30
David Crow19-Aug-05 2:30 
GeneralRe: I want a file DLL write by VC++ used in VisualBasic ? Pin
Thangnc19-Aug-05 16:13
Thangnc19-Aug-05 16:13 
GeneralRe: I want a file DLL write by VC++ used in VisualBasic ? Pin
David Crow22-Aug-05 3:13
David Crow22-Aug-05 3:13 
QuestionHelp! CString convert to LPBYTE ? Pin
alias001818-Aug-05 22:28
alias001818-Aug-05 22:28 
AnswerRe: Help! CString convert to LPBYTE ? Pin
try8818-Aug-05 22:51
try8818-Aug-05 22:51 
AnswerRe: Help! CString convert to LPBYTE ? Pin
David Crow19-Aug-05 2:33
David Crow19-Aug-05 2:33 
AnswerRe: Help! CString convert to LPBYTE ? Pin
MailtoGops19-Aug-05 3:27
MailtoGops19-Aug-05 3:27 
Hi,

Do not use _tcscpy() function, because CString is a class, it doesn't mean it is allocating one extra byte for '\0' NULL character to say end of string.

And also avoid lengthly for loop while causes poor performance..

Use this method..
LPBYTE CString_To_LPBYTE(CString str)
{
LPBYTE lpb= NULL;
int nLength = str.GetLength();


if (nLength > 0)
{
// If you need space for NULL allocate one more. otherwise don't
lpb = new BYTE[(nLength + 1) * sizeof(TCHAR)];
memcpy(lpb,str.GetBuffer(0),(nLength) * sizeof(TCHAR));
lpb[nLength * sizeof(TCHAR)] = 0; // only if you need NULL at end
}
return lpb;
}

" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "

- Words from Nelson Mandela

Thanks & Regards,

Gopalakrishnan
GeneralRe: Help! CString convert to LPBYTE ? Pin
Gary R. Wheeler19-Aug-05 4:27
Gary R. Wheeler19-Aug-05 4:27 
GeneralRe: Help! CString convert to LPBYTE ? Pin
alias001819-Aug-05 19:33
alias001819-Aug-05 19:33 
Generalusing TRACE(); Pin
cpprules18-Aug-05 21:50
cpprules18-Aug-05 21:50 
GeneralRe: using TRACE(); Pin
S. Senthil Kumar18-Aug-05 23:14
S. Senthil Kumar18-Aug-05 23:14 
GeneralRe: using TRACE(); Pin
David Crow19-Aug-05 2:40
David Crow19-Aug-05 2:40 
Generalhelp dangley pointers -CStringList Pin
joe blo18-Aug-05 21:42
joe blo18-Aug-05 21:42 
GeneralRe: help dangley pointers -CStringList Pin
S. Senthil Kumar18-Aug-05 23:39
S. Senthil Kumar18-Aug-05 23:39 
GeneralRe: help dangley pointers -CStringList Pin
Anonymous19-Aug-05 8:20
Anonymous19-Aug-05 8:20 
GeneralRe: help dangley pointers -CStringList Pin
David Crow19-Aug-05 2:45
David Crow19-Aug-05 2:45 
GeneralBitmap Pixel scaling Pin
Pazzuzu18-Aug-05 21:28
Pazzuzu18-Aug-05 21:28 
GeneralRe: Bitmap Pixel scaling Pin
Jörgen Sigvardsson19-Aug-05 0:52
Jörgen Sigvardsson19-Aug-05 0:52 
GeneralWhitout Unicode Pin
Ali Tavakol18-Aug-05 21:06
Ali Tavakol18-Aug-05 21:06 
GeneralRe: Whitout Unicode Pin
MailtoGops19-Aug-05 4:44
MailtoGops19-Aug-05 4:44 
GeneralAbout CRebarCtrl Pin
yitang18-Aug-05 21:02
yitang18-Aug-05 21:02 
GeneralFiles Copied in Clipboard Pin
MohammadAmiry18-Aug-05 20:55
MohammadAmiry18-Aug-05 20:55 
GeneralRe: Files Copied in Clipboard Pin
s2111979219-Aug-05 0:44
s2111979219-Aug-05 0:44 
GeneralTAB CONTROL Pin
Member 214683918-Aug-05 20:52
Member 214683918-Aug-05 20:52 

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.