i am using third party COM component...
I have put them in try catch block for any com error..
by using _com_error i am able to retrive the error code and error message... But i want to filter out some of the error code say 0x80004005 (unexpected error). When this error occurs i just handle the error gracefully without notifying the user of the actual cause.
My question is.. Is there any #define for 0x80004005 like
#define COM_UNEXPECTED 0x80004005 so that i can use it in my switch case like
now my switch looks like this
I know that i can #define it myself but i looking for the one that is already defined.
My God is more powerfull Than Your God. (the line that divides the world)
the difference is that TRUE is a #define and true is a constant, very much like any integer 1, 2, 3, 23423.
TRUE happens to evaluate to 1, and the integer representation of true is 1, hence you can use them interchangably. But one should always strive to "put the round ball into the round hole, and not the square hole".
-- They say the most horrible things, but I hear violins.
When I close my eyes, I'm at the center of the sun.
bool is a C++ built-in type with two possible values, true and false. Nothing else. BOOL is something MS made up for use in Windows and MFC. They needed a boolean type that worked in C and C++, and since they did this before bool was added to C++, they couldn't just reuse bool. BOOL is defined as:
typedef int BOOL;
#define FALSE 0
#define TRUE 1
The trouble with those definitions is that the BOOL notion of "true" is not 1 but non-zero. A function that returns a BOOL may return 1 to mean "true", or some other nonzero number (I've seen it myself, can't recall the API names off-hand though).
Because of that, you should never test a BOOL variable/function against TRUE, just test as a boolean and the language rules will take care of the rest.
You should, in general, use bool for your own code, assuming it's C++. You can pass a bool to a function expecting a BOOL because the bool gets promoted automagically by the language rules to the integer 0 or 1, for false or true respectively, which satisfies the definition of BOOL.
A little preface, I'm really new at programming with Visual C++. I've just installed VS .NET on my machine and have purchased a few books.
I have finally gotten down the CFileDialog class and I can use it to select a file with ease. I am wondering if there is a similar way to select a folder/directory?
I have searched for quite some time (I usually search for at least 30-90 minutes or more before I post a message here), and cannot find anything to help me. I've found a DirPkr class, but it appears it was written for VC++ 6 and there are about 50 errors when I compile in VC .NET, and I'm not advanced enough to know what the problems are. I was wondering if there was an easy class out there for VS .NET (or a way to easily adapt CFileDialog, or maybe another class in MFC to do this?) I've searched the MSDN site too but cannot find anything. I am getting better at wording my searches though
That's exactly what I was looking for and this example there worked great. Sometimes I just sit there and enter a bunch of phrases into the search box "select folder" "pick folder" "choose folder" and I usually find what I'm looking for. This time, none of the choices that I used yielded a result.
Thanks for the quick reply. I will be able to sleep tonight.
Oh wait, it's only 8:30, that means I've got 8 more hours to play!
I want to draw in layers, so if anybody could give me a hint about that, I would really appreciate it. I want to be able to draw in multiple layers, so for instance if I am to erase a rectangle or any other more complex object, I would only discard a layer and repaint that object as altered, not having to redraw the background or anything else. It is something like in Photoshop when you draw on the layer and you bring it to the front, then you can delete the whole layer at any moment later.
I only need a general guidance, not the actual code.
I think this is possible. Why don't you decrease the background color when erasing. Like Red when erased become light red. Then you will have a layout and user can redraw or repaint according to layout.
Thanks & Regards,