|
Why not just use structured exception handlers instead?
Using this approach a hard exception such as an access violation will be caught by the __catch block and can be handled by your app in any way that's appropriate.
There's plenty on MSDN on this subject. Also check out John Robbin's "Bugslayer" series in MSJ/MSDN Magazine.
Anna
Homepage | My life in tears
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In
|
|
|
|
|
I can use excetions in my own code, but when I use foreign DLL function I have no chance to prevent e.g. divsion by zero ...
|
|
|
|
|
If you're using C++ exceptions that's certainly true - they won't catch "hard" exceptions such as access violations.
However, a Structured Exception Handler will. Simply wrap the calls into the DLL inside an SEH __try block.
Anna
Homepage | My life in tears
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In
|
|
|
|
|
Can you give me more details...?
|
|
|
|
|
I'm afraid not, but it's all in MSDN. Read the Bugslayer columns for a start.
Anna
Homepage | My life in tears
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In
|
|
|
|
|
|
If you want to catch exceptions coming out of the DLL function, you can do the following. However, if the DLL function is "extern C", you'll have to make sure you specify the /GX compiler option for your project.
try
{
MyUnsafeDLLFunction();
}
catch( ... )
{
AfxMessageBox( _T("The DLL function crashed :(") );
}
This should handle all exceptions coming from the DLL function.
Chris Richardson Terrain Software
|
|
|
|
|
I need to load and render an object from 3dmax(3dstudio) and show it as a 3d game.
mohsen
|
|
|
|
|
The easiest solution would be direct-x9, but there's no support for 3ds files. However, there is a converter for 3ds meshes to direct-x meshes.
I did this once, it's straightforward.
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
Dear Zizilamoroso,
Thanks for your help,
Please send more information about this to me.
I want to show and move 3dMax(3dstudio) Files
by visul c++,
Best Regards,
Mohsen Jamali,
|
|
|
|
|
If you want to load meshes into c++, I assume that you know how to program in c++.
So, all you have to do is this:
- install dx SDK (min. 8, pref. 9)
- find the converter on the internet (it's called conv3ds.exe or simmilar)
- convert *.3ds to *.x
- there's an example on how to load those converted meshes (*.x) into c++ dx9.
btw. There're some helper classes in a common dir somewhere. You can do something like this:
<br />
pMesh->Load("test.x");<br />
pMesh->Render();<br />
Easy or what?
regards
Zizi
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
Hi, I have an MFC application with a COM interface. When I try to load a document when a call has been made to this interface, I get an assertion in OpenDocumentFile after AfxGetMainWnd() is called (wnd == NULL). I guess this call asserts because I called it from a different thread.
Anyone knows a (clean) sollution for this one?
|
|
|
|
|
To use OpenDocumentFile() from worker threads in ED (see sig) I post a message to the main thread which calls OpenDocumentFile() and then synchronize this with the worker thread. This is the only way I've found to do this sort of thing from a worker thread.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I was afraid that was the only way.
|
|
|
|
|
Doing anything much in any thread except the main one which has anything remotely to do with CWnd* and/or MFC Handle Maps is a real pain in the backside. I go through various hoops in ED to work-around these limitations.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hexadecimal data are stored in a string(CString type).How can I
convert them to a Hexadecimal value?
LeonOrient
|
|
|
|
|
Use the CString.GetBuffer(CString.GetLength()) function to get the buffer of the CString and then use
unsigned long strtoul( const char *nptr, char **endptr, int base ); to convert the string to an unsigned long. After this, call CString.ReleaseBuffer().
The base for the strtoul function would in your case be 16.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
This is a difficult way. At first I think as you. But after a moment
I think that since this is a frequent convertion, so the Micro Soft
should offer a function to solve the problem.
What is the function? Can you tell me?
LeonOrient
|
|
|
|
|
A difficult way? 3 lines? 2 lines for preparing the CString and only 1 line to do the conversion? Not that much I would say...
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
----------------------------------------------------------------------------
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
Could you tell me what the codes above can do with?
LeonOrient
|
|
|
|
|
Yes, I could. Have you tried it?
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
No, but I haver tried another way, it's very easy. Please look!
strText=m_lstWrite.GetItemText(i,j+1); //Get the CString: strText
sscanf((const char*)(strText),"%x",&temp); //convert,Only a sentence!
Of course, It's very nice to discuss with you.
LeonOrient
|
|
|
|
|
Well! BUT you use a const char * cast to get the char* from the CString. My solution with GetBuffer/ReleaseBuffer is safer.
If I would do it with a cast like you my solution would be:
strText = m_lstWrite.GetItemText(i,j+1);
temp = strtoul((const char*)(strText),NULL,16); Only one line of conversation code then too!
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
My god!
It is very good and very easy!
And it's also very regretful for me to say that and not to read MSDN carefullly after you gave me the tip.
Thank you very much!
LeonOrient
|
|
|
|
|
A frequent conversion?
not for me... it's rare that I want to convert a string into a hex string of individual bytes. If I was writing hex dump programs, it might be.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
Santa Cruz Networks
|
|
|
|