I am working on VC++ for a simulation project.
i want to know for what most of the Reasons
Applications developed in VC++ will Crash.
and how to find the crash point for that Application i.e;
how to get into that particular line of code where my application has crashed.
To find the line whre your application crashes you can find out if you build your app in debug mode. At tis time your system will start your debugger at the line your code crashes. But sometimes application crashes only in release therefore you have to insert some debug messages into your code for example Beep or MessageBox. Most crash's causes of not initialized variables therefore you have to initialize all members with valid values.
Why bother using a MAP file? Just build the application with debug info (not a debug build, a release build with debug info). In fact the first changes I make to every project I make is to turn on .PDB generation for release builds.
Is there a way to give a piece of code exclusive access to the CPU without fear of interruption from Windows?
Something similar to a critical section, but across processes -- not just threads. And in user space... not kernel level or anything. If not, I imagine it's for stability reasons... but I figured there'd at least be *something*.
Any help would be very appreciated... thanks!
(I posted this in the Visual C++ because I'm using C to program this...)
Since OS's uses protected mode a program cannot use the processor exclusive (this is not a windows behavior). The function EnterCriticalSection can be used to protect code from reentering in another thread not for exclusive execution on the processor.
i can get the code to compile just fine but when i go to launch my application i get an assertion error, i narrowed down the block of code that might be causing it but i also think i am not correctly writing the code to display the bitmap.
this block of code in my OnInitDialog function is where i get the problem from i think.
tried using the code and sayign hdc is undeclared and when i make it a hdc variable it says oen fo them was used without being initialized. how i set up my dialog was i made a picture control and from there not quite sure exactly what to do, the code you gave by its self wont just display my image as i am sure more code is needed but i get multiple assertions when i load my app and if i ignore them it loads but no image loaded.
this is my code so far(most commented out though) that would do the image loading, but i get multiple assertions.
What does it mean when a structure member declaration is followed by a colon, then a number, as in:
typedef struct tagMENUBARINFO
RECT rcBar; // rect of bar, popup, item
HMENU hMenu; // real menu handle of bar, popup
HWND hwndMenu; // hwnd of item submenu if one
BOOL fBarFocused:1; // bar, popup has the focus
BOOL fFocused:1; // item has the focus
} MENUBARINFO, *PMENUBARINFO, *LPMENUBARINFO;
The "fBarFocused" member has a ":1" after it. What does that mean?
As the others have said, it says that that field takes up one bit.
However, don't be tempted to use bit fields in your own structures. They are highly non-portable, even when compiling for the same platform. Different Windows compilers may treat them in different ways. Even different versions of the same compiler on the same platform can treat them differently. Use them only if you can guarantee that you will only ever compile your code with the same compiler (same version, same vendor etc...). The problem is that the C standard does not specify in which order the fields are to appear in memory - compilers are free to do whatever they like.
"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"
Just wondering because...some things...strings, iterators, lists, etc are nice and clean in java and c#, but are ugly or lacking in c++.
Over time i see code project articles try to bring some of that c# goodness to c++, like with delegates, foreach, and properties...so is their any library out there that does this in a big way...make c++ like C# with memory leaks i mean :P