Subject: Windows application
From: [email-masked] (LO)

2 Sep 1998 11:29:35 -0700
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: [email-masked]

Hi,

I saved the following code in a file called w.c.The code is supposed to
create a Microsoft Windows applicaton.
I am using Windows 95 and cygwinb19 on a Intel Pentium PC.
//------------start-----------------//
#include <windows.h>
#include <stdlib.h>
#include <string.h>

long FAR PASCAL WndProc (HWND hWnd, WORD iMessage, WORD wParam, LONG
lParam);
int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance, LPSTR
lpszCmdParam, int nCmdShow)

{
HWND hWnd;
MSG Message;
WNDCLASS WndClass;

if (!hPrevInstance)
{
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hbrBackground = GetStockObject(WHITE_BRUSH);
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hIcon = LoadIcon (NULL,  "END");
WndClass.hInstance = hInstance;
WndClass.lpfnWndProc = WndProc;
WndClass.lpszClassName = "w";
WndClass.lpszMenuName = "MENU";
WndClass.style = CS_HREDRAW | CS_VREDRAW;

RegisterClass (&WndClass);
}

hWnd = CreateWindow ("w",
"Fundamental Window",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
0,
NULL,
NULL,
hInstance,
NULL);

ShowWindow (hWnd, nCmdShow);
while (GetMessage (&Message, 0, 0, 0))
{
TranslateMessage(&Message);
DispatchMessage(&Message);
}
return Message.wParam;
}

long FAR PASCAL WndProc (HWND hWnd, WORD iMessage, WORD wParam, LONG
lParam)
{
switch(iMessage)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return(DefWindowProc(hWnd, iMessage, wParam, lParam));
}
}
//-----------------end-------------------------------------
w.c is in the dierctory C:\Cygnus\B19\
I then type GCC W.C at the prompt.
Nothing appears on screen for about 5 seconds.
Then the following text appears. What I typed is in bold text.

BASH.EXE-2.01$ GCC W.C
W.C: In function `int WinMain(void *, void *, char *, int)':
W.C:22: assignment to `long int (*)(void *, unsigned int, unsigned int,
long int
)' from `long int (*)(void *, short unsigned int, short unsigned int,
long int)'

BASH.EXE-2.01$

Does anyone know whats wrong? The program is from the book "Windows 3.1
Programmers Reference" and is published by Que.

Liam O'Keeffe.
Web site: http://homepages.iol.ie/~lo7

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".