PDA

View Full Version : Crash at runtime with SECDialogBars



jipihorn
07-15-2013, 01:21 AM
Hello,

We started to upgrade our application to Visual 2012 and Stingray Studio 11.1 and , after porting the code, I couldn't execute the application at all. So I tried the sample project viz11 provided.

I get exactly the same kind of error :

At line 213 of mainframe.cpp, the create() call crashes the same way it does with our application when using SECDialogbar derivated classes, whatever the platform is (x64, x32, debug, unicode...) at the same final win32 call (CreateWindowEx in Winuser.inl). This is from a call to CControlBar::Create() into the sbarcode.cpp source, line 333. The crash seems to be caused by the lpszWindowName that is set to a MAKEINTRESOURCE() kind of value instead of a string. This pointer has the 0x82 value of IDD_LOGO ID and the final crash is an access violation of this value used as a string.

I'm stuck here without any way to find a solution.
Visual studio 2012 is the update 3 version.

J.

CodeMonkey
11-06-2014, 11:16 AM
I would recommend doing this in a handler for the WM_INITDIALOG message.
The SECDialogBar base class has an implementation called HandleInitDialog().
Here's a quick sample of how to put together the correct declarations for the message map.
It's a good place to subclass controls and call UpdateData(), if you're doing any DDX.

// in the header file for say, CMyDialogBar
protected:
afx_msg LRESULT HandleInitDialog(WPARAM, LPARAM);


//in the implementation file, say CMyDialogBar.cpp

BEGIN_MESSAGE_MAP(CMyDialogBar, SECDialogBar)
//{{AFX_MSG_MAP(CMyDialogBar)
ON_MESSAGE(WM_INITDIALOG, HandleInitDialog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

LRESULT CMyDialogBar::HandleInitDialog(WPARAM wParam, LPARAM lParam)
{
LRESULT lRes = SECDialogBar::HandleInitDialog(wParam, lParam);
UpdateData(FALSE);
return lRes;
}