We have a drawing control program that allows a user to view a drawing file using the program associated with the DWG extension on the PC. In this case the program associated with the DWG extension is DWG TrueView 2014. To lauch the program we use the ShellExecute function to execute the selected the drawing file which causes Windows to launch the program associated with DWG extension. Here is the function call we use.
HINSTANCE hInst = ShellExecute(NULL, szOperation, szDocName, NULL, NULL, nShowCmd);
Where
Operation = "open"
szDocName = drawing filename
nShowCmd = SW_SHOW
Using ths function Windows launches the DWG TrueView 2014 program; however, DWG TrueView generates an error message indicating that is can't load the AcSceneOE.dbx file in the calling program's directory which is understandable because the drawing control program does not have the DWG TrueView files.
The ShellExecute function does provide a way to specified the default working directory but at the time the function is called we have not idea what that directory may be because we don't know what program is associated with the DWG extension.
Note: If AutoCAD is associated with DWG, we have no problems.
Is there anyway to get DWG TrueView to look for its files in its own directory instead of the currect working directroy?