Article

From:
To:
All
Subject:
Property Sheets in Delphi [7, 2005]
Newsgroup:
borland.public.delphi.nativeapi.win32

Property Sheets in Delphi [7, 2005]

Hi.

Recently I realized that Windows uses Property Sheets to display its tabbed dialog boxes. I searched MSDN for Property Sheets and found this code to just create Property Sheet in my application (I turned it from C to Pascal):
procedure TwndMain.CreatePropertySheet; var psp: array [0..1] of PROPSHEETPAGE; psh: _PROPSHEETHEADER; begin psp[0].dwSize := sizeof(PROPSHEETPAGE); psp[0].dwFlags := PSP_USEICONID or PSP_USETITLE; psp[0].hInstance := HInstance; psp[0].pszTemplate := MAKEINTRESOURCE('DLG_1'); psp[0].pszIcon := MAKEINTRESOURCE('ICO_1'); psp[0].pfnDlgProc := @DlgProc; psp[0].pszTitle := MAKEINTRESOURCE('0'); psp[0].lParam := 0; psp[0].pfnCallback := nil;
psp[1].dwSize := sizeof(PROPSHEETPAGE); psp[1].dwFlags := PSP_USEICONID or PSP_USETITLE; psp[1].hInstance := HInstance; psp[1].pszTemplate := MAKEINTRESOURCE('DLG_2'); psp[1].pszIcon := MAKEINTRESOURCE('ICO_2'); psp[1].pfnDlgProc := @DlgProc; psp[1].pszTitle := MAKEINTRESOURCE('1'); psp[1].lParam := 0; psp[1].pfnCallback := nil;
psh.dwSize := sizeof(_PROPSHEETHEADER); psh.dwFlags := PSH_USEICONID or PSH_PROPSHEETPAGE; psh.hwndParent := Handle; psh.hInstance := HInstance; psh.pszIcon := MAKEINTRESOURCE('ICO_3'); psh.pszCaption := PChar('Cell Properties'); psh.nPages := sizeof(psp) div sizeof(PROPSHEETPAGE); psh.nStartPage := 0; psh.ppsp := @psp; psh.pfnCallback := nil;
PropertySheet(psh); end;
This code is the exact copy of that in MSDN, excluding the resource names. I have created all needed resources. The result of calling this procedure is an Access Violation. What am I (or Microsoft with its MSDN) doing wrong?
Thanks. Jean.
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Sun, 19 May 2024 22:38:05 UTC
Copyright © 2009-2024
HREF Tools Corp.