Microsoft KB Archive/83327

= Changing the Title of Unit Windows in QuickWin Programs =

PSS ID Number: 83327

Article Last Modified on 5/5/2001

-

The information in this article applies to:


 * Microsoft FORTRAN Compiler for MS-DOS 5.1

-



This article was previously published under Q83327



SUMMARY
Microsoft 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 INFORMATION
GetFocus 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   The syntax of GetFocus is as follows: INTERFACE TO INTEGER*2 FUNCTION GetFocus [PASCAL] END 

SetWindowText 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] END The LPSTRING parameter is a pointer to a NULL terminated string containing the new title for the window.

Sample Code
c 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 query words: kbinf 5.10

Keywords: KB83327

Technology: kbAudDeveloper kbFORTRAN510DOS kbFortranSearch kbZNotKeyword3

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.