RE: Visual Studio 2005 with SP1 Issue
"sgOrchid" wrote:
I have an application which loads the Property Pages from another DLL.
In First Propertypage I have a timer which runs every 5000/1000 mille
seconds and query USB port to find one of the status of unit connected.
If I build this application in Visual Studio 2003 (installed in XP) and run
the binary in Vista it works fine.
If I build this application in VS2005 with SP1 & Vista patch installed in
Vista Machine, I get an assert. When I debug the application, in one place
there is a comment from Microsoft (Windows code)
"Warning: Creating dialog from within a COleControlModule application is not
a supported scenario"
My code as follows
BOOL ToolboxPluginDlg::OnInitDialog()
{
CDialog::OnInitDialog();
DrawDialog();
CToolboxIni theIniCls;
BOOL bRun = (BOOL)(theIniCls.GetNumber(STATUSMONITOR, RUNSTATUSMONITOR, 0,
m_pToolboxCfg->GetPortType(),
m_pToolboxCfg->GetIniFile()
));
SetStatusMonitorRunning(bRun);
if (m_bRunStatusMonitor)
{ m_pStatusMonitor = new CStatusMonitor(IDD_ERROR_DIALOG, m_pToolboxCfg,
m_sPluginSectionName, this);
m_pStatusMonitor->Create(IDD_ERROR_DIALOG, NULL); // this line throws an
assert.
if(m_pToolboxCfg->GetPortType() == PortNetwork)
{
m_pStatusMonitor->Start(5000);
}else
m_pStatusMonitor->Start(1000);
}
return TRUE;
}
The problem looks like VS2005 generated code. If I create Dialog using
DoModal() it works fine.
I am not sure what is the real cause.
Thanks in advance for your help
If I install with out VS2005 SP1, with out Vista Patch in Vista OS and create
binary in Debug mode, it works fine. If I create binary in release mode
application terminates. I have investigated why this termination occurs.
While application starts I call the following function to find executable
file path
AString FileUtil::GetModuleFileName(HMODULE hModule)
{
TCHAR szFileName[MAX_PATH] = TEXT("");
::GetModuleFileName(hModule, szFileName, ARRAY_SIZE(szFileName));
return szFileName;
}
This function is called with NULL parameter. If it is run in Debug mode, the
szFileName contains actual path and file name. If I run in Release mode, the
szFileName has four null characters followed by ActualPath and FileName.
I am lost with no clue. I appreciate if some one can help.
Thanks