Click here to Skip to main content
15,917,565 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionTab Controls Pin
BuckBrown31-Jan-06 11:23
BuckBrown31-Jan-06 11:23 
AnswerRe: Tab Controls Pin
Stephen Hewitt31-Jan-06 11:47
Stephen Hewitt31-Jan-06 11:47 
GeneralRe: Tab Controls Pin
_anil_31-Jan-06 17:28
_anil_31-Jan-06 17:28 
GeneralRe: Tab Controls Pin
Stephen Hewitt31-Jan-06 17:30
Stephen Hewitt31-Jan-06 17:30 
GeneralRe: Tab Controls Pin
_anil_31-Jan-06 18:41
_anil_31-Jan-06 18:41 
GeneralRe: Tab Controls Pin
Stephen Hewitt31-Jan-06 18:44
Stephen Hewitt31-Jan-06 18:44 
AnswerRe: Tab Controls Pin
Owner drawn31-Jan-06 17:29
Owner drawn31-Jan-06 17:29 
QuestionProblems with VariantChangeType and VT_BOOL in CE Pin
Paul M Watt31-Jan-06 10:55
mentorPaul M Watt31-Jan-06 10:55 
Hi All,

I have discovered that when I convert a BSTR to both VT_I4 or VT_BOOL format
with VariantChangeType, a second thread appears in my application, and in
most cases simply sits in the background suspended. If I try to context
switch to that thread through the debugger and watch where it goes, my
connection to the debugger is lost and I must warmboot my device.

If I use VariantChangeType to convert from a long to a BSTR, this errent
thread does not appear.

One final note, when the program shuts down with this errent thread, an
exception is thrown, invalid access, probably because of that other thread.

Has anyone run into this, or is there any information on what is going on,
or how a developer is supposed to work around this?

Here is the code for this program to test this problem.

Thanks

-----------------------------------------------

#include <windows.h>

//C: Link in the library that contains the Variant functions.
#pragma comment(linker, "/defaultlib:oleaut32.lib")

int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
//C: Initialize the variant object.
VARIANT v;
::VariantInit(&v);

//C: Test the different conversions independantly.
#ifdef BSTR_TEST
v.vt = VT_I4;
v.lVal = -1;

::VariantChangeType(&v, &v, 0, VT_BSTR);

BSTR bstr = v.bstrVal;
//C: No extra thread, PASSES.
#elif defined(LONG_TEST)
v.vt = VT_BSTR;
v.bstrVal = ::SysAllocString(L"-1");

::VariantChangeType(&v, &v, 0, VT_I4);

long l = v.lVal;
//C: At this point a second thread will have been created. FAILS
#else
v.vt = VT_BSTR;
v.bstrVal = ::SysAllocString(L"-1");

::VariantChangeType(&v, &v, 0, VT_BOOL);

VARIANT_BOOL b = v.boolVal;
//C: At this point a second thread will have been created. FAILS
#endif
//C: Free resources.
::VariantClear(&v);
return 0;
}

//C: If the second thread is created, when the program exits, an exception
is thrown.






Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life!

Questiondevice manager refresh Pin
Manu_8131-Jan-06 9:36
Manu_8131-Jan-06 9:36 
AnswerRe: device manager refresh Pin
Blake Miller31-Jan-06 10:29
Blake Miller31-Jan-06 10:29 
GeneralRe: device manager refresh Pin
Manu_8131-Jan-06 11:45
Manu_8131-Jan-06 11:45 
GeneralRe: device manager refresh Pin
Ryan Binns31-Jan-06 17:28
Ryan Binns31-Jan-06 17:28 
QuestionTrying to expand a tree... Pin
KellyR31-Jan-06 9:06
KellyR31-Jan-06 9:06 
AnswerRe: Trying to expand a tree... Pin
Stephen Hewitt31-Jan-06 11:53
Stephen Hewitt31-Jan-06 11:53 
GeneralRe: Trying to expand a tree... Pin
KellyR2-Feb-06 4:12
KellyR2-Feb-06 4:12 
QuestionIs there a specific size for a 2 dimentional array Pin
Deema Jack31-Jan-06 8:18
Deema Jack31-Jan-06 8:18 
AnswerRe: Is there a specific size for a 2 dimentional array Pin
Dethulus31-Jan-06 8:31
Dethulus31-Jan-06 8:31 
QuestionSelecting an item by Keystrokes Pin
Kurt _B31-Jan-06 8:11
Kurt _B31-Jan-06 8:11 
AnswerRe: Selecting an item by Keystrokes Pin
Owner drawn31-Jan-06 22:47
Owner drawn31-Jan-06 22:47 
GeneralRe: Selecting an item by Keystrokes Pin
Kurt _B1-Feb-06 2:15
Kurt _B1-Feb-06 2:15 
QuestionHow to gray out a control Pin
Robert Palma Jr.31-Jan-06 6:26
Robert Palma Jr.31-Jan-06 6:26 
AnswerRe: How to gray out a control Pin
Rob Caldecott31-Jan-06 6:38
Rob Caldecott31-Jan-06 6:38 
GeneralRe: How to gray out a control Pin
Robert Palma Jr.31-Jan-06 8:52
Robert Palma Jr.31-Jan-06 8:52 
AnswerRe: How to gray out a control Pin
_anil_31-Jan-06 17:23
_anil_31-Jan-06 17:23 
GeneralRe: How to gray out a control Pin
toxcct31-Jan-06 21:31
toxcct31-Jan-06 21:31 

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.