From: dave@powerbasic.com (Dave Navarro)
Subject: PBDLL5: Hellowin Update
'-----------------------------------------------------------------------------
--
'
' HELLOWIN.BAS for PB/DLL
' Copyright (c) 1997,8 by PowerBASIC, Inc.
'
' Translation of HELLOWIN.C from Charles Petzold's book:
'
' "Programming Windows 95" published by Microsoft Press.
' ISBN 1-55615-676-6
'
' Note: The original code does not contain the "gradient" effect.
'
'-----------------------------------------------------------------------------
--
$COMPILE EXE
$INCLUDE "WIN32API.INC"
$RESOURCE "HELLOWIN.PBR"
'-----------------------------------------------------------------------------
-
FUNCTION WinMain (BYVAL hInstance AS LONG, _
BYVAL hPrevInstance AS LONG, _
lpCmdLine AS ASCIIZ PTR, _
BYVAL iCmdShow AS LONG) AS LONG
LOCAL Msg AS tagMsg
LOCAL wndclass AS WndClassEx
LOCAL szAppName AS ASCIIZ * 80
LOCAL hWnd AS LONG
szAppName = "HelloWin"
wndclass.cbSize = SIZEOF(WndClass)
wndclass.style = %CS_HREDRAW OR %CS_VREDRAW
' CODEPTR is used to pass the address of the function which will
' receive all messages sent to any window created with this class
wndclass.lpfnWndProc = CODEPTR( WndProc )
wndclass.cbClsExtra = 0
wndclass.cbWndExtra = 0
wndclass.hInstance = hInstance
wndclass.hIcon = LoadIcon( hInstance, "HELLOWIN" )
wndclass.hCursor = LoadCursor( %NULL, BYVAL %IDC_ARROW )
wndclass.hbrBackground = GetStockObject( %WHITE_BRUSH )
wndclass.lpszMenuName = %NULL
wndclass.lpszClassName = VARPTR( szAppName )
wndclass.hIconSm = LoadIcon( hInstance, BYVAL %IDI_APPLICATION )
RegisterClassEx wndclass
' Create a window using the registered class
hWnd = CreateWindow(szAppName, _ ' window class name
"The Hello Program", _ ' window caption
%WS_OVERLAPPEDWINDOW, _ ' window style
%CW_USEDEFAULT, _ ' initial x position
%CW_USEDEFAULT, _ ' initial y position
%CW_USEDEFAULT, _ ' initial x size
%CW_USEDEFAULT, _ ' initial y size
%NULL, _ ' parent window handle
%NULL, _ ' window menu handle
hInstance, _ ' program instance handle
BYVAL %NULL) ' creation parameters
' Display the window on the screen
ShowWindow hWnd, iCmdShow
UpdateWindow hWnd
' Main message loop:
' Messages sent to HELLOWIN while it has the focus are received by
' GetMessage(). This loop translates each message and dispatches it
' to the appropriate handler. When PostQuitMessage() is called, the
' loop terminates which ends the application.
WHILE GetMessage(Msg, %NULL, 0, 0)
TranslateMessage Msg
DispatchMessage Msg
WEND
FUNCTION = msg.wParam
END FUNCTION ' WinMain
'-----------------------------------------------------------------------------
-
SUB DrawGradient(BYVAL hWnd AS LONG)
LOCAL hDC AS LONG
LOCAL rectFill AS RECT
LOCAL rectClient AS RECT
Continued with next message...
*** QwkNews (tm) v2.1
* [TN11.1] Internet Newsgroup: alt.lang.powerbasic
--- GEcho 1.20/Pro
---------------
* Origin: Toast House Remote (1:100/561)
|