home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
sftick.zip
/
beg
/
winfont
/
WIN1.C
< prev
next >
Wrap
Text File
|
1994-05-05
|
3KB
|
108 lines
#define INCL_WIN
#include <os2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define CLS_CLIENT "WindowClass"
MRESULT EXPENTRY ClientWndProc ( HWND hwndWnd,
ULONG ulMsg,
MPARAM mpParm1,
MPARAM mpParm2 ) ;
INT main ( VOID )
{
HAB habAnchor ;
HMQ hmqQueue ;
ULONG ulFlags ;
HWND hwndFrame ;
HWND hwndClient ;
QMSG qmMsg ;
/* initialization */
habAnchor = WinInitialize ( 0 ) ;
hmqQueue = WinCreateMsgQueue ( habAnchor, 0 ) ;
/* register client class */
WinRegisterClass ( habAnchor,
CLS_CLIENT,
ClientWndProc,
CS_SIZEREDRAW,
0 ) ;
ulFlags = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER |
FCF_MINMAX | FCF_SHELLPOSITION | FCF_TASKLIST ;
/* create frame window and others */
hwndFrame = WinCreateStdWindow ( HWND_DESKTOP,
WS_VISIBLE,
&ulFlags,
CLS_CLIENT,
"Titlebar",
0,
NULLHANDLE,
0,
&hwndClient ) ;
if ( hwndFrame ) {
/* typical message processing */
while ( WinGetMsg ( habAnchor,
&qmMsg,
NULLHANDLE,
0,
0 ))
WinDispatchMsg ( habAnchor, &qmMsg ) ;
WinDestroyWindow ( hwndFrame ) ;
} /* endif */
/* clean-up */
WinDestroyMsgQueue ( hmqQueue ) ;
WinTerminate ( habAnchor ) ;
return 0 ;
}
MRESULT EXPENTRY ClientWndProc ( HWND hwndWnd,
ULONG ulMsg,
MPARAM mpParm1,
MPARAM mpParm2 )
{
HPS hps ;
RECTL rectl ;
ULONG ulSize ;
static CHAR achFont[15] ;
switch ( ulMsg ) {
case WM_PAINT:
hps = WinBeginPaint( hwndWnd,
NULLHANDLE,
&rectl );
/* clear screen */
GpiErase( hps ) ;
/* actually draw the text */
WinDrawText( hps, strlen( achFont), achFont, &rectl, 0, 0,
DT_CENTER | DT_VCENTER | DT_TEXTATTRS | DT_ERASERECT ) ;
/* end paint */
WinEndPaint( hps ) ;
break;
case WM_CREATE:
/* use 18 pt Times Roman */
strcpy( achFont, "18.Tms Rmn") ;
/* change the font */
WinSetPresParam( hwndWnd, PP_FONTNAMESIZE, strlen( achFont),
achFont ) ;
break;
default:
return WinDefWindowProc ( hwndWnd,
ulMsg,
mpParm1,
mpParm2 ) ;
} /* endswitch */
return MRFROMSHORT ( FALSE ) ;
}