|
It crashes because you do not assign memory to your second table.
Three possibilities:
for ( int j = 0 ; j< countloop ; j++)
{
arrPercent1.SetAtGrow(j, m_arrPercentage1.GetAt(j));
m_arrRank1.SetAt( j , 0);
}
or initialize the size before the loop:
arrPercent1.SetSize(m_arrPercentage1.GetSize());
for ...
Or, the best solution:
arrPercent1.Copy(m_arrPercentage1);
~RaGE();
|
|
|
|
|
Hi all,
I am new to VC++.I have developed an "exe" application in VC++.I need to execute some DOS
commands from this application but, the problem is whenever I run the code, it automatically creates a dos window because of the "system" command and covers my dialog window. Is there any funtion that can hide or minimize that DOS window?If so where do i place that part of the code??
Thanks
Sasha
|
|
|
|
|
Can you post the code you use to "execute some DOS commands" ?
If you use WinExec to fire up the commands, you can provide SW_HIDE as second parameter to hide the window. More elaborated would be to use the CreateProcess function.
Is your app a MFC app or a console app ?
~RaGE();
|
|
|
|
|
sashabkvs wrote: ...because of the "system" command...
Which is a very good reason to avoid using this antiquated function. It's just a holdover from the Unix environment. What exactly is it that you are trying to do?
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Hello!
I want to catch events on the usb, like "the user plugged in a hid"
I tried the WM_DEVICECHANGE, but this one helps only with USB-Sticks.
Is there a way to get this information?
Thank You
|
|
|
|
|
Set the GUID ( DEV_BROADCAST_DEVICEINTERFACE.dbcc_classguid ) to the class of devices that you want to monitor. That will take some digging on your part to discover the proper GUIDs
DEV_BROADCAST_DEVICEINTERFACE devBroadcastDeviceInterface;
ZeroMemory( &devBroadcastDeviceInterface, sizeof( devBroadcastDeviceInterface ));
devBroadcastDeviceInterface.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
devBroadcastDeviceInterface.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
devBroadcastDeviceInterface.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE;//GUID_DEVINTERFACE_HID
m_hDevNotify = RegisterDeviceNotification ( g_hWnd, &devBroadcastDeviceInterface, DEVICE_NOTIFY_WINDOW_HANDLE );
|
|
|
|
|
Good answer for the use case. I used
static /*const*/ GUID GUID_DEVINTERFACE_USB_DEVICE =
{ 0xA5DCBF10L, 0x6530, 0x11D2, { 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED } };
However if I wanted to detect a user inserting/removing a card from a usb card reader... any one? Currently i only know if the carder reader is plugged/unplugged... not if the card is inserted / removed
|
|
|
|
|
Hi all
i'm trying to retrieve primary keys by calling SQLPrimaryKeys function, but the problem is that Ms. Access doesn't support this function, Does anyone know how get the primary keys of a specific table for MS. Access using ODBC.
|
|
|
|
|
Use a CDaoTableDef object and its GetIndexInfo() method.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
I am using
typedef CArray<float, float=""> INT_PRICE2;
and using its object like
INT_PRICE2 m_arrPrice2;
I want the m_arrPrice2 be a two dimensional array.
How it can be?
and how to add , get and play with its elements?
Thanks.
Regards.
|
|
|
|
|
zahid_ash wrote: I want the m_arrPrice2 be a two dimensional array.
i'd go into int m_arrPrice2[][]; instead of using your CArray typedef which is not clear at all about what it is...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
sorry, mistake
it is
typedef CArray<float, float=""> INT_PRICE2;
and
INT_PRICEE2 m_arrPrice2;
Regards.
|
|
|
|
|
I dont know why it is not showing correcct text
it is
typedef CArray angularbracketopen float, float angularbracketclose INT_PRICE2;
I think it not showing becuase of angular brackets
Regards.
|
|
|
|
|
zahid_ash wrote: I dont know why it is not showing correcct text
Use the HTML markers < or >, or simply use the buttons on the bottom of the edit box to print < or > or check the box "Ignore HTML tags in this message (good for code snippets)".
so this is
typedef CArray < float, float > INT_PRICE2;
A CArray is a template element, not for two dimensional arrays.
So what you probably need is:
float INT_PRICE2[100][100];
or
float **INT_PRICE2;
~RaGE();
-- modified at 13:17 Thursday 9th February, 2006
|
|
|
|
|
Yes size is unknown.
So how I will set , get the values in it.
in float **INT_PRICE2;
thanks
Regards.
|
|
|
|
|
zahid_ash wrote: Yes size is unknown
Do you by chance get to know the size of the table at run time ? Then you could initialize the table using the new operator.
If the table keeps growing, you can either:
1. use malloc realloc to adapt the array size at runtime. (Not so good practice)
2. use STLs (a vector of vectors should do the trick).
~RaGE();
|
|
|
|
|
If you really need to use CArray , you could try something like:
typedef CArray<int, int> CIntArray;
typedef CArray<CIntArray*, CIntArray*> C2DIntArray;
C2DIntArray Int2D;
CIntArray *p = new CIntArray;
p->Add(2);
p->Add(8);
p->Add(7);
Int2D.Add(p);
p = new CIntArray;
p->Add(7);
p->Add(0);
p->Add(9);
Int2D.Add(p); This creates a 2x3 array.
----+---+----<br />
| 2 | 8 | 7 |<br />
----+---+----<br />
| 7 | 0 | 9 |<br />
----+---+----
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
What is the purpose of
typedef CArray CIntArray;
What is the difference with:
CArray C2DIntArray;
CArray *pIntArray;
C2DIntArray.Add(pIntArray);
~RaGE();
|
|
|
|
|
zahid_ash wrote: and using its object like
INT_PRICE2 m_arrPrice2;
What about STL::Vector
typedef vector<int> vecint;
typedef vector<vecint> INT_PRICE2;
so you don't have to worry about memory allocation and deallocation, as vector itself do for you!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi,
I wanted to know how do i get a checkbox in the 2nd or 3rd subitem of a Listview using Win32 APIs and without using Customdraw. please help...
thanks in advance....
regards
Neeraj
-- modified at 10:56 Thursday 9th February, 2006
|
|
|
|
|
After you all sorting out my problem with adding strings to a listbox, I now have a few more questions about them:
Is ther a limit to the amount of strings that can be added to a ListBox? My application will run indefinitly, so could end up having a huge amount of text entered into it - will this be a problem?
If it is, is there an easy way to limit the amount of strings, so that if you enter more into the ListBox, the first ones (oldest) will fall off the List?
Thansk for all your help
Mike
|
|
|
|
|
I think the limit is either 16000 or 32000 strings. I seem to remember seeing a virtual list box article on CP somewhere.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Thanks John
I just did an experiment with my app, and it hung once I had written 32736 lines into it!
In a normal day, I shouldnt be adding more than 100 lines of text a day to the ListBox, so that would mean i could run the app for approx 1 year before this would become an issue. Still, it would be nice to block the problem from happening...
Thanks again
Mike
|
|
|
|
|
as john suggested, use a virtual listbox ...
search this site on how to do it; it's not at all complicated ...
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|