Application framework Design (2): Window Class of SW system

Source: Internet
Author: User

After explaining the message allocation mechanism, let's begin by introducing the Winx window class. In order to have a comparative effect, I decided to start with the "SW System" window Class I wrote earlier. After you understand the Windows class of the SW system, let's look at what happened to the design of the window class in Winx 6 years later. This is also my personal change in the concept of the window class.

1, SW system of "hello,world!" Program

#define Uses_SApp
#include <sw.h>
// SW系统中,你需要记住头文件只有
,它是SW系统总控文件。
// 你只需要告诉它,你用了什么,它可以为你检测需要的头文件并包含它们。
// 例如,这里我们用了SApp类,故有 #define Uses_SApp 一句。

class SHelloApp : public SApp
{
public:
 void OnDraw(SHDC dc);
};

void SHelloApp::OnDraw(SHDC dc)
{
 dc.TextOut(1, 1, _T(“Hello, World!”));
}

// SW系统没有封装WinMain函数,这应该是一个好消息吧?
// 你不必对主函数是main()而非是WinMain太过关心。它只是为了与DOS
// 习惯兼容以及书写的方便而实现的宏而已。
int main()
{
 return Desktop.Execute(new SHelloApp);
 // Desktop就是Windows系统桌面,它是一个特殊的窗口对象。
 // 特别注意,SW系统中App类是一个窗口!
}

2, SW System of class system diagram

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.