麻烦那位大哥,帮我把这改成java啊.小弟编程好烂啊.
#include<windows.h>
INT PASCAL winmain(HINSTANCE,HINSTANCE,LPSTR,INT);
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
HINSTANCE MYHINST;
char szAppName[]="WINAPIDEOM";
char szAppTitle[]="windows title myhinst name?";
int pascal winmain(HINSTANCE hInstance,HINSTANCE hprevInstance,LPSTR lpszCmdParam,INT nCmdShow)
{
HWND hMainwnd;
MSG message;
WNDCLASS myWC;
if(!hprevInstance)
{
myWC.style =CS_HREDRAW|CS_VREDRAW;
myWC.lpfnWndProc=WndProc;
myWC.cbClsExtra=0;
myWC.cbWndExtra=0;
myWC.hInstance=hInstance;
myWC.hIcon=LoadIcon(NULL,IDI_APPLICATION);
myWC.hCursor=LoadCursor(NULL,IDC_ARROW);
myWC.hbrBackground=(HBRUSH) GetStockObject (WHITE_BRUSH) ;//HBRUSH(GetStockObject(WHITE_BRUSH));
myWC.lpszMenuName=NULL;
myWC.lpszClassName=szAppName;
RegisterClass(&myWC);
}
hMainwnd=CreateWindow(szAppName,szAppTitle,WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
ShowWindow(hMainwnd,SW_SHOWMAXIMIZED);
UpdateWindow(hMainwnd);
while(GetMessage(&message,NULL,0,0))
{
TranslateMessage(&message);
DispatchMessage(&message);
}
return message.wParam;
}
LRESULT CALLBACK WndProc(HWND hMainwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
char MsgLBTN[]="DOWK SU BIAO LEFT!";
char MsgRBTN[]="DOK SU BIAO RIHET!";
switch(message)
{
case WM_RBUTTONDOWN:
{
MessageBeep(MB_ICONINFORMATION);
MessageBox(GetFocus(),MsgRBTN,"Message",MB_OK|MB_ICONINFORMATION);
break;
}
case WM_LBUTTONDOWN:
{
MessageBeep(MB_ICONINFORMATION);
MessageBox(GetFocus(),MsgLBTN,"Message",MB_OK|MB_ICONINFORMATION);
break;
}
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
default:
break;
}
return DefWindowProc(hMainwnd,message,wParam,lParam);
}
其中
myWC.hbrBackground=(HBRUSH) GetStockObject (WHITE_BRUSH) ;//HBRUSH(GetStockObject(WHITE_BRUSH));