Why this doesnt work with Visual studio...

D

djuro.tost

#include <windows.h>



LONG FAR PASCAL WndProc(HWND,UINT,WPARAM,LPARAM);

char szProgName[]="ProgName";

// Remove next line for Microsoft C++ compile
//#pragma argsused

int PASCAL WinMain(HINSTANCE hInst,HINSTANCE hPreInst,
LPSTR lpszCmdLine,int nCmdShow)
{
HWND hWnd;
MSG lpMsg;
WNDCLASS wcApp;
if (!hPreInst) {
wcApp.lpszClassName=szProgName;
wcApp.hInstance =hInst;
wcApp.lpfnWndProc =WndProc;
wcApp.hCursor =LoadCursor(NULL,IDC_ARROW);
wcApp.hIcon =NULL;
wcApp.lpszMenuName =NULL;
//wcApp.hbrBackground=GetStockObject(WHITE_BRUSH);
wcApp.style =CS_HREDRAW|CS_VREDRAW;
wcApp.cbClsExtra =0;
wcApp.cbWndExtra =0;
if (!RegisterClass (&wcApp))
return FALSE;
}
hWnd=CreateWindow(szProgName,"Simple Windows Application",
WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,(HWND)NULL,(HMENU)NULL,
(HANDLE)hInst,(LPSTR)NULL);
ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);
while (GetMessage(&lpMsg,NULL,NULL,NULL)) {
TranslateMessage(&lpMsg);
DispatchMessage(&lpMsg);
}
return(lpMsg.wParam);
}

LONG FAR PASCAL WndProc(HWND hWnd,UINT messg,
WPARAM wParam,LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;

switch (messg)
{
case WM_PAINT:
hdc=BeginPaint(hWnd,&ps);
//--------- your routines below ---------


//--------- your routines above ---------
ValidateRect(hWnd,NULL);
EndPaint(hWnd,&ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return(DefWindowProc(hWnd,messg,wParam,lParam));
}
return(0L);
}
 
U

Ulrich Eckhardt

(e-mail address removed) wrote:
[some win32 code]

Sorry, but this isn't helpful. You should describe what you did (which is
what the code does, though it could perhaps be shorted a bit), what you
expected to happen and what happened instead. Like this, it will only be
guessing for anyone that could perhaps help you. For further info, I
suggest Eric S. Raymond's excellent essay on "smart questions", which you
should be able to locate with a websearch easily.

Apropos guessing: TCHAR!=char

Uli
 
K

Keith Thompson

#include <windows.h>
[34 lines deleted]

The folks in comp.os.ms-windows.programmer.win32 can probably help you
with this. To help them help you, I suggest you (a) put your question
in the body of the message, not just the subject line, and (b) tell
them exactly *how* it doesn't work.
 
R

Richard Bos

(e-mail address removed) wrote:

[ Snip code ]

Please put your question in the post as well as in the subject. And be
clearer.

As for the code itself, it doesn't work probably because you've done
some things that are rather silly even by the usual Windows API
standards of silliness. It looks like you're programming for 1992, not
for 2009. For more details, ask in a Windows programming group, not
here.

Richard
 
J

jfbode1029

On Mar 16, 12:50 am, (e-mail address removed) wrote:

[snip code]

Can you give a brief description of what you're expecting the code to
do and what errors the compiler is generating? Otherwise I'm not sure
what to tell you.

And ye flipping Gods, I am so glad I never had to do Win32
programming; that's just *ugly*.
 
C

CBFalconer

#include <windows.h>

This is not a standard C include file.
LONG FAR PASCAL WndProc(HWND,UINT,WPARAM,LPARAM);

FAR, PASCAL, the types HWND, UINT, WPARAM, LPARAM are undefined.

for a start. Try a newsgroup where those things are understood.
Probably one with either or both of microsoft and windows in its
name.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top