|
Sorry , I understand that .. my mistake !
|
|
|
|
|
|
Yes , it will help , that's what I'm looking for ... thanks !
|
|
|
|
|
Happy coding! Let me know if you have further questions.
|
|
|
|
|
hi,
for(int i = 0;i < n; i++)
{
try
{
//.........
}
catch(exception e)
{
//........
}
}
In tha above code,in catch block im printing some error message after the for loop terminated.my problem is when the for loop get terminates,im having the last error message only(the catch is called 2 times,so i need to display 2 error messages)...
pls help me...
|
|
|
|
|
Gomathy_84 wrote: im printing some error message after the for loop terminated
What do you mean by printing exactly ? Print on the console with printf ?
Furthermore, you don't print after the for loop is terminated but in the loop itself.
|
|
|
|
|
From what I understand, you're collecting error message inside the catch block and then displaying it after the loop terminates.
If so you will need to collect multiple strings.
You can do this using a vector of strings.
std::vector<std:string> vstrErrors;
try
{
}
catch(std::exception e)
{
vstrErrors.push_back(e.what());
}
|
|
|
|
|
Yes...ThankYou so much
|
|
|
|
|
here,im having seperate exception class like connectionException class.I derived it from std::exception.
In the place of throw ..i wrote as throw connectionException(...some error message).
In the place of Catch...how to catch my class exception and covert into std::exception???
Thanx.
|
|
|
|
|
This should do it.
This is the C++ concept of "a base class object can reference a derived class object".
catch (connectionException& ce)
{
std::exception& e = ce;
}
|
|
|
|
|
In general it's best to catch exceptions by reference, generally a const reference.
try
{
}
catch (const exception &e)
{
}
Steve
|
|
|
|
|
Dear Exprets,
I am not a fresher, But would like to refresh my C++ skills and learn
more concepts towards desing. I am also attending few interviews now a days.
I am not just looking for interview question / FAQs.
Can any one advice a good book/ resource for me please
Many thanks in advance !
|
|
|
|
|
For MFC: "MFC Internals".
For C++ and STL ) : "Effective ++", "More Effective C++", "C++ Gotchas", "Effective STL", "Exceptional C++", ...
Added :
"Large-Scale C++ Software Design", "Code Complete", "The Pragmatic Programmer"
Watched code never compiles.
|
|
|
|
|
I could add "Programming Windows with MFC by Jeff Prosise".
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
|
I would look for books about .NET/Winforms/WPF instead of MFC.
And then look for books about integrating unmanaged C++ with managed .NET. (IJW/CLI/Interop)
MFC have become like Cobol on the mainframe. It is something you maintain and integrate with. But any new development should work towards .NET/Java.
|
|
|
|
|
My project is about MDI with Multi-Document.
In each document has it own menu and toolbar, it mean that the menu and toolbar must change according to activate child windows.
For the menu,I use code below within InitInstance function to add document template then the menu (IDR_MSESoftTYPE and IDR_RECEIPT) can change according to activate child windows, so the menu already work fine.
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(IDR_MSESoftTYPE,
RUNTIME_CLASS(CMSESoftDoc),
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CMSESoftView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
pDocTemplate = new CMultiDocTemplate(IDR_RECEIPT,
RUNTIME_CLASS(CReceiptDoc),
RUNTIME_CLASS(CReceiptFrame),
RUNTIME_CLASS(CReceiptView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
*
*
*
What about the toolbar how can I make it like menu.
Thanks
|
|
|
|
|
I can think of one "simple" solution:
Don't have any main frame toolbars - but have them inside the childframe.
You could also swap main toolbars in the childframes activate code, but that would be more fragile...
I'd go for the first idea if I was you.
Iain.
I have now moved to Sweden for love (awwww).
|
|
|
|
|
hi,this is a basic simple question, in my view class i added an icon and it shows. now i want to click on it and a file opens. so how to add mouse click control to that icon?please help me.
|
|
|
|
|
See here[^].
It's time for a new signature.
|
|
|
|
|
that means no solution to give mouse click control to a rectangle or an icon drawn in a view class.. I am not supposed to use dialogue based. So in OnDraw() i draw a bitmap then a rectangle over bitmap. then i attached an Icon to that rectangle. Now what i want is when ever some one clicks on the icon(rectangle area), a file should be opened..
|
|
|
|
|
In that case you need to capture the mouse button down event and then figure out whether the mouse is over your icon, from the mouse co-ordinates. If it is then call your file opening code.
It's time for a new signature.
|
|
|
|
|
This is the best approach.
Since you're using MFC, you will get the mouse coordinates from the point parameter of the CWnd::OnLButtonDown handler.
By you I mean rajapp.
«_Superman_»
I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)
modified on Thursday, April 29, 2010 11:46 AM
|
|
|
|
|
Thank you for the help ,on using LbuttonDown() i can now click on the icon position. Now i am working on finding how many pixels i scrolled as when the image is scrolled, the pixel position changes and the LbuttonDown() click position also changes as it calculates the top corner as always (zero,zero) regardless of the image scrolled.
|
|
|
|
|
Welcome to Windows programming!
It's time for a new signature.
|
|
|
|