Window not visible

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



The following SDK application works fine using gcc-

gcc -mwindows simple_window.c -o first_sdk.c

But compiling with VC6 my application window is invisible.

Nmake -f makefile

Attached are the source code (first_sdk.c) and
the makefile I am using to compile code.

How do I set a window visible?

/* File: first_sdk.c
*
* Description:
*
*
* Created:
* 12 Feb 2008 -
*/
#include <windows.h>

LONG WINAPI WndProc(HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow){
WNDCLASS wc;
HWND hwnd;
MSG msg;

wc.style = 0; /* Class style */
wc.lpfnWndProc = (WNDPROC) WndProc; /* Window procedure address */
wc.cbClsExtra = 0; /* Class extra bytes */
wc.hInstance = hInstance; /* Window extra bytes */
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); /* Icon handle */
wc.hCursor = LoadCursor (NULL, IDC_ARROW); /* Cursor handle */
wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); /* Background color
*/
wc.lpszMenuName = NULL; /* Menu name */
wc.lpszClassName = "MyWndClass"; /* WNDCLASS */

RegisterClass (&wc);

hwnd = CreateWindow("MyWndClass", /* WNDCLASS */
"SDK Application", /* Window title */
WS_OVERLAPPEDWINDOW, /* Window style */
CW_USEDEFAULT, /* Horizontal position */
CW_USEDEFAULT, /* Vertical position */
CW_USEDEFAULT, /* Initial width */
CW_USEDEFAULT, /* Initial height */
HWND_DESKTOP, /* Handle of parent window
*/
NULL, /* Menu handle */
hInstance, /* Application's instance
handle */
NULL /* Window-creation data */
);

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

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

LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam,
LPARAM lParam){
PAINTSTRUCT ps;
HDC hdc;

switch(message){

case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
Ellipse (hdc, 0, 0, 200, 100);
EndPaint(hwnd, &ps);
return 0;

case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}

# File: makefile
#
# Description:
#
#
# Created:
# 15 Feb 2008 -
#
# Nmake macros for building Windows 32-Bit apps
!include <win32.mak>

PROJ = first_sdk

all: $(PROJ).exe

# Define project specific macros
PROJ_OBJS= first_sdk.obj
BASE_OBJS =
EXTRA_LIBS=
GLOBAL_DEP=
RC_DEP=

# Inference rule for updating the object files
..c.obj:
$(cc) $(cdebug) $(cflags) $(cvars) $*.c

# Build rule for EXE
$(PROJ).EXE: $(BASE_OBJS) $(PROJ_OBJS)
$(link) $(linkdebug) $(guilflags) \
$(BASE_OBJS) $(PROJ_OBJS) $(guilibs) $(EXTRA_LIBS) \
-out:$(PROJ).exe $(MAPFILE)
.



Relevant Pages

  • Re: SVGA, LCD, Win CE 6.0 and PB
    ... site addressing display drver issues, not to mention the source code. ... travel down thru Win CE from boot.ini to the place genrating final LCD ... I can have a desktop larger than physical screen window. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: how to hide the WZC dialog
    ... Use Remote Registry Editor and export the entire device registry to ... If I manualy check the checkbox, then the window won't appear anymore, ... I did not find this source code, ... <apellerin AT adeneo DOT adetelgroup DOT ...
    (microsoft.public.windowsce.embedded)
  • Re: vcbuild usage questions
    ... and .vcproj files will be created and put somewhere, ... command lines in my nmake makefiles to use vcbuild. ... which means I "can't get nmake to invoke vcbuild only when the ... nmake makefile to build the ProjectName project? ...
    (microsoft.public.vc.language)
  • Build for Windows Mobile Failed
    ... I successfully ran configure.bat (without an architecture type as ... I ran nmake and he complaint following: ... Copyright Microsoft Corp 1988-1998. ... Opened the makefile in my editor and look up the line. ...
    (comp.lang.ruby)
  • Re: makefile for /proc module
    ... Why not look at the sample source code in /usr/src/linux? ... that has a correct makefile for building the module without doing a kernel ... compile, and c source code for a very simple /proc/xxyyzz device that can ... compiling with the makefile they supply. ...
    (comp.os.linux.development.system)