Using the API's vc-main architecture

Source: Internet
Author: User

When using VC to write Windows programs, I do not like to use MFC, here I will be the API way of the VC program used in various ways to record down.

VC using the API

First, the main structure

1. Create a new Windows Forms project in VS2008 and select "Empty Project";

2. Create a new "main.cpp" file in the project, the code is at the end of the text;

3. Create a new dialog form resource in the project and set its ID to "Idd_main";

4. Compile and run.

#include"resource.h"#include<windows.h>#include<stdio.h>///////////////////////////////////////////////////////////////////////////intCALLBACK Dlgproc (HWND hdlg, UINT umsg, WPARAM WPARAM, LPARAM LPARAM);///////////////////////////////////////////////////////////////////////////intapientry WinMain (hinstance hinstance, hinstance hprevinstance, LPSTR lpcmdl INE,intnShowCmd)    {DialogBox (hinstance, Makeintresource (Idd_main), NULL, Dlgproc); return 0;}////////////////////////////////////////////////////////////////////////////intCALLBACK Dlgproc (HWND hdlg, UINT umsg, WPARAM WPARAM, LPARAM LPARAM) {Switch(umsg) { Casewm_command: {Switch(LoWord (WParam)) { CaseIDOK: {MessageBox (0,"Hello world!","This is the title",0); }                 Break; }        }         Break;  Casewm_initdialog: {} Break;  Casewm_close: {enddialog (hdlg,0); }         Break; }    return 0;}

Using the API's vc-main architecture

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.