The invention generally relates to computer user interfaces (UIs) and to creation of user interfaces. More specifically, embodiments of this invention relate to dialog UIs and to programming interfaces allowing software developers to more conveniently create such dialogs.
The use of dialogs as part of a computer's graphical user interface (GUI) is known. As used herein, a “dialog” includes a window or other portion of a graphical computer display which appears in order to communicate information from a computer program and/or obtain information from the user. In some cases, a series of dialogs may be used to guide a user through a series of related tasks. A familiar example is the “wizard” concept used in various versions of the WINDOWS operating system (available from Microsoft Corporation of Redmond, Wash.). When installing a new application program on a computer, for example, an “installation wizard” is frequently employed. A first dialog of the wizard may inform a user that new software is about to be installed. That dialog may display a license agreement for the software in a scrolling text box and ask the user to agree to the terms of that license. The first dialog may include graphical buttons which the user can select to either accept the terms of the license (and proceed with installation) or reject the license (and thereby cancel the installation process). If the user selects the appropriate response in the first dialog (e.g., accepting the license), the first dialog disappears and a second dialog is displayed. The second dialog may ask the user for information needed for installing the program (e.g., the directory location for storing the program), after which third and subsequent dialogs may appear.
Whether implemented as a wizard or in some other manner, successive dialogs for related tasks can provide an efficient user interface. A well-designed series of such dialogs allows a user to quickly and efficiently understand what the computer is typing to do and what input is needed for each of the related tasks. In some cases, one of the dialogs in the series may be quite complicated and require multiple inputs. Returning to the program installation example from above, one of the dialogs may list a number of program components. That dialog may then give the user the option of selecting some components for full installation on the hard drive, selecting some components for partial installation (i.e., such that a CD must be inserted to use a partially installed component), or not installing some components at all. Even in such a circumstance, however, a well designed dialog will make it clear to the user what is needed and what the impact may be of the choices made.
Unfortunately, dialogs for a series of tasks are often poorly designed by software developers. In some cases, a user may be presented with a dialog having a large number of input options, but not given any guidance as to what the true objective may be. Consistency across multiple dialogs within the same series of dialogs is also an area of concern. If dialogs within the same series have a similar layout and appearance, a user can quickly learn where to look in each dialog to determine what is needed. If individual dialogs within a series have different layouts or are otherwise dissimilar in appearance, however, a user can become disoriented. Similar concerns exist with regard to dialogs that may be generated by different programs. In many environments, a single computer will often have software from numerous sources. One company may develop the operating system (OS), while other companies may develop individual application programs. The OS and other programs executing on the computer may all generate series of dialogs to guide a user through related tasks. If dialogs from all of these programs have a similar design, the user becomes accustomed to a general dialog format and learns where to look in each dialog for important information. If the dialogs have different layouts and are otherwise not consistent in how they communicate information and seek user input, the user may be required to spend more time studying each dialog.
In part to promote consistent dialog design, various guidelines have been promulgated. Unfortunately, software developers frequently fail to observe such guidelines. Developers may be unaware of or not fully understand the guidelines, or may simply be unwilling to follow them.
Many problems with dialog design are partly attributable to the existing tools available to software developers for creating a UI having a multiple dialogs. In particular, many existing systems require a software developer to create each individual dialog of a series from scratch. Maintaining consistency and good design practices across each individual dialog of the series can thus be time consuming and tedious. Even if a developer does create a consistent set of dialogs, however, those dialogs may not be consistent with those created by developers of other programs. For these and other reasons, there remains a need for methods and systems to assist software developers in creating better dialog user interfaces.
Embodiments of the invention address these and other challenges. In at least some embodiments, one or more task page dialogs are created in response to a request from an application program. The task page dialogs are housed within a frame. Each task page includes a header region and a content region. The header region includes a title which can serve as a main instruction to the user regarding what input is expected within the content region. The content region includes text and/or user interface controls as defined by the application program requesting creation of the task page. A task page may also contain a footer region having button controls for a user to indicate that he or she has completed the task page (e.g., a “next” or “finish” button) and/or to terminate the task (or series of tasks) with which the page is associated.
In certain embodiments, an application program requests creation of a task page by calling a programming interface function. Included in the function call are data (or references to data) for each of one or more pages. As to each page, the data includes an indication of the main instruction for inclusion in the header region, as well as data indicative of the content for inclusion in the content region. In at least some embodiments, UI controls defined using pre-existing methods are packaged in the content region of a task page. A series of task pages are created using a collection of data structures corresponding to each of the pages in the series. Each of the page structures is in turn referenced by a sheet data structure. The sheet data structure is then referenced when accessing the programming interface to request generation of the task pages.
The foregoing summary of the invention, as well as the following detailed description of illustrative embodiments, is better understood when read in conjunction with the accompanying drawings, which are included by way of example, and not by way of limitation with regard to the claimed invention.
The following detailed description is divided into three parts. Part I describes an example of a computer system environment in which embodiments of the invention may be implemented. Part II describes examples of at least some programming interfaces which can be used to implement embodiments of the invention. Part III describes embodiments of task page dialog user interfaces (UIs) and methods for implementing task page dialogs.
I. Example Computing System Environment
The invention is operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well known computing systems, environments and/or configurations that may be suitable for use with the invention include, but are not limited to, personal computers, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, minicomputers, and the like. The invention is described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types.
With reference to
Computer 1 typically includes a variety of computer readable media. Computer readable media can be any available media that can be accessed by computer 1 and includes both volatile and nonvolatile media, removable and non-removable media. By way of example, and not limitation, computer readable media may include computer storage media and communication media. Computer storage media includes volatile and nonvolatile, and removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by computer 1. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared and other wireless media. Combinations of the any of the above should also be included within the scope of computer readable media.
System memory 4 includes computer storage media in the form of volatile and/or nonvolatile memory such as read only memory (ROM) 8 and random access memory (RAM) 10. Basic input/output system 12 (BIOS), containing the basic routines that help to transfer information between elements within computer 1, such as during start-up, is typically stored in ROM 8. RAM 10 typically contains data and/or program modules that are immediately accessible to and/or presently being operated on by processing unit 2. By way of example, and not limitation,
Computer 1 may also include other removable/non-removable, volatile/nonvolatile computer storage media. By way of example only,
The drives and their associated computer storage media, discussed above and illustrated in
Computer 1 may operate in a networked environment using logical connections to one or more remote computers, such as remote computer 56. Remote computer 56 may be a personal computer, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to computer 1, although only memory storage device 58 has been illustrated in
When used in a LAN networking environment, computer 1 is connected to LAN 60 through network interface or adapter 64. When used in a WAN networking environment, computer 1 may include modem 66 or other means for establishing communications over WAN 62, such as the Internet. Computer 1 may also access WAN 62 and/or the Internet via network interface 64. Modem 66, which may be internal or external, may be connected to system bus 6 via user input interface 50 or other appropriate mechanism. In a networked environment, program modules depicted relative to computer 1, or portions thereof, may be stored in the remote memory storage device. By way of example, and not limitation,
II. Example Programming Interfaces
A programming interface (or more simply, interface) may be viewed as any mechanism, process or protocol for enabling one or more segment(s) of code to communicate with or access the functionality provided by one or more other segment(s) of code. Alternatively, a programming interface may be viewed as one or more mechanism(s), method(s), function call(s), module(s), object(s), etc. of a component of a system capable of communicative coupling to one or more mechanism(s), method(s), function call(s), module(s), etc. of other component(s). The term “segment of code” in the preceding sentence is intended to include one or more instructions or lines of code, and includes, e.g., code modules, objects, subroutines, functions, and so on, regardless of the terminology applied or whether the code segments are separately compiled, or whether the code segments are provided as source, intermediate, or object code, whether the code segments are utilized in a runtime system or process, or whether they are located on the same or different machines or distributed across multiple machines, or whether the functionality represented by the segments of code are implemented wholly in software, wholly in hardware, or a combination of hardware and software. By way of example, and not limitation, terms such as application programming (or program) interface (API), entry point, method, function, subroutine, remote procedure call, and component object model (COM) interface, are encompassed within the definition of programming interface.
A programming interface may be viewed generically as shown in
Aspects of a programming interface may include the method whereby the first code segment transmits information (where “information” is used in its broadest sense and includes data, commands, requests, etc.) to the second code segment; the method whereby the second code segment receives the information; and the structure, sequence, syntax, organization, schema, timing and content of the information. In this regard, the underlying transport medium itself may be unimportant to the operation of the interface, whether the medium be wired or wireless, or a combination of both, as long as the information is transported in the manner defined by the interface. In certain situations, information may not be passed in one or both directions in the conventional sense, as the information transfer may be either via another mechanism (e.g. information placed in a buffer, file, etc. separate from information flow between the code segments) or non-existent, as when one code segment simply accesses functionality performed by a second code segment. Any or all of these aspects may be important in a given situation, e.g., depending on whether the code segments are part of a system in a loosely coupled or tightly coupled configuration, and so this description should be considered illustrative and non-limiting.
The concept of a programming interface is known to those skilled in the art. There are various other ways to implement a programming interface. Such other ways may appear to be more sophisticated or complex than the simplistic view of
Factoring. A communication from one code segment to another may be accomplished indirectly by breaking the communication into multiple discrete communications. This is depicted schematically in
Redefinition. In some cases, it may be possible to ignore, add or redefine certain aspects (e.g., parameters) of a programming interface while still accomplishing the intended result. This is illustrated in
Inline Coding. It may also be feasible to merge some or all of the functionality of two separate code modules such that the “interface” between them changes form. For example, the functionality of
Divorce. A communication from one code segment to another may be accomplished indirectly by breaking the communication into multiple discrete communications. This is depicted schematically in
Rewriting. Yet another possible variant is to dynamically rewrite code to replace the interface functionality with something else but which achieves the same overall result. For example, there may be a system in which a code segment presented in an intermediate language (e.g. Microsoft IL, Java ByteCode, etc.) is provided to a Just-in-Time (JIT) compiler or interpreter in an execution environment (such as that provided by the .Net framework, the Java runtime environment, or other similar runtime type environments). The JIT compiler may be written so as to dynamically convert the communications from the 1st Code Segment to the 2nd Code Segment, i.e., to conform them to a different interface as may be required by the 2nd Code Segment (either the original or a different 2nd Code Segment). This is depicted in
It is also noted that the above-described scenarios for achieving the same or similar result as an interface via alternative embodiments may also be combined in various ways, serially and/or in parallel, or with other intervening code. Thus, the alternative embodiments presented above are not mutually exclusive and may be mixed, matched and combined to produce the same or equivalent scenarios to the generic scenarios presented in
III. Task Page Dialogs
As used herein, a “task page dialog” (or “task page”) is a specialized type of dialog used when a decision or other information is needed from a user in order to continue a task or series of tasks. In many cases, a task page dialog will be part of a series of such dialogs for related tasks.
Shown in
The format of task page 102 includes a header region, a content region and a footer region. For convenience, these regions are separated with broken lines in
Below the header region is the content region. The content region may be used to provide additional text which further explains the task page and what is needed from the user. The content area may also contain UI controls with which the user can provide input. As used herein, a “UI control” includes various types of graphical elements which a user can select (by, e.g., hovering a cursor over the control and pressing a mouse button) so as to interact with the computer program that caused the task page to be created. UI controls include, but are not limited to, buttons, “radio” buttons, check boxes, text input boxes, expansion controls, scrolling text boxes, etc. UI controls also include graphical elements which only provide information to a user (i.e., which do not offer a user the chance to select something). One example of such an information-only control is a progress indicator bar showing the percentage of a task or internal computer process which has been completed (e.g., a bar showing the percentage of a file that has been downloaded).
In
Beneath the content region is the footer region. The footer region houses controls for moving to another task page and/or for canceling (or otherwise closing) the current task page. In the example of
As shown in
Application 200 requests generation of task pages 1 through N (corresponding to property pages 1 through N) by transmitting that request to PI 202. Although shown in
In turn, each of the property pages 1-N referenced by property sheet 10 includes data or references to data pertaining to a corresponding task page. Examples of such data include:
When the PropertySheet call is received by PI 202, OS 204 sends one or more messages to application 200 indicating that OS 204 is about to create the frame and the first of the property pages specified by the function call. This is shown in
After creating the initial task page, and as shown in
Application 200 responds to the “next” button message at step 9. That response may be an indication that OS 204 should proceed to the next task page. In some cases, however, application 200 could respond that OS 204 should not proceed to the next task page. For example, the content region of task page 1 may require certain data in order to complete a particular task. If the user has failed to enter that data (which application 200 would know based on data received or not received in step 6) before pressing the next button, application 200 can prevent the user from proceeding to the next task page until a valid data entry is provided. Application 200 might also send additional messages requesting OS 204 to display error messages (e.g., in a separate message box dialog), to highlight the portion of the content region requiring an input, etc.
Notably, data corresponding to UI control input (step 5) will not always be provided prior to user selection of a “next” button. For example, a task page content region could simply contain text information advising the user of subsequent steps to follow (similar to
In the present example, however, application 200 informs OS 204 in step 9 that the next task page should be displayed. At step 10 (
In some embodiments, OS 204 provides certain default buttons for every task page. In particular, and unless otherwise specified by an application, all pages are displayed with a “cancel” button, all pages except the last are displayed with a “next” button, and the last page is displayed with a “finish” button. However, application 200 can instruct OS 204 (with one or more messages via PI 202) that one or more of these buttons should not be displayed in a particular task page. Similarly, application 200 can instruct OS 204 (with other messages via PI 202) that these buttons should be displayed with a different label. In some embodiments, a footer region may only contain a “next” (or “finish”) button.
Included at the end of this detailed description are Appendices A though GG describing functions, notifications, messages and structures, according to at least some embodiments, by which application 200 may access PI 202 to cause display of a series of task pages. Because Appendices A through GG will be readily understood by persons skilled in the art, they will not be extensively discussed herein. As can be seen in said appendices, however, various other messages and notifications can be exchanged as part of a process similar to the example of
The task page of
Although specific examples of carrying out the invention have been described, those skilled in the art will appreciate that there are numerous other variations and permutations of the above described systems and techniques. As used in the claims, the phrase “data indicative of” includes pointers or other references to data located elsewhere, as well as the actual data itself. In the claims, various portions are prefaced with letter or number references for convenience. However, use of such references does not imply a temporal relationship not otherwise required by the language of the claims.
Appendix A
CreatePropertySheetPage Function
Creates a new page for a property sheet.
Syntax
Parameters
lppsp
Returns the handle to the new property page if successful, or NULL otherwise.
Remarks
An application uses the PropertySheet function to create a property sheet that includes the new page.
Appendix B
DestroyPropertySheetPage Function
Destroys a property sheet page. An application must call this function for pages that have not been passed to the PropertySheet function.
Syntax
Parameters
hPSPage
Handle to the property sheet page to delete.
Return Value
Returns nonzero if successful, or zero otherwise.
Appendix C
PropertySheet Function
Creates a property sheet and adds the pages defined in the specified property sheet header structure.
Syntax
Parameters
lppsph
Pointer to a PROPSHEETHEADER structure that defines the frame and pages of a property sheet.
Return Value
Returns a positive value if successful, or −1 otherwise.
Remarks
To retrieve extended error information, call GetLastError.
Appendix D
PropSheetPageProc Function
Specifies an application-defined callback function that a property sheet calls when a page is created and when it is about to be destroyed. An application can use this function to perform initialization and cleanup operations for the page.
Syntax
Parameters
hwnd
Reserved; must be NULL.
uMsg
[in] Action flag. This parameter can be one of the following values:
PSPCB_ADDREF
A dialog box for a page is being created. Return nonzero to allow it to be created, or zero to prevent it.
[in, out] Pointer to a PROPSHEETPAGE structure that defines the page being created or destroyed. See the Remarks section for further discussion.
Return Value
The return value depends on the value of the uMsg parameter.
Remarks
An application must specify the address of this callback function in the pfnCallback member of a PROPSHEETPAGE structure before passing the structure to the CreatePropertySheetPage function.
Note: The property sheet is in the process of manipulating the list of pages when this function is called. Do not attempt to add, remove, or insert pages while handling this notification. Doing so will have unpredictable results.
With the exception of the lParam member, an application should not modify the PROPSHEETPAGE structure. Doing so will have unpredictable results. The lParam member contains application-defined data and can be modified as needed.
Appendix E
PropSheetProc Function
An application-defined callback function that the system calls when the property sheet is being created and initialized.
Syntax
Parameters
hwndDlg
Handle to the property sheet dialog box.
uMsg
Message being received. This parameter is one of the following values.
Indicates the user pressed a button in the property sheet dialog box. To enable this, specify PSH_USECALLBACK in PRINTPROPSHEETHEADER.dwFlags and specify the name of this callback function in PRINTPROPSHEETHEADER.pfnCallback. The lParam value is one of the following:
lParam
Additional information about the message. The meaning of this value depends on the uMsg parameter.
Return Value
Returns zero.
Remarks
To enable a PropSheetProc callback function, use the PROPSHEETHEADER structure when you call the PropertySheet function to create the property sheet. Use the pfnCallback member to specify an address of the callback function, and set the PSP_USECALLBACK flag in the dwFlags member.
PropSheetProc is a placeholder for the application-defined function name. The PFNPROPSHEETCALLBACK type is the address of a PropSheetProc callback function.
Appendix F
PSN KILLACTIVE Notification
Notifies a page that it is about to lose activation either because another page is being activated or the user has clicked the OK button. This notification message is sent in the form of a WM_NOTIFY message.
Syntax
Parameters
lppsn
Pointer to a PSHNOTIFY structure that contains information about the notification. This structure contains an NMHDR structure as its first member, hdr. The hwndFrom member of this NMHDR structure contains the handle to the property sheet. The lParam member of the PSHNOTIFY structure does not contain any information.
Return Value
Returns TRUE to prevent the page from losing the activation, or FALSE to allow it.
Remarks
An application handles this notification to validate the information the user has entered.
Note: The property sheet is in the process of manipulating the list of pages when the PSN_KILLACTIVE notification is sent. Do not attempt to add, remove, or insert pages while handling this notification. Doing so will have unpredictable results.
To set a return value, the dialog box procedure for the page must call the SetWindowLong function with a DWL_MSGRESULT value set to the return value. The dialog box procedure must return TRUE.
If the dialog box procedure sets DWL_MSGRESULT to TRUE, it should display a message box to explain the problem to the user.
Appendix G
PSN QUERYCANCEL Notification
Indicates that the user has canceled the property sheet. This notification message is sent in the form of a WM_NOTIFY message.
Syntax
Parameters
lppsn
Pointer to a PSHNOTIFY structure that contains information about the notification. This structure contains an NMHDR structure as its first member, hdr. The hwndFrom member of this NMHDR structure contains the handle to the property sheet. The lParam member of the PSHNOTIFY structure does not contain any information.
Return Value
Returns TRUE to prevent the cancel operation, or FALSE to allow it.
Remarks
This message is typically sent when a user clicks the Cancel button. It is also sent when a user clicks the X button in the property sheet's upper right hand corner or presses the ESCAPE key. A property sheet page can handle this notification message to ask the user to verify the cancel operation.
To set a return value, the dialog box procedure for the page must call the SetWindowLong function with DWL_MSGRESULT set to the return value. The dialog box procedure must return TRUE.
Appendix H
PSN RESET Notification
Notifies a page that the property sheet is about to be destroyed. This notification message is sent in the form of a WM_NOTIFY message.
Syntax
Parameters
lppsn
Pointer to a PSHNOTIFY structure that contains information about the notification.
Return Value
No return value.
Remarks
The lParam member of the PSHNOTIFY structure pointed to by lppsn will be set to TRUE if the user clicked the “X” button in the upper-right corner of the property sheet. It will be FALSE if the user clicked the Cancel button. The PSHNOTIFY structure contains an NMHDR structure as its first member, hdr. The hwndFrom member of this NMHDR structure contains the handle to the property sheet.
An application can use this notification message as an opportunity to perform cleanup operations.
Note: The property sheet is in the process of manipulating the list of pages when the PSN_RESET notification is sent. Do not attempt to add, remove, or insert pages while handling this notification. Doing so will have unpredictable results.
Do not call the EndDialog function when processing this notification.
Appendix I
PSN SETACTIVE Notification
Notifies a page that it is about to be activated. This notification message is sent in the form of a WM_NOTIFY message.
Syntax
Parameters
lppsn
Pointer to a PSHNOTIFY structure that contains information about the notification. This structure contains an NMHDR structure as its first member, hdr. The hwndFrom member of this NMHDR structure contains the handle to the property sheet. The lParam member of the PSHNOTIFY structure does not contain any information.
Return Value
Returns zero to accept the activation, or −1 to activate the next or the previous page (depending on whether the user clicked the Next or Back button). To set the activation to a particular page, return the resource identifier of the page.
Remarks
The PSN_SETACTIVE notification message is sent before the page is visible. An application can use this notification to initialize data in the page.
Note: The property sheet is in the process of manipulating the list of pages when the PSN_SETACTIVE notification is sent. Do not attempt to add, remove, or insert pages while handling this notification. Doing so will have unpredictable results.
To set the return value, the dialog box procedure for the page must use the SetWindowLong function with the DWL_MSGRESULT value, and the dialog box procedure must return TRUE.
Appendix J
PSN TRANSLATEACCELERATOR Notification
Notifies a property sheet that a keyboard message has been received. It provides the page an opportunity to do private keyboard accelerator translation. This notification is sent in the form of a WM_NOTIFY message.
Syntax
Parameters
lppsn
A pointer to a PSHNOTIFY structure that contains information about the notification. This structure contains an NMHDR structure as its first member, hdr. The hwndFrom member of the NMHDR structure contains the handle to the property sheet. The lParam member of the PSHNOTIFY structure is a pointer to the message's MSG. It can be cast to an LPMSG type, to get access to the parameters of the message to be translated.
Return Value
Return PSNRET_MESSAGEHANDLED to indicate that no further processing is necessary. Return PSNRET_NOERROR to request normal processing.
Remarks
To set the return value, the dialog box procedure for the page must use the SetWindowLong function with the DWL_MSGRESULT value. The dialog box procedure must return TRUE.
Appendix K
PSN WIZBACK Notification
Notifies a page that the user has clicked the Back button in a wizard. This notification message is sent in the form of a WM_NOTIFY message.
Syntax
Parameters
lppsn
Pointer to a PSHNOTIFY structure that contains information about the notification. This structure contains an NMHDR structure as its first member, hdr. The hwndFrom member of this NMHDR structure contains the handle to the property sheet. The lParam member of the PSHNOTIFY structure does not contain any information.
Return Value
Return 0 to allow the wizard to go to the previous page. Return −1 to prevent the wizard from changing pages. To display a particular page, return its dialog resource identifier.
Remarks
To set the return value, the dialog box procedure for the page must call the SetWindowLong function with the DWL_MSGRESULT value and return TRUE. For example:
Note The property sheet is in the process of manipulating the list of pages when the PSN_WIZBACK notification is sent. You can add, insert, or remove pages in response to these notifications, but special care must be taken if you insert or remove pages before the current page.
Appendix L
PSN WIZFINISH Notification
Notifies a page that the user has clicked the Finish button in a wizard. This notification message is sent in the form of a WM_NOTIFY message.
Syntax
Parameters
lppsn
Pointer to a PSHNOTIFY structure that contains information about the notification. This structure contains an NMHDR structure as its first member, hdr. The hwndFrom member of this NMHDR structure contains the handle to the property sheet. The lParam member of the PSHNOTIFY structure does not contain any information.
Return Value
Return TRUE to prevent the wizard from finishing.
Return a window handle to prevent the wizard from finishing. The wizard will set the focus to that window. The window must be owned by the wizard page.
Return FALSE to allow the wizard to finish.
Remarks
To set the return value, the dialog box procedure for the page must use the SetWindowLong function with the DWL_MSGRESULT value, and the dialog box procedure must return TRUE.
If your application returns TRUE to prevent a wizard from finishing, it has no control over which window on the page receives focus. Applications that need to stop a wizard from finishing should normally do so by returning the handle of the window on the wizard page that is to receive focus.
Appendix M
PSN WIZNEXT Notification
Notifies a page that the user has clicked the Next button in a wizard. This notification message is sent in the form of a WM_NOTIFY message.
Syntax
PSN_WIZNEXT
lppsn=(LPPSHNOTIFY)lParam;
Pointer to a PSHNOTIFY structure that contains information about the notification. This structure contains an NMHDR structure as its first member, hdr. The hwndFrom member of this NMHDR structure contains the handle to the property sheet. The lParam member of the PSHNOTIFY structure does not contain any information.
Return Value
Return 0 to allow the wizard to go to the next page. Return −1 to prevent the wizard from changing pages. To display a particular page, return its dialog resource identifier.
Remarks
To set the return value, the dialog box procedure for the page must call the SetWindowLong function with the DWL_MSGRESULT value and return TRUE. For example:
Note: The property sheet is in the process of manipulating the list of pages when the PSN_WIZNEXT notification is sent. You can add, insert, or remove pages in response to these notifications, but special care must be taken if you insert or remove pages before the current page.
Appendix N
PSM ADDPAGE Message
Adds a new page to the end of an existing property sheet. You can send this message explicitly or by using the PropSheet_AddPage macro.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
wParam
Must be zero.
hpage
Handle to the page to add. The page must have been created by a previous call to the CreatePropertySheetPage function.
Return Value
Returns TRUE if successful, or FALSE otherwise.
Remarks
The new page should be no larger than the largest page currently in the property sheet because the property sheet is not resized to fit the new page.
A number of messages and one function call occur while the property sheet is manipulating the list of pages. While this action is taking place, attempting to modify the list of pages will have unpredictable results.
Accordingly, you should not use the PSM_ADDPAGE message in your implementation of PropSheetPageProc or while handling the following notifications and Microsoft® Windows® messages:
If you need to modify a property sheet page while you are handling one of these messages or while PropSheetPageProc is in operation, post yourself a private Windows message. Your application will not receive that message until after the property sheet manager has finished its tasks. Then you can modify the list of pages.
Appendix O
PSM HWNDTOINDEX Message
Takes the window handle of the property sheet page and returns its zero-based index. You can send this message explicitly or use the PropSheet_HwndToIndex macro.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
hPageDlg
Handle to the page's window.
lParam
Must be zero.
Return Value
Returns the zero-based index of the property sheet page specified by hPageDlg if successful. Otherwise, it returns −1.
Appendix P
PSM IDTOINDEX Message
Takes the resource identifier (ID) of a property sheet page and returns its zero-based index. You can send this message explicitly or use the PropSheet_IdToIndex macro.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
wParam
Must be zero.
iPageID
Resource ID of the page.
Return Value
Returns the zero-based index of the property sheet page specified by iPageID if successful. Otherwise, it returns −1.
Appendix Q
PSM INDEXTOHWND Message
Takes the index of a property sheet page and returns its window handle. You can send this message explicitly or use the PropSheet_IndexToHwnd macro.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
iPageIndex
Zero-based index of the page.
lParam
Must be zero.
Return Value
Returns the handle to the window of the property sheet page specified by iPageIndex if successful. Otherwise, it returns zero.
Appendix R
PSM INDEXTOID Message
Takes the index of a property sheet page and returns its resource identifier (ID). You can send this message explicitly or use the PropSheet_IndexTold macro.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
iPageIndex
Zero-based index of the page.
lParam
Must be zero.
Return Value
Returns the resource ID of the property sheet page specified by iPageIndex if successful. Otherwise, it returns zero.
Appendix S
PSM INDEXTOPAGE Message
Takes the index of a property sheet page and returns its HPROPSHEETPAGE handle. You can send this message explicitly or use the PropSheet_IndexToPage macro.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
iPageIndex
Zero-based index of the page.
lParam
Must be zero.
Return Value
Returns the HPROPSHEETPAGE handle of the property sheet page specified by iPageIndex if successful. Otherwise, it returns zero.
Appendix T
PSM PAGETOINDEX Message
Takes the HPROPSHEETPAGE handle of the property sheet page and returns its zero-based index. You can send this message explicitly or use the PropSheet_PageToIndex macro.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
hpage
HPROPSHEETPAGE handle to the property sheet page.
wParam
Must be zero.
Return Value
Returns the zero-based index of the property sheet page specified by hpage if successful. Otherwise, it returns −1.
Appendix U
PSM PRESSBUTTON Message
Simulates the selection of a property sheet button. You can send this message explicitly or by using the PropSheet_PressButton macro.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
iButton
Index of the button to select. This parameter can be one of the following values:
Must be zero.
Return Value
No return value.
Appendix V
PSM QUERYSIBLINGS Message
Sent to a property sheet, which then forwards the message to each of its pages. You can send this message explicitly or by using the PropSheet_QuerySiblings macro.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
param1
First application-defined parameter.
param2
Second application-defined parameter.
Return Value
Returns the nonzero value from a page in the property sheet, or zero if no page returns a nonzero value.
Remarks
If a page returns a nonzero value, the property sheet does not send the message to subsequent pages.
Appendix W
PSM SETCURSEL Message
Activates the specified page in a property sheet. You can send this message explicitly or by using the PropSheet_SetCurSel macro.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
index
The zero-based index of the page. An application can specify the index or the handle, or both. If both are specified, hpage takes precedence.
hpage
The handle to the page to activate. An application can specify the index or the handle, or both. If both are specified, hpage takes precedence.
Return Value
Returns TRUE if successful, or FALSE otherwise.
Remarks
The window that is losing the activation receives the PSN_KILLACTIVE notification message, and the window that is gaining the activation receives the PSN_SETACTIVE notification message.
Appendix X
PSM SETCURSELID Message
Activates the given page in a property sheet based on the resource identifier of the page. You can send this message explicitly or by using the PropSheet_SetCurSelByID macro.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
wParam
Must be zero.
id
Resource identifier of the page to activate.
Return Value
Returns TRUE if successful, or FALSE otherwise.
Remarks
The window that is losing the activation receives the PSN_KILLACTIVE notification message, and the window that is gaining the activation receives the PSN_SETACTIVE notification message.
Appendix Y
PSM SETFINISHTEXT Message
Sets the text of the Finish button in a wizard, shows and enables the button, and hides the Next and Back buttons. You can send this message explicitly or by using the PropSheet_SetFinishText macro.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
wParam
Must be zero.
lpszText
Pointer to the new text for the Finish button.
Return Value
No return value.
Remarks
By default, the Finish button does not have a keyboard accelerator. You can create a keyboard accelerator with this message by including an ampersand (&) in the text string that you assign to lpszText. For example, “&Finish” defines F as the accelerator key.
Appendix Z
PSM SETHEADERTITLE Message
Sets the title text for the header of a wizard's interior page. You can send this message explicitly or use the PropSheet_SetHeaderTitle macro.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
iPageIndex
Zero-based index of the wizard's page.
pszHeaderTitle
New header subtitle.
Return Value
No return value.
Remarks
If you specify the current page, it will immediately be repainted to display the new title.
Appendix AA
PSM SETNEXTTEXT Message
Sets the text of the Next button in a wizard. You can send this message explicitly or by using the PropSheet_SetNextText macro.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
wParam
Must be zero.
lpsztext
Pointer to the new text for the Next button.
Return Value
No return value.
Remarks
You can create a keyboard accelerator with this message by including an ampersand (&) in the text string that you assign to lpszText. For example, “&Next” defines N as the accelerator key.
Appendix BB
PSM SETWIZBUTTONS Message
Enables or disables the Back, Next, and Finish buttons in a wizard. You can also use the PropSheet_SetWizButtons macro to post the message.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
wParam
Must be zero.
dwFlags
Value that specifies which property sheet buttons are enabled. You can combine one or more of the following flags.
No return value.
Remarks
If your notification handler uses PostMessage to send a PSM_SETWIZBUTTONS message, do nothing that will affect window focus until after the handler returns. For example, if you call MessageBox immediately after using PostMessage to send PSM_SETWIZBUTTONS, the message box will receive focus. Since posted messages are not delivered until they reach the head of the message queue, the PSM_SETWIZBUTTONS message will not be delivered until after the wizard has lost focus to the message box. As a result, the property sheet will not be able to properly set the focus for the buttons.
If you send the PSM_SETWIZBUTTONS message during your handling of the PSN_SETACTIVE notification message, use the PostMessage function rather than the SendMessage function. Otherwise, the system will not update the buttons properly. If you use the PropSheet_SetWizButtons macro to send this message, it will be posted. At any other time, you can use SendMessage to send PSM_SETWIZBUTTONS.
Wizards display either three or four buttons below each page. This message is used to specify which buttons are enabled. Wizards normally display Back, Cancel, and either a Next or Finish button. You typically enable only the Next button for the welcome page, Next and Back for interior pages, and Back and Finish for the completion page. The Cancel button is always enabled. Normally, setting PSWIZB_FINISH or PSWIZB_DISABLEDFINISH replaces the Next button with a Finish button. To display Next and Finish buttons simultaneously, set the PSH_WIZARDHASFINISH FLAG in the dwFlags member of the wizard's PROPSHEETHEADER structure when you create the wizard. Every page will then display all four buttons.
Appendix CC
PSM SHOWWIZBUTTONS Message
Show or hide the Back, Next, and Finish buttons in a wizard. You can also use the PropSheet_ShowWizButtons macro to post the message.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
wParam
State of the buttons that are specified in dwFlags. You can combine one or more of the flags specified in the dwFlags parameter.
dwFlags
Value that specifies which property sheet buttons are shown. You can combine one or more of the following flags.
No return value.
Remarks
The following example will enable the Back button, and hide the Next button:
ShowWizButtons(PSWIZB_BACK/*state*/, PSWIZB_BACK|PSWIZB_NEXT/*mask*/)
If your notification handler uses PostMessage to send a PSM_SETWIZBUTTONS message, do nothing that will affect window focus until after the handler returns. For example, if you call MessageBox immediately after using PostMessage to send PSM_SETWIZBUTTONS, the message box will receive focus. Since posted messages are not delivered until they reach the head of the message queue, the PSM_SETWIZBUTTONS message will not be delivered until after the wizard has lost focus to the message box. As a result, the property sheet will not be able to properly set the focus for the buttons.
If you send the PSM_SETWIZBUTTONS message during your handling of the PSN_SETACTIVE notification message, use the PostMessage function rather than the SendMessage function. Otherwise, the system will not update the buttons properly. If you use the PropSheet_SetWizButtons macro to send this message, it will be posted. At any other time, you can use SendMessage to send PSM_SETWIZBUTTONS. Wizards display either three or four buttons below each page. This message is used to specify which buttons are enabled. Wizards normally display Back, Cancel, and either a Next or Finish button. You typically enable only the Next button for the welcome page, Next and Back for interior pages, and Back and Finish for the completion page. The Cancel button is always enabled. Normally, setting PSWIZB_FINISH or PSWIZB_DISABLEDFINISH replaces the Next button with a Finish button. To display Next and Finish buttons simultaneously, set the PSH_WIZARDHASFINISH FLAG in the dwFlags member of the wizard's PROPSHEETHEADER structure when you create the wizard. Every page will then display all four buttons.
Appendix DD
PROPSHEETHEADER Structure
Defines the frame and pages of a property sheet.
Syntax
Members
dwSize
Size, in bytes, of this structure. The property sheet manager uses this member to determine which version of the PROPSHEETHEADER structure you are using. For more information, see the Remarks.
dwFlags
Flags that indicate which options to use when creating the property sheet page. This member can be a combination of the following values:
Handle to the property sheet's owner window.
hInstance
Handle to the instance from which to load the icon or title string resource. If the pszIcon or pszCaption member identifies a resource to load, this member must be specified.
hIcon
Handle to the icon to use as the small icon in the title bar of the property sheet dialog box. If the dwFlags member does not include PSH_USEHICON, this member is ignored. This member is declared as a union with pszIcon.
pszIcon
Icon resource to use as the small icon in the title bar of the property sheet dialog box. This member can specify either the identifier of the icon resource or the address of the string that specifies the name of the icon resource. If the dwFlags member does not include PSH_USEICONID, this member is ignored. This member is declared as a union with hIcon.
pszCaption
Title of the property sheet dialog box. This member can specify either the identifier of a string resource or the address of a string that specifies the title.
nPages
Number of elements in the phpage array.
nStartPage
Zero-based index of the initial page that appears when the property sheet dialog box is created.
ppsp
Pointer to an array of PROPSHEETPAGE structures that define the pages in the property sheet. If the dwFlags member does not include PSH_PROPSHEETPAGE, this member is ignored. Note that the PROPSHEETPAGE structure is variable in size. Applications that parse the array pointed to by ppsp must take the size of each page into account. This member is declared as a union with phpage.
phpage
Pointer to an array of handles to the property sheet pages. Each handle must have been created by a previous call to the CreatePropertySheetPage function. If the dwFlags member includes PSH_PROPSHEETPAGE, phpage is ignored and should be set to NULL. When the PropertySheet function returns, any HPROPSHEETPAGE handles in the phpage array will have been destroyed. This member is declared as a union with ppsp.
pfnCallback
Pointer to an application-defined callback function that is called when the property sheet is initialized. For more information about the callback function, see the description of the PropSheetProc function. If the dwFlags member does not include PSH_USECALLBACK, this member is ignored.
hbmheader
Handle to the header bitmap. If the dwFlags member does not include PSH_USEHBMHEADER, this member is ignored.
pszbmHeader
Bitmap resource to use as the header. This member can specify either the identifier of the bitmap resource or the address of the string that specifies the name of the bitmap resource. If the dwFlags member includes PSH_USEHBMHEADER, this member is ignored.
Remarks
The dwSize field must be initialized, and set to sizeof(PROPSHEETHEADER).
Appendix EE
PROPSHEETPAGE Structure
This structure defines a page in a property sheet.
Syntax
Members
dwSize
Size, in bytes, of this structure. The property sheet manager uses this member to determine which version of the PROPSHEETHEADER structure you are using.
dwFlags
Flags that indicate which options to use when creating the property sheet page. This member can be a combination of the following values:
Handle to the instance from which to load an icon or string resource. If the pszHeaderTitle member identifies a resource to load, hInstance must be specified.
pszTemplate
Dialog box template to use to create the page. This member can specify either the resource identifier of the template or the address of a string that specifies the name of the template. If the PSP_DLGINDIRECT flag in the dwFlags member is set, psztemplate is ignored. This member is declared as a union with pResource.
pResource
Pointer to a dialog box template in memory. The PropertySheet function assumes that the template is not write-protected. A read-only template will cause an exception in some versions of Windows. To use this member, you must set the PSP_DLGINDIRECT flag in the dwFlags member. This member is declared as a union with pszTemplate.
pfnDlgProc
Pointer to the dialog box procedure for the page. Because the pages are created as modeless dialog boxes, the dialog box procedure must not call the EndDialog function.
lParam
When the page is created, a copy of the page's PROPSHEETPAGE structure is passed to the dialog box procedure with a WM_INITDIALOG message. The IParam member is provided to allow you to pass application-specific information to the dialog box procedure. It has no effect on the page itself. For more information, see Property Sheet Creation.
pfnCallback
Pointer to an application-defined callback function that is called when the page is created and when it is about to be destroyed. For more information about the callback function, see PropSheetPageProc. To use this member, you must set the PSP_USECALLBACK flag in the dwFlags member.
pszHeaderTitle
Title of the header area.
hActCtx
An activation context handle. Set this member to the handle that is returned when you create the activation context with CreateActCtx. The system will activate this context before creating the dialog box. You do not need to use this member if you use a global manifest. See the Remarks.
Remarks
The dwSize field must be initialized, and set to sizeof(PROPSHEETPAGE).
Appendix FF
PSHNOTIFY Structure
Contains information for the property sheet notification messages.
Syntax
Members
hdr
Address of an NMHDR structure that contains additional information about the notification.
lParam
Additional information about this notification. To determine what, if any, information is contained in this member, see the description of the particular notification message.
Appendix GG
PSM SETTITLE Message
Sets the title of a wizard. You can send this message explicitly or by using the PropSheet SetTitle macro.
Syntax
To send this message, call the SendMessage function as follows.
Parameters
lpszText
Pointer to a buffer that contains the title string. If the high-order word of this parameter is NULL, the property sheet loads the string resource specified in the low-order word. If this parameter is NULL, the original title of the wizard will be restored.
Return Value
No return value.