vc++ api question...........

hello folks,
i recently started playing with vc++ api for solidworks...
I have VC++ version 6.0 and SolidWorks 2001 plus...
i started with the solidworks add in app wizard which generated a skeleton application with a toolbar and a menu bar built in...
i tried to build a dialog box class which can be invoked from the toolbar and menu...however..the application hangs..immediately when the dialog box appears...
solidworks issues a message saying that solidworks has terminated due to an unhandled error...please contact your local support representative for help in troubleshooting this problem...
can anybody please tell me what the problem could be....
thanks in advance..
~sushil.
Add pictures here
โœ–
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

This is a welcome message. Welcome in the wonderful world of c++ api! Seriously, this happens in most cases when your program crashes or does something wrong, you'll see it many times... What you have to do is: 1) run your program in the Visual Studio Debugger. 2) check the "Exceptions" under the "Debug" menu (visible only while running the debugger) and set at least c00000005 "Access violation" to "Stop Always". It might help to find what's wrong 3) put all your code in try/catch statements to exit smoothly from your add-in if something goes wrong. Hopefully, SW will be able to continue after that. Good luck!
--
Philippe Guglielmetti - www.dynabits.com



Add pictures here
โœ–
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Found in the MSDN Library help about AFX_MANAGE_STATE By default, MFC uses the resource handle of the main application to load the resource template. If you have an exported function in a DLL, such as one that launches a dialog box in the DLL, this template is actually stored in the DLL module. You need to switch the module state for the correct handle to be used. You can do this by adding the following code to the beginning of the function:
AFX_MANAGE_STATE(AfxGetStaticModuleState( )); This swaps the current module state with the state returned from AfxGetStaticModuleState until the end of the current scope.
Example : void CTest::CreateAlias() { AFX_MANAGE_STATE(AfxGetStaticModuleState()); CDlgAlias dlg; dlg.DoModal(); }
It may correct your problem
P. Scanu http://www.atemi.fr

Add pictures here
โœ–
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Hi Pascal,
I tried it out...but this is what I am getting...
mfcs42.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in Boring1.obj mfcs42.lib(dllmodul.obj) : error LNK2005: __pRawDllMain already defined in Boring1.obj mfcs42.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in Boring1.obj; second definition ignored mfcs42.lib(dllmodul.obj) : warning LNK4006: __pRawDllMain already defined in Boring1.obj; second definition ignored Creating library Boring1___Win32_MBCS_Release/Boring1.lib and object Boring1___Win32_MBCS_Release/Boring1.exp Boring1___Win32_MBCS_Release/Boring1.dll : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe.
Boring1.dll - 3 error(s), 2 warning(s)
Is there anything that I am missing again...please help me out...
~Sushil.

Add pictures here
โœ–
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
you're linking the wrong MFC dlls. In project settings, C/C++ tab, select "Multithreaded DLL" under "Use run-time library". You must select this for all libs or dlls your project is using.
--
Philippe Guglielmetti - www.dynabits.com

"Sushil" < snipped-for-privacy@email.uc.edu> a ้crit dans le message de
  Click to see the full signature.
Add pictures here
โœ–
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.