delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/05/30/11:26:03

From: jbanes AT midplains DOT net (theace)
Subject: Simple windows program won't compile
30 May 1997 11:26:03 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <338DE7DB.1F7E8FA2.cygnus.gnu-win32@midplains.net>
Mime-Version: 1.0
X-Mailer: Mozilla 4.0b3 [en] (Win95; I)
Original-To: gnu-win32 AT cygnus DOT com
X-Priority: 3 (Normal)
Original-Sender: owner-gnu-win32 AT cygnus DOT com

This is a multi-part message in MIME format.
--------------8FF23694039500A1C52CB538
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

   Hello. I have a little problem that I was hoping someone could help
with. I can not figure out why the following program won't compile
without errors. If you don't see anything wrong with it, could you try
compiling it and see if you have problems? Thank you.

Begin Program:

--------------8FF23694039500A1C52CB538
Content-Type: text/plain; charset=us-ascii; name="test1.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="test1.txt"

#include <windows.h>

LRESULT CALLBACK MyFunc(HWND, UNIT, WPARAM, LPARAM);

char szWinName[] = "MyWin";

int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int nWinMode)
{
 HWND hwnd;
 MSG msg;
 WNDCLASS wcl;

 wcl.hInstance = hThisInst;
 wcl.lpszClassName = szWinName;
 wcl.lpfnWndProc = MyFunc;
 wcl.style = 0;
 wcl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
 wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
 wcl.lpszMenuName = NULL;

 wcl.cbClsExtra = 0;
 wcl.cbWndExtra = 0;

 wcl.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);

 
 if(!RegisterClass(&wcl)) return 0;

 hwnd = CreateWindow(szWinName, "Windows 95 Skeleton", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hThisInst, NULL);

 ShowWindow(hwnd, nWinMode);
 UpdateWindow(hwnd);

 while(GetMessage(&msg, NULL, 0, 0))
 {
  TranslateMessage(&msg);
  DispatchMessage(&msg);
 }

 return msg.wParam;

}

LRESULT CALLBACK MyFunc(HWND hwnd,UNIT message, WPARAM wParam, LPARAM lParam)
{
 
 switch(message) 
 {
   case WM_DESTROY:
    PostQuitMessage(0);
    break;
   default:
    return DefWindowProc(hwnd, message, wParam, lParam);

 }

 return 0;

}


--------------8FF23694039500A1C52CB538--

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019