One of the contact VC: winSDK

Source: Internet
Author: User
Tags bool win32

Preset directory:

Part I.: WINSDK

Part II: MFC Class Foundation, C + + program writing specification Introduction

Part III: MFC Based on dialog box program

Part IV: DLL dynamic link library

Part V: COM Component basics

Part VI: COM components several common techniques: IDispatch, can connect objects.

Part VII: Application of COM components, and MFC COM Authoring

Part I.: WINSDK

Learning VC has been nearly a year, looking back on my study history is really very difficult. There is no teacher to teach, there is no good book to see in the library. In order to buy a good book, the body of silver nearly spend light, had to live frugally life. In recent days to start their own writing what the intention, one can be a summary of their learning situation. Secondly, ask a master, can help point out the mistakes and omissions. Three may be helpful to beginners, and at the very least can practise writing.

Ok. Talk business. First of all, MFC (Microsoft Foundation Class) is a class library used to build WIN32 programs, but it is based on the Windows ancestor-windows SDK, which dates back to the window 3.x era. Its entire structure is written by C. More importantly, its program structure is still the fundamental of the WIN32 program. Therefore, in the process of learning VC, understanding its program structure is the fundamental to write Win32 program.

Below, is an example of a winSDK program (excerpt from Mr. Hou's "simple and Simple MFC", in the Houtie site has its traditional electronic version of the book)

int CALLBACK WinMain (hinstance hinstance, hinstance hprevinstance,lpstr lpcmdline, int ncmdshow)
{
MSG msg;
if (!hprevinstance)
if (! InitApplication (HINSTANCE))
Return (FALSE)
if (! InitInstance (HINSTANCE, nCmdShow))
return (FALSE);
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&MSG);
DispatchMessage (&MSG);
}
return (Msg.wparam);
}
BOOL initapplication (hinstance hinstance)
{
Wc.style = Cs_hredraw | Cs_vredraw;
Wc.lpfnwndproc = (WNDPROC) WNDPROC;
Wc.cbclsextra = 0;
Wc.cbwndextra = 0;
Wc.hinstance = hinstance;
Wc.hicon = LoadIcon (hinstance, "Jjhouricon");
Wc.hcursor = LoadCursor (NULL, Idc_arrow);
Wc.hbrbackground = Getstockobject (White_brush);
Wc.lpszmenuname = "Genericmenu";
Wc.lpszclassname = "Mywindow";
Return (RegisterClass (&WC));
}
BOOL InitInstance (hinstance hinstance, int ncmdshow)
{
HWnd = CreateWindow ("Mywindow", "This is Windows SDK",
Ws_overlappedwindow,
Cw_usedefault,
Cw_usedefault,
Cw_usedefault,
Cw_usedefault,
Null
Null
HINSTANCE,
NULL);
if (hWnd = NULL)
return (FALSE);
ShowWindow (HWnd, ncmdshow);
UpdateWindow (HWND);
return (TRUE);
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM WPARAM, LPARAM LPARAM)
{
Switch (message)
{
Case Wm_destroy:
PostQuitMessage (0);
Break
Default
Return Defwindowpro (hWnd, message, WParam, LParam);
}
return 0;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.