GetFirstForm

Top  Previous  Next

The GetFirstForm method starts an enumeration of forms, retrieving the name and the properties of the first form in the enumeration.

HRESULT GetFirstForm(

[out] LPWSTR* p_pwsFormName,

[out] LPWSTR* p_pwsFormDescription,

[out] FLOAT*  p_pfWidth,

[out] FLOAT*  p_pfHeight,

[out] BOOL*   p_pbVisible,

[in]  LPCWSTR p_wsProfileName,

[in]  BOOL    p_bPublicProfile

);

 

Parameters:

p_pwsFormName

[out]pointer to a pointer to a null terminated Unicode string that will contain the name of the custom form. The allocated memory must be freed by the caller with CoTaskMemFree

p_pwsFormDescription

[out]pointer to a pointer to a null terminated Unicode string that will contain the description of the custom form. The allocated memory must be freed by the caller with CoTaskMemFree

p_pfWidth

[out] will contain the width of the form in millimeters

p_pfHeight

[out] will contain the height of the form in millimeters

p_pbVisible

[out] will be TRUE if this form is visible in the printing preferences dialog

p_wsProfileName

[in] pointer to a null terminated Unicode string containing the profile to modify. If this parameter is an empty string, the current active profile is used.

p_bPublicProfile

[in] Flag if the profile is a public or a private profile.

 

Return values:

S_OK on success or COM error code

NV_NOT_INITIALIZED - Initialize was not called

NV_NO_MORE_FORMS - no more forms to enumerate

 

Remarks:

GetFirstForm along with GetNextForm are used to enumerate all custom forms like in the code sample below:

hr = GetFirstForm(&pName, ...)

while (SUCCEEDED(hr) && hr != NV_NO_MORE_FORMS) {

// do something with pName, and the other parameters

// ...

CoTaskMemFree(pName);

// get next form if it exists

hr = GetNextForm(&pName);

}