Microsoft DirectX 8.0

Property Page Helper Functions

The Videoctl.h header file in the Microsoft® DirectShow® base classes provides functions to help with property page implementations.

GetDialogSize Retrieves the size of a resource dialog box in screen pixels.
StringFromResource Loads a string from a resource file with the given resource identifier.
WideStringFromResource Loads a Unicode™ string from a resource file with the given resource identifier.

GetDialogSize

Property Page Helper Functions

Retrieves the size of a resource dialog box.

Syntax

BOOL WINAPI GetDialogSize(
    int iResourceID,
    DLGPROC pDlgProc,
    LPARAM lParam,
    SIZE *pResult
);

Parameters

iResourceID
Dialog box resource identifier.
pDlgProc
Pointer to the dialog box procedure.
lParam
Value passed in the WM_INITDIALOG message sent to the temporary dialog box just after it is created.
pResult
Pointer to a SIZE structure that receives the dimensions of the dialog box, in screen pixels.

Return Value

Returns TRUE if the dialog box resource was found, or FALSE otherwise.

Remarks

Property pages can use this function to return the actual display size they require. Most property pages are dialog boxes and, as such, have dialog box templates stored in resource files. Templates use dialog box units that do not map directly onto screen pixels. However, a property page's GetPageInfo function must return the actual display size in pixels. The property page can call GetDialogSize to calculate the display size.

This function creates a temporary instance of the dialog box. To avoid having the dialog box appear on the screen, the dialog box template in the resource file should not have a WS_VISIBLE property.

StringFromResource

Property Page Helper Functions

Loads a string from a resource file with the given resource identifier.

Syntax

TCHAR * WINAPI StringFromResource(
    TCHAR *pBuffer,
    int iResourceID
);

Parameters

pBuffer
Pointer to the string corresponding to iResourceID.
iResourceID
Resource identifier of the string to retrieve.

Return Value

Returns the same string as pBuffer. If the function is not successful, returns a null string.

Remarks

The pBuffer buffer must be at least STR_MAX_LENGTH bytes.

WideStringFromResource

Property Page Helper Functions

Loads a Unicode™ string from a resource file with the given resource identifier.

Syntax

WCHAR * WINAPI WideStringFromResource(
    WCHAR *pBuffer,
    int iResourceID
);

Parameters

pBuffer
Pointer to the string corresponding to iResourceID.
iResourceID
Resource identifier of the string to retrieve.

Return Value

Returns the same string as pBuffer. If the function is not successful, returns a null string.

Remarks

Property pages are typically called through their COM interfaces, which use Unicode™ strings regardless of how the binary is built. This function allows you to convert a resource string to a Unicode string. The function converts the resource to a Unicode string (if it is not already one) after loading it.