Click here to Skip to main content
15,937,861 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionNeed information how to do screen scraping in windows using VC++/C++ Pin
John50213-Apr-10 20:55
John50213-Apr-10 20:55 
AnswerRe: Need information how to do screen scraping in windows using VC++/C++ Pin
Hadi Dayvary14-Apr-10 3:20
professionalHadi Dayvary14-Apr-10 3:20 
AnswerRe: Need information how to do screen scraping in windows using VC++/C++ Pin
ThatsAlok14-Apr-10 19:32
ThatsAlok14-Apr-10 19:32 
GeneralRe: Need information how to do screen scraping in windows using VC++/C++ Pin
John50220-Apr-10 3:41
John50220-Apr-10 3:41 
QuestionMoving controls within the dialog. Pin
shiv@nand13-Apr-10 19:41
shiv@nand13-Apr-10 19:41 
AnswerRe: Moving controls within the dialog. Pin
Emilio Garavaglia13-Apr-10 20:43
Emilio Garavaglia13-Apr-10 20:43 
AnswerRe: Moving controls within the dialog. Pin
CPallini13-Apr-10 20:45
mveCPallini13-Apr-10 20:45 
AnswerRe: Moving controls within the dialog. Pin
Iain Clarke, Warrior Programmer13-Apr-10 20:55
Iain Clarke, Warrior Programmer13-Apr-10 20:55 
Well, what's actually stopping you?

I can see a few steps:

First, you need this to toggle on and off. If it was on all the time, anyone using this dialog will hate you. "I just tried to press OK, but the damn button keeps moving!"

You'll need to subclass your button(s), and override WM_LBUTTONDOWN,WM_MOUSEMOVE,WM_LBUTTONUP. For the button messages, either pass them on as normal, or toggle a "I'm dragging flag". In the mouse button, subtract the current position from the last position, and move the window by that much. Something like:
void CMyMovableButton::OnMouseMove (UINT fFlags, CPoint ptMouse)
{
    // Translate point into parent coords
    if (m_bDragging) // toggles in OnLButtonDown/Up
    {
        CWnd *pParent = GetParent ();
        // Translate coords to parent coords.
        MapWindowPoints (pParent, &ptMouse, 1);
        CPoint ptDelta = ptMouse - m_ptMouseLast; // you did save the lbutton down position, I hope!
        MoveWindow (ptDelta.x, ptDelta.y);
        SetWindowPos (NULL, ptDelta.x, ptDelta.y, 0,0, SWP_NOSIZE | SWP_NOZORDER);
        m_ptMouseLast = ptMouse;
    }
    else
        __super::OnMouseMove (fFlags, ptMouse);
}


You'll also need to store all your window positions when the dialog closes (or store them whenever a control has finished moving) so that you can use that information next time the dialog is used. Maybe make structure full of CPOints (ie, ptOKButton, ptCancelButton) and save that in the registry for use in you CMyMovableDlg::OnInitDialog function?


You might also want to look at CDiagramEditor - DIY vector and dialog editor[^] for an alternate way of doing all this.


It sounds like you have a lot of work ahead of you - and I know no shortcut. I hope you have a strong business case for this, and not just "wouldn't it be cool?"

Maybe when you're done, you could write an article based on it?

Good luck,

Iain.
I have now moved to Sweden for love (awwww).

AnswerRe: Moving controls within the dialog. Pin
SandipG 13-Apr-10 21:00
SandipG 13-Apr-10 21:00 
QuestionHow do i change the column position of list view Pin
arun_pk13-Apr-10 19:23
arun_pk13-Apr-10 19:23 
AnswerRe: How do i change the column position of list view Pin
CPallini13-Apr-10 21:51
mveCPallini13-Apr-10 21:51 
AnswerRe: How do i change the column position of list view Pin
Niklas L13-Apr-10 22:19
Niklas L13-Apr-10 22:19 
GeneralRe: How do i change the column position of list view Pin
arun_pk13-Apr-10 23:15
arun_pk13-Apr-10 23:15 
Questionremove space for title at top of groupbox? Pin
permutations13-Apr-10 12:04
permutations13-Apr-10 12:04 
AnswerRe: remove space for title at top of groupbox? Pin
David Crow14-Apr-10 3:32
David Crow14-Apr-10 3:32 
GeneralRe: remove space for title at top of groupbox? Pin
permutations14-Apr-10 4:14
permutations14-Apr-10 4:14 
GeneralRe: remove space for title at top of groupbox? Pin
David Crow14-Apr-10 4:25
David Crow14-Apr-10 4:25 
QuestionWindows Explorer extension Pin
o m n i13-Apr-10 10:58
o m n i13-Apr-10 10:58 
AnswerRe: Windows Explorer extension Pin
«_Superman_»13-Apr-10 11:04
professional«_Superman_»13-Apr-10 11:04 
GeneralRe: Windows Explorer extension Pin
o m n i13-Apr-10 11:39
o m n i13-Apr-10 11:39 
QuestionVisual Studio 6.0 to Visual Studio 2008 Issue Pin
djcouture13-Apr-10 9:23
djcouture13-Apr-10 9:23 
AnswerRe: Visual Studio 6.0 to Visual Studio 2008 Issue Pin
Joe Woodbury13-Apr-10 9:38
professionalJoe Woodbury13-Apr-10 9:38 
GeneralRe: Visual Studio 6.0 to Visual Studio 2008 Issue Pin
djcouture13-Apr-10 10:23
djcouture13-Apr-10 10:23 
GeneralRe: Visual Studio 6.0 to Visual Studio 2008 Issue Pin
Emilio Garavaglia13-Apr-10 20:48
Emilio Garavaglia13-Apr-10 20:48 
Questionhow can ı change some of ascii table characters Pin
can-inlife13-Apr-10 9:07
can-inlife13-Apr-10 9:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.