|
Tnarol wrote: Is it possible ?
yes
use ShellExecute
nave
|
|
|
|
|
|
|
COOL ! It works great !
Thanks everyone.
|
|
|
|
|
And you suggested this the other day!!!
Your previous post[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
|
_AnShUmAn_ wrote: And you suggested this the other day!!!
COOL !!!
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
i have a big class that uses com methods. i would like to avoid a lot of "ifs" in it, so i wanted to replace standard hresult checking with try-catch block. there are some articles on code project about that, but the problem is that i have to use VS6 for it. That causes the restriction - i don't have CAtlException.
I also noticed that constructing function that throws something (void function(something) throw(type){...} ) is not doable, because such construction is ignored by the compiler - i get a warning with such a message...
Concluding, my question is - how can i write a class that can replace hresult with exception stuff in VS6 :].
thanks for your ideas in advance
-- modified at 9:18 Wednesday 14th June, 2006
|
|
|
|
|
Perhaps macros are suitable for you, something like this:
#define CHECK(expr) { if((expr) != S_OK) throw MyException; };
where MyException is your own class. (In case of STL, you can derive it from std::runtime_error ).
A sample usage:
try
{
CHECK(CoCreateInstance(...));
. . .
}
catch( const MyException & ex)
{
}
Now you do not have if s. Anyway, within exception handler you have to provide a method for releasing objects created successfully earlier.
|
|
|
|
|
|
as i said... i use VS6 and the article you mention uses CAtlException which is not available there...
I will try the first solution with macro as well
any more ideas?
|
|
|
|
|
|
you're certainly right, but throwing stuff has restrictions in VS6... when i create a function like this
some_type function(some_arguments) throw(some_type) {...} i receive warning C4290: C++ Exception Specification ignored. it seemslike you cannot throw anything with a function in VS6 using this expression :/. and that is my problem. how can i do this in VS6?
thanx in advance
|
|
|
|
|
That's an exception specification, not an actual throw of an exception. It's saying "this function might at some point throw an exception of type some_type " Take it out, it's ignored by the compiler anyway.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
VB > soccer
|
|
|
|
|
I'm learning how to use Visual Studio 2005 and how to implement GUI design in C++. In the past, I've only programmed in command prompt style (basically using emacs and then gcc to compile, etc.)
Now that I'm learning to do GUI design using Visual Studio 2005 I was wondering if anyone knows and can suggest a book for beginner GUI design.
That would be great!
Thanks
Kitty5
|
|
|
|
|
A book not but I suggest you work with the MFC first (Microsoft Fundation Classes). If you are using the Express edition of Visual Studio 2005, they are not supplied with unfortunately.
After you get you firm grip over MFC, it is always nice to dig into the details of WIN32 API. To know how MFC does the job.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
The Windows Interface Guidelines for Software Design[^], and its replacement, The Windows User Experience[^].
Given the amount of Broken GUI out there, everyone that writes code should read UI design books of some sort. (Geeze, even all of text-based Linux GUIs that I have to use STILL do not allow Shift+Tab to navigate controls backwards...) Those two books are well worth reading cover-to-cover.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
-- modified at 9:55 Wednesday 14th June, 2006
|
|
|
|
|
hi,
Can I use set_intersection function to find out the itersection of containers which contains user defined type objects or it works only with standard datatypes?
Thanks in advance,
Regards
Abhi Lahare
|
|
|
|
|
Abhi Lahare wrote:
Can I use set_intersection function to find out the itersection of containers which contains user defined type objects
Yes you can.
For that you have create your binary predicate function and use it as a last parameter of the set_intersection function.
for e.g
bool mod_lesser (int elem1, int elem2 )<br />
{<br />
if ( elem1 < 0 ) <br />
elem1 = - elem1;<br />
if ( elem2 < 0 ) <br />
elem2 = - elem2;<br />
return elem1 < elem2;<br />
}
you may change int to UDT.
Abhi Lahare wrote: it works only with standard datatypes?
Not neccessary,It should works for UDT also.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
In context to Laxman's reply
When you perform operations on User Defined Types(UDT) you should tell the "-" operator (in this case), how to work with UDT's. (Apply Overriding concepts)
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
_AnShUmAn_ wrote: (Apply Overriding concepts)
Not Overriding Overloading
You may overload the logical operaters like <, > and Mathmatical operators like - for Binary predicate conditional checking. so that the program is generalised.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi all,
I have a CListCtrl, which has an attached ImageList.
I set the image for an item and the image is displayed correctly. Very Well.
Now I change my project settings to releasemode, compile my application and now something strange happens:
In my ListCtrl only the first image in my ImageList is displayed, no matter, what index I specify. It works perfectly in debug-mode, but does not work in release-mode. So I can not singlestep through my application to find the error.
Since it works in debug-mode, I think, my sourcecode is correct. I copied it from a MFC book.
Can anybody tell me, where to look for differences between debug and release as far as imagelists are concerned?
Juergen
|
|
|
|
|
Could you post code snipet so that we can trace the problem..??
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Ok, here is what my code looks like:
CImageList StatusImage is a member-variable in my class.
OnInitDialog()
{
StatusImage.Create(4,12,ILC_COLOR4,5,1);
AddBitmapToImageList(StatusImage,IDB_STATUS_PLAN);
AddBitmapToImageList(StatusImage,IDB_STATUS_GO);
AddBitmapToImageList(StatusImage,IDB_STATUS_CRITICAL);
AddBitmapToImageList(StatusImage,IDB_STATUS_FINISH);
AddBitmapToImageList(StatusImage,IDB_STATUS_STOP);
}
BOOL AddBitmapToImageList(CImageList &imageList, UINT nResourceID)
{
BOOL bReturn;
CBitmap bmp;
bReturn=bmp.LoadBitmap(nResourceID);
if(bReturn)
{
bReturn=imageList.Add(&bmp,RGB(255,255,255));
bmp.DeleteObject();
}
return bReturn;
}
When I access the ImageList in debug-mode, the correct image is selected. When I access the list in release-mode, only the first bitmap is displayed.
I even debugged the release-version, but I found no errors. Everything seems to work fine. But the wrong image is displayed.
Juergen
|
|
|
|