⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basedialog.cpp

📁 media player 控件源码 用EVC编译可以进行对WINCE下media player控制
💻 CPP
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
///////////////////////////////////////////////////////////////////////////////
// File: BaseDialog.cpp
//
// Desc: This file contains the implementation for the CBaseDialog class,
//       which is the base class for all of the playlist dialogs.
//
///////////////////////////////////////////////////////////////////////////////

#include    "BaseDialog.h"

HWND g_hwndActiveDlg = NULL;

//////////////////////////////////////////////////////////////////////////////
CBaseDialog::CBaseDialog(HWND hwndParent, int nDialogResID) :
    m_hwndDlg       ( NULL ),
    m_hwndParent    ( hwndParent ),
    m_nDialogResID  ( nDialogResID )
{
}

    
//////////////////////////////////////////////////////////////////////////////
int CBaseDialog::DoModal()
{
    HWND    hwndPrevDlg = g_hwndActiveDlg;

    int res = DialogBoxParam(g_hInst,
                             MAKEINTRESOURCE(m_nDialogResID),
                             m_hwndParent,
                             DlgProc,
                             (LPARAM) this);

    g_hwndActiveDlg = hwndPrevDlg;

    return( res );
}

HWND CBaseDialog::DoModeless( HWND hwndParent )
{
    m_hwndParent = hwndParent;
    HWND hwnd = CreateDialogParam( g_hInst, MAKEINTRESOURCE(m_nDialogResID), m_hwndParent, DlgProc, (LPARAM)this);

    return( hwnd );
}



//////////////////////////////////////////////////////////////////////////////
BOOL CALLBACK CBaseDialog::DlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch( msg )
    {
     case WM_DESTROY:
        break;

     case WM_COMMAND:
        break;

     case WM_INITDIALOG:
        //
        // Remember this topmost dialog's handle
        //
        g_hwndActiveDlg = hwndDlg;

        //
        // Preserve the 'this' pointer in the window's user data
        //
        CBaseDialog *pBaseDlg   = (CBaseDialog *) lParam;

        pBaseDlg->SetHwnd(hwndDlg);

        SetLastError(0);

        LONG    lResult = SetWindowLong(hwndDlg, GWL_USERDATA, (LONG) pBaseDlg);

        if (0 == lResult)
        {
            DWORD   dwError = GetLastError();
            if (0 != dwError)
            {
                EndDialog(hwndDlg, -1);
                return  TRUE;
            }
        }
        break;
    }

    //
    // Get the 'this' pointer from the window's user data
    //
    CBaseDialog *pBaseDlg   = (CBaseDialog *) GetWindowLong(hwndDlg, GWL_USERDATA);
    if (NULL == pBaseDlg)
    {
        return  FALSE;
    }
    else
    {
        return  pBaseDlg->DialogProc(msg, wParam, lParam);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -