Changing the Title of Unit Windows in QuickWin ProgramsLast reviewed: July 20, 1995Article ID: Q83327 |
The information in this article applies to:
SUMMARYMicrosoft FORTRAN version 5.1 QuickWin programs can change the title of any window using the Windows API functions GetFocus() and SetWindowText(), which are documented in the Windows SDK manuals. The GetFocus() function is used to obtain a handle to the window with the focus, then this handle is used as the window handle parameter in the SetWindowText() function.
MORE INFORMATIONGetFocus() returns the handle of the window with the user focus. This handle is an internal Windows integer value that represents a token to manipulate on a specific window. If the function is successful, it returns a valid handle. If no window has focus, the function returns 0. The syntax of GetFocus() is as follows:
INTERFACE TO INTEGER*2 FUNCTION GetFocus [PASCAL] ENDSetWindowText() has no return value. The first argument is the handle of the window to change the title. The second argument is the string containing the new title. The syntax of SetWindowText() is as follows:
INTERFACE TO SUBROUTINE SetWindowText [PASCAL] +(HWND, LPSTRING) INTEGER*2 HWND [VALUE] CHARACTER*1 LPSTRING [REFERENCE] ENDThe LPSTRING parameter is a pointer to a NULL terminated string containing the new title for the window.
Sample Codec The following code demonstrates how to change the title in the c UNIT * window. This code should be compiled and linked as a QuickWin c Windows-based application (fl /MW sample.for).
INTERFACE TO SUBROUTINE SetWindowText [PASCAL] + (HWND, LPSTRING) INTEGER*2 HWND [VALUE] CHARACTER*1 LPSTRING [REFERENCE] END INTERFACE TO INTEGER*2 FUNCTION GetFocus [PASCAL] END PROGRAM Sample_Test INTEGER*2 hWnd, GetFocus PRINT *, 'Changing the Title of this Window' hWnd = GetFocus () !gets focus of current window CALL SetWindowText (hWnd, 'My Title'C) !changes title END |
Additional reference words: kbinf 5.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |