Click here to Skip to main content
16,007,760 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionWhy doesn't CStatic keep the size of the icon when using SetIcon? Pin
16-May-01 19:16
suss16-May-01 19:16 
AnswerRe: Why doesn't CStatic keep the size of the icon when using SetIcon? Pin
Peter Godec17-May-01 12:17
Peter Godec17-May-01 12:17 
GeneralRe: Why doesn't CStatic keep the size of the icon when using SetIcon? Pin
18-May-01 0:30
suss18-May-01 0:30 
GeneralRe: Why doesn't CStatic keep the size of the icon when using SetIcon? Pin
Gast12821-Sep-10 4:18
Gast12821-Sep-10 4:18 
QuestionHow do I test CInternetSession::OpenURL() return val Pin
CMFC6.0VS.NETUser16-May-01 18:43
CMFC6.0VS.NETUser16-May-01 18:43 
GeneralTermination handler in MFC/ Pin
Brendan Tregear16-May-01 16:27
Brendan Tregear16-May-01 16:27 
GeneralVB app using VC++ OCX Pin
#realJSOP16-May-01 13:50
professional#realJSOP16-May-01 13:50 
GeneralRe: VB app using VC++ OCX Pin
Dark Angel17-May-01 10:27
Dark Angel17-May-01 10:27 
Disclaimer: I've never written a COM object with MFC.

I think that some of the problem might be that you are passing a CString back to VB. VB is probably looking for a BSTR. COM works with UNICODE, not ascii, so that may be the first problem: The result is getting turned into a bunch of non-ascii UNICODE characters. Since Unicode is looking for a 16-bit null character, VB is probably not finding one and is blowing up. I don't know why this would work in C++.

I don't know if MFC does any conversions or not...take a look at the _bstr_t data type and break out the USES_CONVERSION and associated macros (OLE2T etc).

If you are only seeing the first character, that is likely some sort of Unicode / ascii conversion problem. COM works with Unicode. If the Unicode is converted to ascii without "proper conversion", it will display the first character only because the ASCII character set occupies the unicode positions 0-255.

The string "ABC" in unicode would have the byte pattern "A\0B\0C\0"

hope this helps.

If you need to pass strings to a VB app, why not use the BSTR type in your C++ component? That will map to a VB String variable directly.



"Harland Pepper, would you stop naming nuts" - Harland Pepper
GeneralRe: VB app using VC++ OCX Pin
Carlos Antollini17-May-01 10:49
Carlos Antollini17-May-01 10:49 
GeneralRe: VB app using VC++ OCX Pin
#realJSOP17-May-01 10:53
professional#realJSOP17-May-01 10:53 
GeneralRe: VB app using VC++ OCX Pin
21-May-01 21:31
suss21-May-01 21:31 
GeneralReading disk directly under Win32 Pin
Wirawan Purwanto16-May-01 13:20
Wirawan Purwanto16-May-01 13:20 
GeneralRe: Reading disk directly under Win32 Pin
Tomasz Sowinski17-May-01 4:51
Tomasz Sowinski17-May-01 4:51 
QuestionDeleting strings from listboxes? Pin
16-May-01 12:40
suss16-May-01 12:40 
AnswerRe: Deleting strings from listboxes? Pin
Christian Graus16-May-01 12:55
protectorChristian Graus16-May-01 12:55 
GeneralRe: can anyone help with code... Pin
16-May-01 12:47
suss16-May-01 12:47 
GeneralRe: can anyone help with code... Pin
#realJSOP17-May-01 2:31
professional#realJSOP17-May-01 2:31 
GeneralRe: can anyone help with code... Pin
#realJSOP17-May-01 4:41
professional#realJSOP17-May-01 4:41 
GeneralRe: can anyone help with code... Pin
Jim A. Johnson17-May-01 5:59
Jim A. Johnson17-May-01 5:59 
GeneralA small hint for posting code in CP's forums Pin
PJ Arends17-May-01 5:22
professionalPJ Arends17-May-01 5:22 
Generalupdating text box in code Pin
16-May-01 10:38
suss16-May-01 10:38 
GeneralRe: updating text box in code Pin
Michael Dunn16-May-01 16:18
sitebuilderMichael Dunn16-May-01 16:18 
Generalupdating text box in code Pin
16-May-01 10:38
suss16-May-01 10:38 
GeneralRe: updating text box in code Pin
Chris Losinger16-May-01 10:43
professionalChris Losinger16-May-01 10:43 
GeneralRe: updating text box in code Pin
16-May-01 22:00
suss16-May-01 22:00 

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.