GETCP( ) Function

Example   See Also

Prompts for a code page by displaying the Code Page dialog box, and then returns the number of the code page chosen.

Syntax

GETCP([nCodePage] [, cText] [, cDialogTitle])

Returns

Numeric

Arguments

nCodePage

Specifies the number of the code page that is initially selected when the Code Page dialog box is displayed. If nCodePage is 0 or if you omit nCodePage, a code page isn't selected when the Code Page dialog box is displayed.

cText

Specifies the text displayed in the Code Page dialog box. If you omit cText, Visual FoxPro displays the following text: "Please select a code page for cross-platform data sharing."

cDialogTitle

Specifies the title that appears in the Code Page dialog box title bar. If you omit cDialogTitle, the title "Code Page" is displayed.

Remarks

GETCP( ) returns 0 if you exit the Code Page dialog box by pressing ESC, choosing the Cancel button, or choosing Close from the Control menu.

The code pages listed in the Code Page dialog box are determined by FOXPRO.INT, the Visual FoxPro International code page support file.

You can include GETCP( ) in commands such as MODIFY COMMAND, APPEND FROM, and COPY TO that support the AS nCodePage clause. The Code Page dialog box is displayed, allowing you to specify the code page of the file opened, appended, or created. Because no code page 0 exists, you must trap for 0 in case the user chooses ESC, the Cancel button, or Close from the Control menu.