quote:
Originally posted by cdrozdowski111
OriginPro 9.1 SR1 64-bit/32-bit, Win7 Pro 64-bit, running in VMware Fusion 5.0.4
I am developing a resource DLL-based dialog that inherits from the Dialog class.
How can I prevent the automatic storage of the dialog size and screen position in Origin?
As I am developing, I'm changing the size of the dialog in VC++ but the size of the dialog remains at the "old" size from last time I ran it in Origin.
Here's an example of prevent the automatic storage of the dialog size and screen position: delete the value in OnDestroy(). To do so, you should know the Dialog Name, which can be set in OnInitDialog(), and OnRestoreSize().
#include <Origin.h>
#include <dialog.h>
#include <..\originlab\ResizeDialog.h>
#include "resource.h" // .h
#define STR_DLG_NAME "DialogName"
class MyDlg : public ResizeDialog
{
public:
MyDlg() : ResizeDialog(IDD_DIALOG1, "dlgsizepos") // .dll
{
}
int DoModal(HWND hParent = NULL)
{
InitMsgMap();
return ResizeDialog::DoModal(hParent);
}
protected:
EVENTS_BEGIN
ON_INIT( OnInitDialog )
ON_DESTROY( OnDestroy )
ON_RESTORESIZE( OnRestoreSize )
EVENTS_END
BOOL OnInitDialog()
{
ResizeDialog::OnInitDialog(0, STR_DLG_NAME);
return TRUE;
}
BOOL OnDestroy()
{
/* value delete */
Registry reg(HKEY_CURRENT_USER);
string strKey = GetRegKey() + "\\Dialogs\\" + STR_DLG_NAME;
reg.DelValue(strKey, "Position");
return ResizeDialog::OnDestroy();
}
BOOL OnRestoreSize(ODWP dwSizeInfo)
{
void * p = (void*)dwSizeInfo;
DLGSIZEINFO *pSz = (DLGSIZEINFO*)p;
lstrcpyn(pSz->szDialogName, STR_DLG_NAME, MAXLINE);
/* here, you specify the size and position */
pSz->top = 100;
pSz->left = 150;
pSz->width = -1;
pSz->height = -1;
return TRUE;
}
};
int dlgDelReg()
{
MyDlg dlg;
dlg.DoModal( GetWindow() );
return 0;
}
Edit: Be the Border Resizing or not, you can use ResizeDialog here.