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



davinder101Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Raj_KauCommented:
take a flage and make true when you press left button and again make false on lbutton up
also get the x y position of mouse and Set the window position by using "SetWindowPos" API

Raj
0
davinder101Author Commented:
Hi Raj,

Control is not going OnLButtonDown handler. Then how I'll set flag value?
0
Raj_KauCommented:
can you post some code

Raj
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

davinder101Author Commented:

 .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(CDhtmldemoDlg)

END_DHTML_EVENT_MAP()


CDhtmldemoDlg::CDhtmldemoDlg(CWnd* pParent /*=NULL*/)
      : CDHtmlDialog(CDhtmldemoDlg::IDD, CDhtmldemoDlg::IDH, pParent)
{
      EnableModeless(true);
      m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CDhtmldemoDlg::DoDataExchange(CDataExchange* pDX)
{
      CDHtmlDialog::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CDhtmldemoDlg, CDHtmlDialog)
      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(CDhtmldemoDlg::IDD) ;
}


BOOL CDhtmldemoDlg::OnInitDialog()
{
      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_RegisterAsDropTarget(VARIANT_FALSE);
      return true;
}

void CDhtmldemoDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
      CRect rect;
      GetClientRect(&rect);
      PostMessage( WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM( point.x, point.y));
}


UINT CDhtmldemoDlg::OnNcHitTest(CPoint point)
{
      return  HTCAPTION ;
      
      //UINT uCode = CDialog::OnNcHitTest(point);
      //return uCode == HTCLIENT ? HTCAPTION : uCode;
}



0
davinder101Author Commented:
Hi,

I got solution.

BEGIN_DHTML_EVENT_MAP(CDhtmldemoDlg)    
      // handle  Button click event
      DHTML_EVENT_TAG_ALL(DISPID_HTMLELEMENTEVENTS_ONMOUSEDOWN, OnPageMouseDown )
END_DHTML_EVENT_MAP()

0
GranModCommented:
PAQed with points refunded (200)

GranMod
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.