Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

請問一下簡單的程式

0 views
Skip to first unread message

夜叉劍少異端神

unread,
May 7, 2003, 9:47:46 AM5/7/03
to

為什麼下面這個程式有ERROR阿
我是不是少弄了什麼東西

//Program Start
#include <windows.h>

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,PSTR szCmdLine,
int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("HelloWin") ;
HWND hwnd ;
MSG msg ;
WNDCLAS wndclass ;

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.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuNam = NULL ;
wndclass.lpszClassName = szAppName ;

if (!RegisterClass (&wndclass))
{
MessageBox ( NULL, TEXT ("This program requires Windows NT!")
,
szAppName, MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindow( szAppName, // window class name
TEXT ("The 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
hInstance, // program instance handle
NULL) ; // creation parameters

ShowWindow (hwnd, iCmdShow) ;
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)

{
HDC hdc ;
PAINTSTRUCT ps ;
RECT rect ;

switch (message)
{
{
case WM_CREATE:
PlaySound (TEXT ("hellowin.wav"), NULL, SND_FILENAME | SND_ASYNC) ;
return 0 ;

case WM_PAINT:
hdc = BeginPaint (hwnd, &ps) ;

GetClientRect (hwnd, &rect) ;

DrawText (hdc, TEXT ("Hello, Windows 98!"), -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER) ;
EndPaint (hwnd, &ps) ;
return 0 ;

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

//Program End
//Error Message
--------------------Configuration: HELLOWIN - Win32 Debug--------------------
Compiling...
HELLOWIN.c
D:\HELLOWIN\HELLOWIN.c(15) : error C2065: 'WNDCLAS' : undeclared identifier
D:\HELLOWIN\HELLOWIN.c(15) : error C2146: syntax error : missing ';' before iden
tifier 'wndclass'
D:\HELLOWIN\HELLOWIN.c(15) : error C2065: 'wndclass' : undeclared identifie
D:\HELLOWIN\HELLOWIN.c(17) : error C2224: left of '.style' must have struct/unio
n type
D:\HELLOWIN\HELLOWIN.c(18) : error C2224: left of '.lpfnWndProc' must have struc
t/union type
D:\HELLOWIN\HELLOWIN.c(19) : error C2224: left of '.cbClsExtra' must have struct
/union type
D:\HELLOWIN\HELLOWIN.c(20) : error C2224: left of '.cbWndExtra' must have struct
/union type
D:\HELLOWIN\HELLOWIN.c(21) : error C2224: left of '.hInstance' must have struct/

請問一下 是沒有INCLUDE什麼東西嗎
還有 我有連結MULTIMEDIA的LIB喔 就是 WINNXX.LIB之類的

可是還是濫調


--
淚....?為什麼我會流淚呢..?
有一種哀傷的感覺。

是XP! 我在電腦上灌了XP...
--
[1m╭──── [31mO [32mr [33mi [34mg [35mi [36mn [m: [1;36m<不良牛牧場> [33m bbs.badcow.com.tw [32m(210.200.247.200) [37m─────╮ [m
[1m│ [5;33m ↘ [;1;32;40mWelcome to SimFarm BBS [37m-- [31mFrom : [ [37mh220.n219-68-123.adsl.gig [31m] [37;40m │ [m
[1m╰ [;32;40m◣◣ [1m◢ ◢◢ [34m《 [37m不良牛免費撥接→電話: [36m40586000 [37m→帳號: [36mzoo [37m→密碼: [36mzoo [34m》 [;32;40m ◣◣ [1m◢ [37m─╯ [m

0 new messages