目前共有4篇帖子。 内容转换:不转换▼
 
点击 回复
439 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)
 

本帖信息

点击数:439 回复数:3
评论数: ?
作者:巨大八爪鱼
最后回复:巨大八爪鱼
最后回复时间:2016-2-22 20:09
 
©2010-2024 Arslanbar Ver2.0
除非另有声明,本站采用知识共享署名-相同方式共享 3.0 Unported许可协议进行许可。