|
I'm just being lazy here but is there a way in the Visual C++ IDE (any version) to have it tell you what exceptions have been declared (by any of the methods or methods called by those methods etc...) to be possibly thrown?
The only way I know of is to dig through MSDN researching each method call which can get time consuming since there are so many overloaded method variations that I tend not to assume the possible exceptions that could be thrown by one overloaded method will be the same as another overloaded method.
|
|
|
|
|
WinError.h contains all of the error codes generally thrown by WinAPI/MFC calls, but generally speaking, there's no clear way of knowing what each method will throw without looking into the documentation associated with that specific method.
|
|
|
|
|
Albert Holguin wrote: WinError.h contains all of the error codes generally thrown by WinAPI/MFC calls
I'm just trying to quickly identify which catch handlers (if any) I would need at the level in the code where I'd want to handle them. Maybe some magic hover help that would allow you to see the summary of all the "throw" declarations for the method call, definition, or declaration your cursor is currently hovering over.
I apologize that I didn't word my question very good, now that I've reread it I guess it did sound like I just wanted a list of all the exceptions that could ever get thrown anywhere.
Regardless, thanks for taking the time to reply.
|
|
|
|
|
bob16972 wrote: Maybe some magic hover help that would allow you to see the summary of all the "throw" declarations for the method call, definition, or declaration your cursor is currently hovering over.
Sorry, no such magic... 
|
|
|
|
|
A basic rule of exception handling is also that you only handle exceptions that you are aware and knowledgeable of. You shouldn't just catch any and all exceptions, except for maybe at the top level of your code.
So, you need to look into the documentation to see what exceptions are thrown and how to handle them anyway. It'd still be nice indeed to see what exceptions could be thrown so you can quickly check what you'd have to handle, but I'm guessing the documentation is quick enough for it anyhow, since you'll need to refer to it anyway to understand how to respond to the exception.
|
|
|
|
|
Hi Developers,
I want to send TVN_BEGINLABELEDIT message from a custom tree control, whenever i will press F2 key( to rename the label ).In custom control I have handled PreTranslateMessage, in which after mapping VK_F2, I have written
SendMessage(TVN_BEGINLABELEDIT, WPARAM(hSelectedItem), 0L);
But in other file ( in which I have handled TVN_BEGINLABELEDIT ), doesn't get called.
Is there any mistake in SendMessage() calling or some other issue.
Thanks in Advance.
Amrit Agrawal
|
|
|
|
|
Try showing a bit more of your code so we can see exactly what you are doing - and don't forget to put it within <pre> tags for formatting. Is this MFC or Win32?
The best things in life are not things.
|
|
|
|
|
TVN_BEGINLABELEDIT is a notification, which isn't the same as a message. The message in this case is WM_NOTIFY.
You'll probably want to use TVM_EDITLABEL[^].
modified 13-Sep-18 21:01pm.
|
|
|
|
|
Thanks Jones,
Now It's working.
Amrit Agrawal
|
|
|
|
|
Hi all,
can anybody please tell me how can i use the proxy settings in vc++ MFC Application?
thanks in advance.
|
|
|
|
|
|
this article use proxy settings of IE only what about other browsers?
|
|
|
|
|
I have extended a CComboBox and implemented three messages (or events) like below
BEGIN_MESSAGE_MAP(CComboCtrl, CComboBox)
ON_WM_KEYDOWN()
ON_CONTROL_REFLECT(CBN_EDITUPDATE, &CComboCtrl::OnCbnEditupdate)
ON_CONTROL_REFLECT(CBN_SELCHANGE, &CComboCtrl::OnCbnSelchange)
END_MESSAGE_MAP()
Now when a selection changes it calls OnCbnSelchange message-handler. I am using this class inside a dialog class. I have tried to register a message handler in that dialog class for CBN_SELCHANGE event but I think it is not receiving CBN_SELCHANGE event or it is sending that event to custom control. How can I handle CBN_SELCHANGE event inside a dialog class.
This is the implementation inside derived class (or custom control class)
void CComboCtrl::OnCbnSelchange()
{
GetLBText(GetCurSel(),m_str_sel);
}
|
|
|
|
|
It's a long time since I used MFC message maps, but it looks to me like you are capturing the CBN_SELCHANGE notification in your control, so the dialog box won't see it. I think you may need to move that notification to the dialog or reflect it back somehow. Pual Di Lascia wrote an excellent paper[^] on MFC message processing which I recommend to anyone struggling with this subject.
The best things in life are not things.
|
|
|
|
|
thanks Richard, you got the problem right. I am reading that article now.
|
|
|
|
|
Hi all,
How can i drag drop the PictureControl.
I have taken a picture control on my dialog and loading one bitmap.Now how can i drag drop that picture control
Thanks
Sharan
|
|
|
|
|
Please don't repost the same question - see my suggestions below.
The best things in life are not things.
|
|
|
|
|
Hi all,
How can i load a bitmap on dialog so that i can drag that bitmap using CImagelist.
Anyone having any idea please share with me.
Any links or any samples will be great
Thanks
Sharan
|
|
|
|
|
What do you mean by drag? If you are trying to move it to a different window then you need to implement drag and drop as described in some of these links[^]. If you just mean that you want to move the control around within its parent window then you just need to capture your mouse and redraw the control at whatever position the mouse takes you to.
The best things in life are not things.
|
|
|
|
|
Hi,
I am using multimap and key value can be duplicates.
I can find first key value using find() function.
But how to get next duplicate key value?
|
|
|
|
|
Which multimap implementation are you talking about?
|
|
|
|
|
I assume any standard compliant one will do.
Steve
|
|
|
|
|
I can see no standard compliance requirements in the original post, but your assumptions seem right.
|
|
|
|
|
multimap<string, string> mymap;
string strKey;
:
:
multimap<string, string>::iterator it;
:
it = mymap.find( strKey );
if(it != mymap.end())
{
do
{
cout << strKey << " = " << it->second << "\n";
it++;
}
while( it != mymap.upper_bound( strKey ));
}
|
|
|
|
|
This is inefficient. Why calculate the upper bound each loop?
Steve
|
|
|
|