SetConsoleOutputCP, SetConsoleCP

This is a discussion on SetConsoleOutputCP, SetConsoleCP within the Windows Programming forums, part of the Platform Specific Boards category; Hi! This function: Code: void CodePage (UINT InputCP, UINT OutputCP) { BOOL Input = FALSE, Output = FALSE; // set ...

  1. #1
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669

    Question SetConsoleOutputCP, SetConsoleCP

    Hi!

    This function:

    Code:
    void CodePage (UINT InputCP, UINT OutputCP)
    {
    	BOOL Input = FALSE, Output = FALSE;
    
    
    
    	// set codepage
    	if ((Input = SetConsoleCP (InputCP)) == 0)
            {
                    printf ("Input code page cannot be set to %u. Error code: %d", InputCP, GetLastError ());
            }
    	if ((Output = SetConsoleOutputCP (OutputCP)) == 0)
            {
                  printf ("Output code page cannot be set to %u. Error code: %d", OutputCP, GetLastError ());
            }
    }
    Does not work in Win98. GetLastError () function returns number 120. What is that error and why it's not working?

    Thanks!
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    From MSDN...

    >>>
    Windows NT: Requires version 3.1 or later.
    Windows: Unsupported.
    Windows CE: Unsupported.
    <<<

    ... you are calling an unsupported function.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669
    Damn! Is there any way that the program will use this function only in WinNT. Is there any thing like this
    Code:
    #ifdef WIN_NT
    // run the code page function
    #else // skip it
    If anyone knows, please let me know.

    Thanks!
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    You can get the OS version with the GetVersion() or GetVersionEx() API routines.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  5. #5
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Hey, how is your program loading with unavailable functions?

    As for the error number can someone please add this to the sticky at the top of the forum:

    Q: An API function returned the error code xx. What does it mean?
    A: Please see this page for a complete list of WinApi error codes:
    http://msdn.microsoft.com/library/en...rror_codes.asp

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21