|
Why do multithreaded programs behave differently in DEBUG mode and RELEASE mode?
|
|
|
|
|
Because you use two different libs or dlls. The debug versions contain more information to make it easier to debug the code, and probably also the behaviour is different so that a thread is halted when you debugstep into another one.
~RaGE();
|
|
|
|
|
Does that mean that a program running well in DEBUG mode may not run the same way in RELEASE mode?
|
|
|
|
|
|
hey guys
i'm a novice c++ programmer and i'm currently making a program
everything works fine, but there's one slight problem...
i need to have the program output a text on-screen and i don't know how.
Let me explain, the program i want to make basically displays a text on the screen of your computer.
not the DOS prompt where it executes the program, but the screen itself.
Think of an alert-messenger that does so not by using those windows, but by just displaying the text
it needs to display.
How can I do that?
If it's no trouble, i'm also wondering if the gotoxy(x,y) (using the conio.h file) works with whatever solution to my problem you have. And how can i make that text disappear after a pre-set amount of time?
thanks for your help
regards,
peter
#include borland c++ compiler 5.5
using Windows XP;
int main()
{
cout << "Hi! I'm Peter!\n";
return 0;
}
|
|
|
|
|
Peter Charlesworth wrote: Think of an alert-messenger that does so not by using those windows, but by just displaying the text
it needs to display.
I have no idea how to do it without "those windows", but you could draw your text on a transparent window, giving the impression that the text is displayed "on the screen".
~RaGE();
|
|
|
|
|
I am using the code below
typedef CArray<float, float> INT_PERCENT1;
INT_PERCENT1 arrPercentage1;
INT_PERCENT1 arrPercent1;
arrPercentage1 have a data in the array already added. but arrPercent have not element yet added. I want to copy a data from
arrPercentage1 to arrPercent1
for ( int j = 0 ; j< countloop ; j++)
{
arrPercent1.SetAt(j, m_arrPercentage1.GetAt(j));
m_arrRank1.SetAt( j , 0);
}
at the line arrPercent1.SetAt(j, m_arrPercentage1.GetAt(j));
the program crashes , while debugging i got the error
CXX0030: Error: expression cannot be evaluated
Regards.
|
|
|
|
|
zahid_ash wrote: I want to copy a data from
arrPercentage1 to arrPercent1
So why not just use the Copy() 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
|
|
|
|
|
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
|
|
|
|