Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Sun, 16 Dec 2007 18:27:20 -0800 (PST),    group: microsoft.public.platformsdk.ui_shell        back       


Adding a simple page to the property sheet   
Hello,

I'm trying to do a simple thing that i cant seem to put it to work.

I'm trying to add a new page to my property sheet shell extension. In
my IShellPropSheetExt::AddPages i do the following:
PROPSHEETPAGE  psp;
    HPROPSHEETPAGE hPage;
    TCHAR          szPageTitle[MAX_PATH] = _T("Teste");

    // Set up the PROPSHEETPAGE struct.
    ZeroMemory ( &psp, sizeof(PROPSHEETPAGE) );

    psp.dwSize      = sizeof(PROPSHEETPAGE);
    psp.dwFlags     = PSP_USEREFPARENT | PSP_USETITLE | PSP_DEFAULT |
        PSP_USEICONID | PSP_USECALLBACK;
    psp.hInstance   = _AtlModule.m_hResInstance;
    psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_MAIN1);
    psp.pszIcon     = MAKEINTRESOURCE(IDI_ICON_BITS);
    psp.pszTitle    = szPageTitle;
    psp.pfnDlgProc  = PropPageDlgProc;
    psp.lParam      = (LPARAM) NULL;
    psp.pfnCallback = PropPageCallbackProc;
    psp.pcRefParent = (UINT*) &_AtlModule.m_nLockCnt;

    // Create the page & get a handle.
    hPage = CreatePropertySheetPage ( &psp );

After this i already try to do everithing to add a new page to the
property sheet that i already create, i've tried to add it after this
call, after the WM_INITDIALOG posting a user message to the property
sheet and on this message handler do something like this:
PROPSHEETPAGE  psp;
        TCHAR          szPageTitle[MAX_PATH] = _T("42334");

        // Set up the PROPSHEETPAGE struct.
        ZeroMemory ( &psp, sizeof(PROPSHEETPAGE) );

        psp.dwSize      = sizeof(PROPSHEETPAGE);
        psp.dwFlags     = PSP_USETITLE | PSP_USEICONID;
        psp.hInstance   = _AtlModule.m_hResInstance; //
_Module.GetResourceInstance();
        psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_MAIN);
        psp.pszIcon     = MAKEINTRESOURCE(IDI_ICON_BITS);
        psp.pszTitle    = szPageTitle;
        psp.pfnDlgProc  = PropPageDlgProc2;
        psp.lParam      = (LPARAM) NULL;

        HPROPSHEETPAGE hp=CreatePropertySheetPage ( &psp );

        BOOL bRES=::SendMessage((HWND)hPage,PSM_ADDPAGE,0,(LPARAM)hp);

But with no success, PSM_ADDPAGE message always give me FALSE!!

What i'm doing wrong?

Nuno
date: Sun, 16 Dec 2007 18:27:20 -0800 (PST)   author:   Nuno

Re: Adding a simple page to the property sheet   
On Dec 17 2007, 7:27 am, Nuno  wrote:
> Hello,
>
> I'm trying to do a simple thing that i cant seem to put it to work.
>
> I'm trying to add a new page to my property sheet shell extension. In
> my IShellPropSheetExt::AddPages i do the following:
> PROPSHEETPAGE  psp;
>     HPROPSHEETPAGE hPage;
>     TCHAR          szPageTitle[MAX_PATH] = _T("Teste");
>
>     // Set up the PROPSHEETPAGE struct.
>     ZeroMemory ( &psp, sizeof(PROPSHEETPAGE) );
>
>     psp.dwSize      = sizeof(PROPSHEETPAGE);
>     psp.dwFlags     = PSP_USEREFPARENT | PSP_USETITLE | PSP_DEFAULT |
>         PSP_USEICONID | PSP_USECALLBACK;
>     psp.hInstance   = _AtlModule.m_hResInstance;
>     psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_MAIN1);
>     psp.pszIcon     = MAKEINTRESOURCE(IDI_ICON_BITS);
>     psp.pszTitle    = szPageTitle;
>     psp.pfnDlgProc  = PropPageDlgProc;
>     psp.lParam      = (LPARAM) NULL;
>     psp.pfnCallback = PropPageCallbackProc;
>     psp.pcRefParent = (UINT*) &_AtlModule.m_nLockCnt;
>
>     // Create the page & get a handle.
>     hPage = CreatePropertySheetPage ( &psp );
>
> After this i already try to do everithing to add a new page to the
> property sheet that i already create, i've tried to add it after this
> call, after the WM_INITDIALOG posting a user message to the property
> sheet and on this message handler do something like this:
> PROPSHEETPAGE  psp;
>         TCHAR          szPageTitle[MAX_PATH] = _T("42334");
>
>         // Set up the PROPSHEETPAGE struct.
>         ZeroMemory ( &psp, sizeof(PROPSHEETPAGE) );
>
>         psp.dwSize      = sizeof(PROPSHEETPAGE);
>         psp.dwFlags     = PSP_USETITLE | PSP_USEICONID;
>         psp.hInstance   = _AtlModule.m_hResInstance; //
> _Module.GetResourceInstance();
>         psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_MAIN);
>         psp.pszIcon     = MAKEINTRESOURCE(IDI_ICON_BITS);
>         psp.pszTitle    = szPageTitle;
>         psp.pfnDlgProc  = PropPageDlgProc2;
>         psp.lParam      = (LPARAM) NULL;
>
>         HPROPSHEETPAGE hp=CreatePropertySheetPage ( &psp );
>
>         BOOL bRES=::SendMessage((HWND)hPage,PSM_ADDPAGE,0,(LPARAM)hp);
>
> But with no success, PSM_ADDPAGE message always give me FALSE!!
>
> What i'm doing wrong?
>
> Nuno


Hi Nuno

Addpages takes two parameters as follows : -

 1) LPFNADDPROPSHEETPAGE lpfnAddPageProc
 2) LPARAM lParam

after creating property page the way you are creating..

>         HPROPSHEETPAGE hp=CreatePropertySheetPage ( &psp );

you should call shell call back function as follows ..

if ( !lpfnAddPageProc(hp, lParam) )
{
return E_FAIL;
}
else
{
return S_OK;
}

thanks,

Rajendersaini
date: Sun, 6 Jan 2008 01:56:26 -0800 (PST)   author:   unknown

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us