Debugging in Visual Studio 2010 (C++, unmanaged), what is the information unused ???
or unused 0
supposed to mean? I have attached two screenshots, child is a HWND
to an existing window.
I am also confused by the fact, that the HWND
is sometimes displayed as "unused", sometimes as "0". When having a pointer referring to unallocated memory, I'd understand the situation, but in my particular case the window is already created and valid.
To enable or disable Just My Code in Visual Studio, under Tools > Options (or Debug > Options) > Debugging > General, select or deselect Enable Just My Code.
To end a debugging session in Microsoft Visual Studio, from the Debug menu, choose Stop Debugging.
Debugging is the process of finding errors during application execution. It does not mean syntax errors, with which the application cannot be compiled, but on logic errors. Logic errors can only be noticed during application execution. See the following method. private double Divide(double a, double b)
In most languages supported by Visual Studio, you can edit your code in the middle of a debugging session and continue debugging. To use this feature, click into your code with your cursor while paused in the debugger, make edits, and press F5, F10, or F11 to continue debugging.
This goes back to the early nineties, back when there was just a HANDLE as a type to declare a handle of any Windows object. Which was a bug factory, programmers could fumble code and, say, pass a font handle where a window handle was required. So the STRICT macro was added later, it redeclared handle types so mixing produces a compiler error. Which looks like this in winnt.h, edited for content:
#ifdef STRICT
typedef void *HANDLE;
#define DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name
#else
typedef PVOID HANDLE;
#define DECLARE_HANDLE(name) typedef HANDLE name
#endif
Example usage:
DECLARE_HANDLE(HWND);
The struct macro soup ensures that a HFONT can never be used where a HWND is expected when STRICT is turned on, it produces a type mismatch on the structure type.
You can now see where "unused" comes from. It is in fact unused, only Windows can create handle values. It is helpful in the debugger since it lets you look at the handle value, with 0 or -1 being a sure sign of trouble.
More about STRICT in this MSDN article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With