|
|
Thanks,but I want to know why the codes didn't throw an exception when I trace it step by step,but only when I run it there would be some exception.
|
|
|
|
|
There's no obvious reason why you'd get exceptions only when you don't run step by step but there are two related likely causes.
Stepping through the code affects two things, speed and thread synchronisation. If multiple threads are involved then the code may work when single stepped but crash when run for real if data or resouce sharing between the threads is faulty.
If it's single threaded then all you really have left is speed and unless there's any io/comms external or interprocess communication going on then the difference would be hard to explain. Usually single stepping would only make the system work if the code being run is overrunning a buffer in another, flawed, process but doesn't fill the buffer as fast when single stepped so you don't see the bug.;)
The only way you're going to get to the bottom of this is to look at what the excpetion tells you and where it occurs. Find the exception code e.g. 0xC0000005 for Access Violation and make sure the debugger is set to always break on that exception. If the debugger is being cryptic you could always post what it says and someone may recognise it.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
That's not scary, it's normal.
In standard C++ try /catch can only catch C++ exceptions: that is only exceptions that are raised by the C++ throw statement. Unfortunately some version of Microsoft Visual C++ (6.0 and below) do not follow the standard in this regard. This was fixed in later versions but the old non-standard behaviour can be selected with the /EHa[^] switch (not a good idea in general).
__try /__except is a low level construct and can catch any exception. Note however that with __try /__except the destructors of objects on the stack as it is unwound are not called, so this construct doesn’t play nice with C++. It will break the RAII pattern for example.
Steve
|
|
|
|
|
Hi,
Can I allign(right,left,center) text in a message box(MessageBox or AfxMessageBox API).
Warm Regards,
Mushq
|
|
|
|
|
Mushq wrote: Can I allign(right,left,center) text in a message box(MessageBox or AfxMessageBox API).
Left: Yes, by default.
Right: Yes, use MB_RIGHT style.
Center: Not with the standard message box. There might be custom messagebox classes around which will do it. Google for it.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
i want the sample c++ code to find the inverse of a 4 by 4 matrix please help
My small attempt...
|
|
|
|
|
FKINGGLIT[^]
And don't forget to add the URGENT keyword while googling. Google will search upto 60 times faster, when the URGENT keyword is specified.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
brahmma wrote: don't forget to add the URGENT keyword while googling
Excellent tip, thanks!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
look at the Invert4by4Matrix() API
|
|
|
|
|
toxcct wrote: look at the Invert4by4Matrix() API
It is Invert4By4Matrix() (Look at the Capital B). And the OP actually wanted it urgent, for which the Invert4By4MatrixRightNow() API exists. :->
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
plz help
how can i hook using WH_KEYBOARD_LL. any example ?
thanks
|
|
|
|
|
Example[^]
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
hi all
i wanted to define a hotkey to go directly to the first error or warning generated during build process and highlight the corresponding line of the source, so that i've not to use mouse to click on the first line in the Error List window. as well, i wanted the build process to stop. so i defined a macro as follows:
Sub hilight_cur_err()
DTE.ExecuteCommand("View.NextError")
DTE.ExecuteCommand("View.PreviousError")
DTE.ExecuteCommand("Build.Cancel")
End Sub
when build process has not finished yet, the macro runs without any problem. but if it has already failed, a dialog appears indicating no build process is currently available to be canceled.
sorry if my English is not so good to describe. if u've still not figured my problem out, i've to say, in another words, how can i make VC not to show an error dialog if the last statement in the macro code above fails?
thx
|
|
|
|
|
Hi Experts,
I want to create instance of a inteface(IPropertyBag) ,defind in a abc.dll file.
And same name interface exist in ocidl.h file.How can i pass a correct GUID
so that i can access method defind in abc.dll.
i try like this
IPropertyBag* Properties;
hr=CoCreateInstance(__uuidof(PropertyBag),NULL,CLSCTX_INPROC_SERVER,
__uuidof(IPropertyBag),(void**) &Properties);
I also saw the CLSID with visual studio ole tool .Can i pass the the direct CLSID.
CoCreateInstance((uuid(47000673-7DB2-44C9-8AC1-65266117D280),NULL,CLSCTX_INPROC_SERVER,
__uuidof(IPropertyBag),(void**) &Properties);
But it dispaly syntext error.
error C2059: syntax error : ')'
error C2059: syntax error : 'bad suffix on number'
error C2059: syntax error : 'bad suffix on number'
error C2059: syntax error : 'bad suffix on number'
How can i make it correct.
Can i pass the Interface name abc(dll file) wrapper if yes how ?
|
|
|
|
|
The first problem here is the syntax issue with the CLSID you're passing to CoCreateinstance. the big number with the -'s in is not in a form that the C++ compiler can understand. MIDL which handles .idl files might be OK with this but in a .cpp file it's a no. You have to translate theses GUIDs (Globally Unique IDentifiers) to a struct with curly bracket syntax :-
{0x0000, 0x00, 0x00, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
//Microsoft's definition of a GUID is like this
<br />
typedef struct _GUID <br />
{<br />
DWORD Data1;<br />
WORD Data2;<br />
WORD Data3;<br />
BYTE Data4[8]; <br />
} GUID;<br />
There is a more fundamental problem here though. It appears you're trying to create an instance of IProperyBag?
If so, this is the root of your problem. You need to be creating an instance of something that implements IPropertyBag. It's like trying to create an instance of surfing, when what you need is an instance of a surfer. The surfer or in this case the thing that does IPropertyBag will have a Class ID (CLSID) and this is what needs to be in the call to CoCreateInstance. A CLSID is just a typedef of a GUID.
If this doesn't make sense or isn't clear (It's a while since I did much COM at this level) I recommend trying the experts in the COM forum who will undoubtedly be able to explain it better.
All the best.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Hi
I am trying to derive from CSplitterWnd but it is not listed in MFC base class list box. any help plz
|
|
|
|
|
|
TariqZ wrote: I am trying to derive from CSplitterWnd but it is not listed in MFC base class list box
You may have to actually type it in yourself
Something like this should work:
class AFX_EXT_CLASS CMySplitterWnd : public CSplitterWnd
{
DECLARE_DYNAMIC(CMySplitterWnd)
public:
CMySplitterWnd();
virtual ~CMySplitterWnd();
...
};
IMPLEMENT_DYNAMIC(CMySplitterWnd, CSplitterWnd)
CUluSplitterWnd::CMySplitterWnd() : CSplitterWnd()
{
...
}
CMySplitterWnd::~CMySplitterWnd()
{
...
}
...
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
How to send a mail from mfc program
|
|
|
|
|
You need to take a look at the interface called MAPI in the docs or if you don't like the look of that have a look for SMTP (Simple Mail Transfer Protocol). Depending on how much external stuff you want to rely on sending mail can be anything from a one line call to a 6 month project
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
|
Hi all:
I need to employ seekg() and streampos to extract a string containing a certain word from a text file.
I have written:
typedef vector<streampos> OccurrenceList; //OccurenceList is an array of vectors which hold all the "streampos" for a given word.
vector<streampos>::iterator it;
for (it = occurrences.begin(); it != occurrences.end(); it++) {
*it -= 35; //Set the negative offset.
fin.seekg(*it); //fin is the text file.
cout << fin.get(); //Get one character to verify that everything works before proceeding any further.
}
But what I got (111) is NOT what I expected.
Can any one help?
Thank you
|
|
|
|
|
Would I like to know why you are setting the negative offset
|
|
|
|
|
Hi:
The original value of streampos is the location of a word, which is alway in the middle of a sentence. I need to set the negative offset, so I can print out the sentence which contains the word I am given.
Thank you
|
|
|
|