Property Page Helper Functions


The Videoctl.h header file in the DirectShow base classes provides functions to help with property page implementations.
Function Description
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

Retrieves the size of a resource dialog box.

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
Any user data wanted in pDlgProc.
pResult
Size of the dialog box, in screen pixels.
Return Values

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. When a property page has its GetPageInfo function called, it must return the actual display size in pixels. This method is passed the resource ID for the dialog box and will return its size in pixels.

To make the calculation, the function creates an instance of the dialog box. To avoid the dialog box appearing on the screen temporarily, the dialog box's template in the resource file should not have a WS_VISIBLE property.


StringFromResource

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

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

Parameters
pBuffer
String corresponding to iResourceID.
iResourceID
Resource identifier of the string to retrieve.
Return Values

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

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

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

Parameters
pBuffer
String corresponding to iResourceID.
iResourceID
Resource identifier of the string to retrieve.
Return Values

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

Remarks

Property pages are typically called through their OLE 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.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.