Hi,

I'm working on an add-in application to a CAD program. It's a DLL that adds a menu item on the CAD program's menu bar.
When the menu item is selected, a main dialog box is created to allow for user interaction. This works fine.

My problem arises when I try to build my application as a dialog-based executable that spawns the CAD program in the background.
I derived my main app class from the CWinApp class and do all the setting up in the InitInstance method. When I try to run the
executable, it crashes while in the constructor because the AfxGetThread and AfxGetApp functions both return a NULL pointer
and the InitInstance method of the current thread, which is NULL, is invoked in AfxWinMain.

Can anyone provide any suggestions on the cause of the problem and/or possible fixes? Thanks in anticipation for any assistance

Ken Soh