Click here to Skip to main content
15,913,854 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: List of lists Pin
17-May-01 18:41
suss17-May-01 18:41 
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 
I wrote an OCX (that dynamically links MFC) using VC6. I wrote a test app that exercises the OCX in VC6, and the OCX appears to work fine.

I then wrote a test app in VB6, and this is where my sad story begins.

The OCX has some string properties, and these properties have Get/Set functions associated with them. If you're at all familiar with VB, you know that while you're running your app (from the VC6 IDE), you can hover your mouse over an OCX property name and a toolitip will popup giving you the value/contents of that property. For all but one property, this works fine, but when I try to hover the mouse over one of them (happens to be a string that holds an IP address), it *crashes the VB IDE*. After a little experimenting, I found that if I deleted the periods from the IP address in the string (did this in the OCX itself in the Get() function), it worked fine.

In the OCX, my Get/Set functions look like this:

CString m_sXXXProperty;

//---------------------------------------------------------//
VARIANT CMyOcxCtrl::GetXXXProperty() 
{
	_variant_t vaResult;
	vaResult = (const char*)m_sXXXProperty;
	return vaResult;
}

//---------------------------------------------------------//
void CMyOcxCtrl::SetXXXProperty(const VARIANT FAR& newValue) 
{
	_variant_t vTemp(newValue);
	m_sXXXProperty = vTemp.bstrVal;
	SetModifiedFlag();
} 


First, I need to knbow if I'm doing anything wrong in the code above. Second, I need to know why in hell the dots in the IP address would cause a crash in VB.

In the VB test app, I cycle through a counter (also retrieved from the OCX) to retrieve other strings (using the same mechanism described above), but these strings are not properties. After I have called a retrieval function, the string in the VB app contains the expected text. However, when IO put that string into a listbox, all I get is the first character shown in the listbox.

I don't know much about VB, and really prefer not to know any more than I need to get this test app working as expected. I strongly suspect that my problem lies in the OCX functions that return the strings.

Keep in mind that this OCX works *fine* from the VC6 test application.

Any help would be appreciated.
GeneralRe: VB app using VC++ OCX Pin
Dark Angel17-May-01 10:27
Dark Angel17-May-01 10:27 
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 

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.