davinder101
asked on
How to drag a dialog box derived from DHtmlDialog ?
Hi
I have created a dialogbox which is derived from CDHtmlDialog. My dialogbox don't have titlebar.
Because it is a DHtmlDialog box it contains a web page. Web page hase an Image looks like titlebar (Which is not a titlebar).
Now what I want is I want to drag my dialog by pressing this image (titlebar).
I tried to Override OnLButtonDown but control not going there. Why I don't know?
Aftre tring this I am able to drag my dialog by pressing on border only. Which is not my requirement.
UINT CDhtmldemoDlg::OnNcHitTest (CPoint point)
{
return HTCAPTION ;
}
Any suggestion ????
Thanks
I have created a dialogbox which is derived from CDHtmlDialog. My dialogbox don't have titlebar.
Because it is a DHtmlDialog box it contains a web page. Web page hase an Image looks like titlebar (Which is not a titlebar).
Now what I want is I want to drag my dialog by pressing this image (titlebar).
I tried to Override OnLButtonDown but control not going there. Why I don't know?
Aftre tring this I am able to drag my dialog by pressing on border only. Which is not my requirement.
UINT CDhtmldemoDlg::OnNcHitTest
{
return HTCAPTION ;
}
Any suggestion ????
Thanks
ASKER
Hi Raj,
Control is not going OnLButtonDown handler. Then how I'll set flag value?
Control is not going OnLButtonDown handler. Then how I'll set flag value?
can you post some code
Raj
Raj
ASKER
.CPP file my dialogbox is follows....
// DhtmldemoDlg.cpp : implementation file
//
#include "stdafx.h"
#include ".\dhtmldemodlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CAboutDlg dialog used for App About
// CDhtmldemoDlg dialog
BEGIN_DHTML_EVENT_MAP(CDht
END_DHTML_EVENT_MAP()
CDhtmldemoDlg::CDhtmldemoD
: CDHtmlDialog(CDhtmldemoDlg
{
EnableModeless(true);
m_hIcon = AfxGetApp()->LoadIcon(IDR_
}
void CDhtmldemoDlg::DoDataExcha
{
CDHtmlDialog::DoDataExchan
}
BEGIN_MESSAGE_MAP(CDhtmlde
ON_WM_SYSCOMMAND()
//}}AFX_MSG_MAP
ON_WM_CREATE()
ON_WM_LBUTTONDOWN()
ON_WM_NCHITTEST()
END_MESSAGE_MAP()
// CDhtmldemoDlg message handlers
int CDhtmldemoDlg::Create()
{
return CDHtmlDialog::Create(CDhtm
}
BOOL CDhtmldemoDlg::OnInitDialo
{
CDHtmlDialog::OnInitDialog
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
m_pBrowserApp->put_Registe
return true;
}
void CDhtmldemoDlg::OnLButtonDo
{
CRect rect;
GetClientRect(&rect);
PostMessage( WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM( point.x, point.y));
}
UINT CDhtmldemoDlg::OnNcHitTest
{
return HTCAPTION ;
//UINT uCode = CDialog::OnNcHitTest(point
//return uCode == HTCLIENT ? HTCAPTION : uCode;
}
ASKER
Hi,
I got solution.
BEGIN_DHTML_EVENT_MAP(CDht mldemoDlg)
// handle Button click event
DHTML_EVENT_TAG_ALL(DISPID _HTMLELEME NTEVENTS_O NMOUSEDOWN , OnPageMouseDown )
END_DHTML_EVENT_MAP()
I got solution.
BEGIN_DHTML_EVENT_MAP(CDht
// handle Button click event
DHTML_EVENT_TAG_ALL(DISPID
END_DHTML_EVENT_MAP()
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
also get the x y position of mouse and Set the window position by using "SetWindowPos" API
Raj