|
you can place the control in a separate dialog box.
then put the dialog box as a whole on the tab pane.
|
|
|
|
|
Didn't I say that? ("or perhaps a modeless dialog").
Steve
|
|
|
|
|
Sorry for being misplaced the reply,
actually I should reply to the questions but by mistake I did it to you.
Sorry.
|
|
|
|
|
|
|
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!
|
|
|
|
|
Hi,
I am trying to the device manager refresh in win32.
How to do that. Thanks.
|
|
|
|
|
WM_DEVICECHANGE
The WM_DEVICECHANGE device message notifies an application of a change to the hardware configuration of a device or the computer.
A window receives this message through its WindowProc function.
HTH
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
But that's not I want. I am not plugging in any devices to watch for WM_DEVICECHANGE message. I just want to force a device manager refresh ( just as we do manually in the control panel-device manager-scan for hardware changes but programatically)
-- modified at 17:46 Tuesday 31st January, 2006
|
|
|
|
|
Yeah, so send it a WM_DEVICECHANGE message - it will catch it and think something has changed, so will refresh.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi!
Here's what I have:
HWND window = GetDlgItem(hDlg, IDC_TREE);
TVINSERTSTRUCT tvInsert;
tvInsert.item.mask = TVIF_TEXT;
tvInsert.item.pszText = _T("Parent");
HTREEITEM hTreeItem = (HTREEITEM)SendMessage(window,TVM_INSERTITEM,0,(LPARAM) (LPTVINSERTSTRUCT) &tvInsert);
SendMessage(window,TVM_INSERTITEM,0,(LPARAM) (LPTVINSERTSTRUCT) &tvInsert);
tvInsert.hParent = hTreeItem;
tvInsert.item.pszText = _T("Child");
SendMessage(window,TVM_INSERTITEM,0,(LPARAM) (LPTVINSERTSTRUCT) &tvInsert);
SendMessage(window,TVM_EXPAND, (WPARAM)(UINT)TVE_EXPAND,(LPARAM) (HTREEITEM) &hTreeItem);
BUuuuut.. the tree doesn't expand for some reason. I've tried collapsing it first then expanding, same thing, it just won't expand.
Kelly Ryan
|
|
|
|
|
KellyR wrote: SendMessage(window,TVM_EXPAND, (WPARAM)(UINT)TVE_EXPAND,(LPARAM) (HTREEITEM) &hTreeItem);
This line is wrong, it should read:
SendMessage(window, TVM_EXPAND, TVE_EXPAND, reinterpret_cast<LPARAM>(hTreeItem));
In particular you have a "&hTreeItem" where you should have just a "hTreeItem". I couldn't resist removing the old style C casts and replacing them with function style casts (which IMHO should be used in practically all new C++ code).
Steve
|
|
|
|
|
Great, that worked, thanks a lot.
Kelly Ryan
|
|
|
|
|
Is there a specific size for the elements in a 2 dimentional array .
I mean can I use an array with this matrix [100][5] or No .
|
|
|
|
|
If I understand your question correctly the answer is yes. All elements in any array are the same size. Accessing a 2 dimensional array as you described is simply a matter of indexing it properly. Assuming you've declared your array as:
int nArray[100][5];
You could assign x to any element in the array with any of the following methods:
<br />
int i, j, x;<br />
<br />
x = nArray[75][4];<br />
for(i=0; i<100; i++)<br />
{<br />
for(j=0; j<5; j++)<br />
{<br />
x = nArray[i][j];<br />
}<br />
}<br />
However, unlike in BASIC you can't access element nArray[100][5]. Array access is always zero relative.
Hope this helps...
-Dethulus
|
|
|
|
|
I have a list control and I want to add functionality to select an item by the key cobination entered similar to windows explorer & outlook. If anyone could point me in the right direction that would be great.
|
|
|
|
|
|
|
I need to gray-out an Edit Box, Pushbutton and Check Box.
I know how to show and hide it with ShowWindow()
GetDlgItem(IDC_BUTT_testupload)->ShowWindow(SW_HIDE);
but how do I gray it out so that it is inactive but
still gray-visible to the User?
VC++ 6.0
Many thanks,
Robert
|
|
|
|
|
GetDlgItem(ID)->EnableWindow(FALSE);
The Rob Blog Google Talk: robert.caldecott
|
|
|
|
|
Thanks Robert!
Hey, we have the same first and middle name
All the best,
Robert
|
|
|
|
|
|
when someone has already posted the right answer about 10 hours before your come to, please don't do that...
you don't provide anything more.
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
Thank-you Anil
|
|
|
|
|
LOL when I right click on one file in the Solution Explorer and hit "Compile", it compiles a different file! Then when I build that project, certain modules seem like they are missing... Sometimes it only compiles a single file when I hit Rebuild.
Anyone seen this behaviour?
I think I've found a way around it --- I create a new project and add all those files into it, but it's a real hassle. I imported these projects from VC6, so maybe that's the problem?
thanks,
swine
[b]yte your digital photos with [ae]phid [p]hotokeeper - www.aephid.com.
|
|
|
|