delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/02/04/20:42:11

From: Keetnet AT wilmington DOT net (Keet / Foxbird)
Subject: Win32 Apps?
4 Feb 1998 20:42:11 -0800 :
Message-ID: <3.0.32.19980204203105.0068ff98.cygnus.gnu-win32@wilmington.net>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

Does anyone out there have any idea what's causing this? 

//D/CygWin/b18/H-i386-cygwin32/i386-cygwin32/bin/ld.exe: warning: cannot
find entry symbol _WinMainCRTStartup; defaulting to 00401000

I took a hello world program from a VC++ I've got and compiled it with GCC
using the options -luser32 -lgdi32 -Wl,--subsystem,windows  to remove the
dos box, and I got this warning. The program executes fine, but I'm trying
to ciphen out all of the warnings and such from some of my code. I've seen
mentions to removing the dos box, and compiling win32 apps under GCC, but I
never saw mention as to what this means. Can anyone help me? (Hello.cpp
file is at the end)


// HELLO: a Windows API style program
// Copyright 1996, Mark Andrews

#include <windows.h>

long WINAPI WndProc(HWND hwnd,
    UINT message, UINT wParam, LONG lParam) 
{
    HDC         hdc;
    HPEN        hpen, hpenOld;
    PAINTSTRUCT ps;
    RECT        rect;
            
    switch (message) {
        case WM_PAINT:
            hdc = BeginPaint(hwnd, &ps);
            GetClientRect(hwnd, &rect);
            hpen = CreatePen(PS_SOLID, 6, RGB(0, 0, 255));
            hpenOld = SelectObject(hdc, hpen);
            Rectangle(hdc, rect.left + 10,
                rect.top + 10,
                rect.right - 10,
                rect.bottom - 10);
               
            DrawText(hdc, "Hello, world!", -1, &rect,
                DT_SINGLELINE | DT_CENTER | DT_VCENTER);
               
            SelectObject(hdc, hpenOld);
            DeleteObject(hpen);
            EndPaint(hwnd, &ps);
            return 0;
        case WM_DESTROY:
            PostQuitMessage(0);
            return 0;
    }
    return DefWindowProc(hwnd, message, wParam, lParam);
}

int WINAPI WinMain(HANDLE hInstance, HANDLE hPrevInstance,
    LPSTR lpszCmdParam, int nCmdShow)
{
    static char szAppName[] = "Hello";
    HWND        hwnd;
    MSG         msg;
    WNDCLASS    wndclass;

    if (!hPrevInstance) {
        wndclass.style         = CS_HREDRAW | CS_VREDRAW;
        wndclass.lpfnWndProc   = WndProc;
        wndclass.cbClsExtra    = 0;
        wndclass.cbWndExtra    = 0;
        wndclass.hInstance     = hInstance;
        wndclass.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
        wndclass.hCursor       = LoadCursor(NULL, IDC_ARROW);
        wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
        wndclass.lpszMenuName  = NULL;
        wndclass.lpszClassName = szAppName;

        RegisterClass(&wndclass);
    }

    hwnd = CreateWindow(szAppName,  // window class name
        "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
        NULL);                      // creation parameters

   ShowWindow(hwnd, nCmdShow);
   UpdateWindow(hwnd);

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


-
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