Property Sheets

This is a discussion on Property Sheets within the Windows Programming forums, part of the Platform Specific Boards category; Does anybody have a tutorial on Property Sheets ? i can't find anyone except for MFC, i need win32 api ...

  1. #1
    rEtaRD r HUMANS TOO !!! rEtard's Avatar
    Join Date
    Feb 2005
    Posts
    80

    Property Sheets

    Does anybody have a tutorial on Property Sheets ? i can't find anyone except for MFC, i need win32 api one. Anyway this is what i came out with after reading MSDN propersheety example, but returned a fatal error.

    Code:
    void DoPropertySheet(HWND hwndOwner)
    {
        PROPSHEETPAGE psp;
        PROPSHEETHEADER psh;
        psp.dwSize = sizeof(PROPSHEETPAGE);
        psp.dwFlags = PSP_USEHICON;
        psp.hInstance = g_hinst;
        psp.pszTemplate = MAKEINTRESOURCE(IDD_DIALOG);
        psp.pfnDlgProc = DlgProc;
        psp.lParam = 0;
        psp.pfnCallback = NULL;
    
        psh.dwSize = sizeof(PROPSHEETHEADER);
        psh.dwFlags = PSH_USEHICON | PSH_PROPSHEETPAGE;
        psh.hwndParent = hwndOwner;
        psh.hInstance = g_hinst;
        psh.pszCaption = (LPSTR) "Cell Properties";
        psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
        psh.nStartPage = 0;
        psh.ppsp = (LPCPROPSHEETPAGE) &psp;
        psh.pfnCallback = NULL;
    
    	PropertySheet(&psh);
    }
    and compiler error returned

    Code:
    main.obj : error LNK2001: unresolved external symbol __imp__PropertySheetA@4
    Debug/Prop.exe : fatal error LNK1120: 1 unresolved externals
    Can someone help me out or could anybody do a veri simple property sheet example and show me ? just as a reference, the one MSDN offered is too vague, without resources, nth.
    /* Have a nice day */

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,662
    >> i can't find anyone except for MFC
    Property Sheet Reference

    You have to link with comctl32.lib and initialize the common controls DLL: Common Controls

    Use the TOC pane on the left for documentation on all the controls.

    gg
    Last edited by Codeplug; 07-20-2005 at 11:43 AM.

  3. #3
    rEtaRD r HUMANS TOO !!! rEtard's Avatar
    Join Date
    Feb 2005
    Posts
    80
    err codeplug, i got my property sheets reference from msdn, and it returned that error to me. can you tell me what does this mean and how should i link it?
    Code:
    You have to link with comctl32.lib and initialize the common controls DLL: Common Controls
    so do i #include <comctl32.lib> or wat ?
    /* Have a nice day */

  4. #4
    rEtaRD r HUMANS TOO !!! rEtard's Avatar
    Join Date
    Feb 2005
    Posts
    80
    Hey man, i know how to link to the *lib alreadi. THANZ !! and the property sheet is working fine.
    /* Have a nice day */

  5. #5
    rEtaRD r HUMANS TOO !!! rEtard's Avatar
    Join Date
    Feb 2005
    Posts
    80
    Can someone tell me, how to set my dialog position ? I used SetWindowPos and MoveWindow but it didn't work. ( my dialog box is the Parent/Main )
    /* Have a nice day */

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,662
    >> I used SetWindowPos and MoveWindow but it didn't work.
    Can you elaborate? Did the functions fail? What did GetLastError() return?

    Once you've added error checking, post the code.

    gg

  7. #7
    rEtaRD r HUMANS TOO !!! rEtard's Avatar
    Join Date
    Feb 2005
    Posts
    80
    CodePlug, i used SetWindowPos becoz they have a flag to restrict the size of my dialog changing and it returned 1402 - INVALID CURSOR HANDLE, what does it mean man.
    My code as below.
    Code:
    BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {
    	switch(Message)
    	{
    		case WM_INITDIALOG:
    			SetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_NOSIZE);
    			Call(GetLastError(),0);
    	     	break;
    		default:
    			return FALSE;
    	}
    	return TRUE;
    }
    /* Have a nice day */

  8. #8
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,662
    That's not error checking. SetWindowPos() returns a BOOL to indicate success or failure.

    That call to SetWindowPos() will position your dialog to the client coordinates (0,0) of the dialog's parent (the desktop in your case) and bring it to the top of the Z-order. Is that what you want to do?

    gg

  9. #9
    rEtaRD r HUMANS TOO !!! rEtard's Avatar
    Join Date
    Feb 2005
    Posts
    80
    yeap, but the function didn't work. I meant the GetLastError() returned 1402
    /* Have a nice day */

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Closing Property Sheets - PSM_GETCURRENTPAGEHWND Test
    By Tonto in forum Windows Programming
    Replies: 1
    Last Post: 05-07-2007, 07:22 AM
  2. tabs VS property sheets
    By axr0284 in forum Windows Programming
    Replies: 7
    Last Post: 01-11-2005, 12:49 AM
  3. WinApi - Property Sheets
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 06-13-2002, 02:32 PM
  4. Property Sheets :: MFC
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 05-09-2002, 03:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21