Code
Include < Windows. h >
/* Declare windows procedure */
Lresult callback windowprocedure (hwnd, uint, wparam, lparam );
/* Make the class name into a global variable */
Char Szclassname [] = " This is Chinese " ;
Int Winapi winmain (hinstance hthisinstance,
Hinstance hprevinstance,
Lpstr lpszargument,
Int Ncmdshow)
{
Hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are saved */
Wndclassex wincl; /* Data structure for the windowclass */
/* The window structure */
Wincl. hinstance = Hthisinstance;
Wincl. lpszclassname = Szclassname;
Wincl. lpfnwndproc = Windowprocedure; /* This function is called by Windows */
Wincl. Style = Cs_dblclks; /* Catch double-clicks */
Wincl. cbsize = Sizeof (Wndclassex );
/* Use default icon and mouse-pointer */
Wincl. hicon = Loadicon (null, idi_application );
Wincl. hiconsm = Loadicon (null, idi_application );
Wincl. hcursor = Loadcursor (null, idc_arrow );
Wincl. lpszmenuname = NULL; /* No menu */
Wincl. cbclsextra = 0 ; /* No extra bytes after the window class */
Wincl. cbwndextra = 0 ; /* Structure or the window instance */
/* Use Windows's default color as the background of the window */
Wincl. hbrbackground = (Hbrush) color_background;
/* Register the window class, and if it fails quit the program */
If ( ! Registerclassex ( & Wincl ))
Return 0 ;
/* The class is registered, let's create the program */
Hwnd = Createmediawexa (
0 , /* Extended possibilites for variation */
Szclassname, /* Classname */
" This is still Chinese " , /* Title text */
Ws_overlappedwindow, /* Default window */
Cw_usedefault, /* Windows decides the position */
Cw_usedefault, /* Where the window ends up on the screen */
544 , /* The programs width */
375 , /* And height in pixels */
Hwnd_desktop, /* The window is a child-window to desktop */
Null, /* No menu */
Hthisinstance, /* Program instance Handler */
Null /* No window creation data */
);
/* Make the window visible on the screen */
Showwindow (hwnd, ncmdshow );
/* Run the message loop. It will run until getmessage () returns 0 */
While (Getmessage ( & Messages, null, 0 , 0 ))
{
/* Translate virtual-key messages into character messages */
Translatemessage ( & Messages );
/* Send message to windowprocedure */
Dispatchmessage ( & Messages );
}
/* The program return-value is 0-the value that postquitmessage () gave */
Return Messages. wparam;
}
/* This function is called by the Windows function dispatchmessage () */
Lresult callback windowprocedure (hwnd, uint message, wparam, lparam)
{
Switch (Message) /* Handle the messages */
{
Case Wm_destroy:
Postquitmessage ( 0 ); /* Send a wm_quit to the Message Queue */
Break ;
Default : /* For messages that we don't deal */
Return Defwindowproc (hwnd, message, wparam, lparam );
}
Return 0 ;
}