开发者

How to make a dialog movable?

开发者 https://www.devze.com 2023-02-14 12:59 出处:网络
I\'m starting out with win32 programming. I created my first dialog but I can\'t drag it around with my mouse; it simply stays where it is. Why?

I'm starting out with win32 programming.

I created my first dialog but I can't drag it around with my mouse; it simply stays where it is. Why?

This is its proc function:

static bool CALLBACK ChangeColumnProc(HWND dialog, uint32 message, WPARAM wParam, LPARAM lParam)
{
    static ColumnInfo *column = NULL;

    switch(message)
    {
        case WM_INITDIALOG:
            column = (ColumnInfo *)lParam;
            InitializeDialog(dialog, column);
            return true;
        case WM_COMMAND:
            switch(LOWORD(wParam))
            {
                case IDOK:
                    S开发者_StackOverflowaveChanges(dialog, column);
                    break;
                case IDCANCEL:
                    EndDialog(dialog, lParam);
                    break;
                default:
                    return false;
            }

            return true;
    }

    return false;
}

This is how I create it:

if(DialogBoxParam(StartupInfo.Instance, MAKEINTRESOURCE(IDD_CHANGE_COLUMN), StartupInfo.Window, (DLGPROC)ChangeColumnProc, (LPARAM)&column) == IDOK)

What am I doing wrong?


The return type of the dialog procedure is INT_PTR, not bool. Return (INT_PTR)FALSE if you don't handle the message.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号