目前共有4篇帖子。 內容轉換:不轉換▼
 
點擊 回復
454 3
我正在研究Property Sheet
一派護法 十九級
1樓 發表于:2016-2-19 16:38
一派護法 十九級
2樓 發表于:2016-2-19 16:38
#include <tchar.h>
#include <Windows.h>
#include <CommCtrl.h>
#include <Prsht.h>
#include "resource.h"

#pragma comment(lib, "Comctl32.lib")
#pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

INT_PTR CALLBACK DlgProc1(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    HWND hwndParent = GetParent(hDlg);
    switch (uMsg)
    {
    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDC_BUTTON1:
            SetDlgItemText(hDlg, IDC_EDIT1, TEXT("You clicked me."));
            EnableWindow((HWND)lParam, FALSE);
            SetWindowText(hwndParent, TEXT("Parent"));
            //PropSheet_Apply(hwndParent);
            PropSheet_CancelToClose(hwndParent);
            break;
        case IDC_BUTTON2:
            PropSheet_Changed(hwndParent, hDlg);
            break;
        }
        break;
    case WM_NOTIFY:
        if (((LPNMHDR)lParam)->code == PSN_APPLY)
        {
            //MessageBox(hwndParent, TEXT("a"), TEXT("b"), MB_ICONWARNING);
            //PropSheet_RebootSystem(hwndParent);
        }
        break;
    }
    return FALSE;
}

INT_PTR CALLBACK DlgProc2(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    return FALSE;
}

int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
    PROPSHEETPAGE page[2];
    page[0].dwSize = sizeof(PROPSHEETPAGE);
    page[0].dwFlags = PSP_USEICONID | PSP_USETITLE;
    page[0].hInstance = hInstance;
    page[0].pszTemplate = MAKEINTRESOURCE(IDD_DIALOG1);
    page[0].pszIcon = IDI_APPLICATION;
    page[0].pfnDlgProc = DlgProc1;
    page[0].pszTitle = TEXT("常规");
    page[0].lParam = 0;
    page[0].pfnCallback = NULL;
    page[1].dwSize = sizeof(PROPSHEETPAGE);
    page[1].dwFlags = PSP_USEICONID | PSP_USETITLE;
    page[1].hInstance = hInstance;
    page[1].pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_LARGE);
    page[1].pszIcon = IDI_ERROR;
    page[1].pfnDlgProc = DlgProc2;
    page[1].pszTitle = TEXT("高级");
    page[1].lParam = 0;
    page[1].pfnCallback = NULL;

    PROPSHEETHEADER psh;
    psh.dwSize = sizeof(PROPSHEETHEADER);
    psh.dwFlags = PSH_USEICONID | PSH_PROPSHEETPAGE;
    psh.hwndParent = NULL;
    psh.hInstance = hInstance;
    psh.pszCaption = TEXT("属性窗口");
    psh.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    psh.nPages = 2;
    psh.nStartPage = 0;
    psh.ppsp = page;
    psh.pfnCallback = NULL;

    PropertySheet(&psh);

    return 0;
}
一派護法 十九級
3樓 發表于:2016-2-19 16:51
Simpler:

#include <tchar.h>
#include <Windows.h>
#include <CommCtrl.h>
#include <Prsht.h>
#include "resource.h"

#pragma comment(lib, "Comctl32.lib")
#pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

INT_PTR CALLBACK DlgProc1(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    HWND hwndParent = GetParent(hDlg);
    switch (uMsg)
    {
    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDC_BUTTON1:
            SetDlgItemText(hDlg, IDC_EDIT1, TEXT("You clicked me."));
            EnableWindow((HWND)lParam, FALSE);
            SetWindowText(hwndParent, TEXT("Parent"));
            //PropSheet_Apply(hwndParent);
            PropSheet_CancelToClose(hwndParent);
            break;
        case IDC_BUTTON2:
            PropSheet_Changed(hwndParent, hDlg);
            break;
        }
        break;
    case WM_NOTIFY:
        if (((LPNMHDR)lParam)->code == PSN_APPLY)
        {
            //MessageBox(hwndParent, TEXT("a"), TEXT("b"), MB_ICONWARNING);
            //PropSheet_RebootSystem(hwndParent);
        }
        break;
    }
    return FALSE;
}

INT_PTR CALLBACK DlgProc2(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    return FALSE;
}

int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
    PROPSHEETPAGE psp[2];
    psp[0].dwSize = sizeof(PROPSHEETPAGE);
    psp[0].dwFlags = PSP_USETITLE;
    psp[0].hInstance = hInstance;
    psp[0].pszTemplate = MAKEINTRESOURCE(IDD_DIALOG1);
    psp[0].pfnDlgProc = DlgProc1;
    psp[0].pszTitle = TEXT("常规");
    psp[1].dwSize = sizeof(PROPSHEETPAGE);
    psp[1].dwFlags = PSP_USETITLE;
    psp[1].hInstance = hInstance;
    psp[1].pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_LARGE);
    psp[1].pfnDlgProc = DlgProc2;
    psp[1].pszTitle = TEXT("高级");

    PROPSHEETHEADER psh;
    psh.dwSize = sizeof(PROPSHEETHEADER);
    psh.dwFlags = PSH_USEICONID | PSH_PROPSHEETPAGE;
    psh.hwndParent = NULL;
    psh.hInstance = hInstance;
    psh.pszCaption = TEXT("属性窗口");
    psh.nPages = 2;
    psh.nStartPage = 0;
    psh.ppsp = psp;
    psh.pfnCallback = NULL;

    PropertySheet(&psh);
    return 0;
}
一派護法 十九級
4樓 發表于:2016-2-22 20:09
如果使用普通的tab控件,则需要不停的ShowWindow

回復帖子

內容:
用戶名: 您目前是匿名發表
驗證碼:
(快捷鍵:Ctrl+Enter)
 

本帖信息

點擊數:454 回複數:3
評論數: ?
作者:巨大八爪鱼
最後回復:巨大八爪鱼
最後回復時間:2016-2-22 20:09
 
©2010-2024 Arslanbar Ver2.0
除非另有聲明,本站採用創用CC姓名標示-相同方式分享 3.0 Unported許可協議進行許可。