亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? generic.html

?? windows系統編程 一本很好的書!值得看哦!
?? HTML
?? 第 1 頁 / 共 3 頁
字號:
    // Small icon can be loaded from the same resource
    _class.hIconSm = reinterpret_cast<HICON> (
        ::<font color="#000099"><b>LoadImage</b></font> (
            _class.hInstance, 
            MAKEINTRESOURCE (resId), 
            IMAGE_ICON, 
            ::<font color="#000099"><b>GetSystemMetrics</b></font> (SM_CXSMICON),
            ::<font color="#000099"><b>GetSystemMetrics</b></font> (SM_CYSMICON),
            0));
}

void <font color="#cc0066"><b>WinClass::Register</b></font> ()
{
    if (::<font color="#000099"><b>RegisterClassEx</b></font> (&amp;_class) == 0)
        throw WinException ("Internal error: RegisterClassEx failed.");
}
<hr>
class <font color="#cc0066"><b>TopWinClass</b></font>: public <font color="#cc0066"><b>WinClass</b></font>
{
public:
    TopWinClass (int resId, HINSTANCE hInst, WNDPROC wndProc);
};

<font color="#cc0066"><b>TopWinClass::TopWinClass</b></font> (int resId, 
           HINSTANCE hInst, WNDPROC wndProc)
    : WinClass (resId, hInst, wndProc)
{
    SetResIcons (resId);
    _class.lpszMenuName = MAKEINTRESOURCE (resId);
}</font></pre><!--End Code-->
                       <td width=20>
        </table>
        <!--End of yellow background-->


<hr><!--Text-->
Once the Windows class is registered with the system, you can create as many windows of this class as you wish. They will, of course, share the same Window procedure that was registered with the class. We'll see later how we can distinguish between various instances of the window inside the procedure.
<p>The class <font color="#cc0066"><b>WinMaker</b></font> works in much the same way as <font color="#cc0066"><b>WinClass</b></font>. Its constructor provides sensible defaults that may be overriden by calling particular methods. Once everything is set, you call the <font color="#cc0066"><b>Create</b></font> method to create the window and the <font color="#cc0066"><b>Show</b></font> method to display it. Notice that the moment you call Create, your Window procedure is called with the <font color="#009966">WM_CREATE</font> message.
<p>The top window is created using TopWinMaker class, which provides the appropriate style and caption.

<hr><!--End Text-->

         <!--Yellow background-->
        <table cellpadding=10 cellspacing=0 width="100%">
                <tr>
                      <td width=20>
            	      <td bgcolor="#e0e080">
<pre><font face="courier"><!--Code-->
class <font color="#cc0066"><b>WinMaker</b></font>
{
public:
    WinMaker (WinClass & winClass);
    operator HWND () { return _hwnd; }
    void AddCaption (char const * caption)
    {
        _windowName = caption;
    }
    void AddSysMenu ()    { _style |= WS_SYSMENU; }
    void AddVScrollBar () { _style |= WS_VSCROLL; }
    void AddHScrollBar () { _style |= WS_HSCROLL; }
    void Create ();
    void Show (int nCmdShow = SW_SHOWNORMAL);
protected:
    WinClass   & _class;
    HWND         _hwnd;

    DWORD        _exStyle;       // extended window style
    char const * _windowName;    // pointer to window name
    DWORD        _style;         // window style
    int          _x;             // horizontal position of window
    int          _y;             // vertical position of window
    int          _width;         // window width  
    int          _height;        // window height
    HWND         _hWndParent;    // handle to parent or owner window
    HMENU        _hMenu;         // handle to menu, or child-window identifier
    void       * _data;          // pointer to window-creation data
};

<font color="#cc0066"><b>WinMaker::WinMaker</b></font> (WinClass & winClass)
  : _hwnd (0),
    _class (winClass),
    _exStyle (0),       // extended window style
    _windowName (0),    // pointer to window name
    _style (WS_OVERLAPPED), // window style
    _x (CW_USEDEFAULT), // horizontal position of window
    _y (0),             // vertical position of window
    _width (CW_USEDEFAULT), // window width  
    _height (0),        // window height
    _hWndParent (0),    // handle to parent or owner window
    _hMenu (0),         // handle to menu, or child-window identifier
    _data (0)           // pointer to window-creation data
{
}

void <font color="#cc0066"><b>WinMaker::Create</b></font> ()
{
    _hwnd = ::<font color="#000099"><b>CreateWindowEx</b></font> (
        _exStyle,
        _class.GetName (),
        _windowName,
        _style,
        _x,
        _y,
        _width,
        _height,
        _hWndParent,
        _hMenu,
        _class.GetInstance (),
        _data);

    if (_hwnd == 0)
        throw WinException ("Internal error: Window Creation Failed.");
}

void <font color="#cc0066"><b>WinMaker::Show</b></font> (int nCmdShow)
{
    ::ShowWindow (_hwnd, nCmdShow);
    ::UpdateWindow (_hwnd);
}

// Makes top overlapped window with caption

<font color="#cc0066"><b>TopWinMaker::TopWinMaker</b></font> ((WinClass & winClass, char const * caption)
    : WinMaker (winClass)
{
    _style = <font color="#009966">WS_OVERLAPPEDWINDOW</font> | <font color="#009966">WS_VISIBLE</font>;
    _windowName = caption;
}

</font></pre><!--End Code-->
                       <td width=20>
        </table>
        <!--End of yellow background-->
<hr><!--Text-->

Before we go any further, here are some light-weight classes of general interest. <font color="#cc0066"><b>WinException</b></font> is something that we want to throw any time a Windows API fails. It takes care of retrieving the Windows error code. (By the way, there is an easy way to convert the error code to a string using <font color="#000099"><b>FormatMessage</b></font> API.) 
<p>The class <font color="#cc0066"><b>ResString</b></font> is a simple encapsulation of a string stored in the string resources of your application.

<hr><!--End Text-->

         <!--Yellow background-->
        <table cellpadding=10 cellspacing=0 width="100%">
                <tr>
                      <td width=20>
                      <td bgcolor="#e0e080">
<pre><font face="courier">
<font color="#cc0066">// The exception class: stores the message and the error code</font>
class <font color="#cc0066"><b>WinException</b></font>
{
public:
    WinException (char* msg)
    : _err (::<font color="#000099"><b>GetLastError</b></font>()), _msg(msg)
    {}
    DWORD GetError() const { return _err; }
    char const * GetMessage () const { return _msg; }
private:
    DWORD  _err;
    char * _msg;
};

<font color="#cc0066">// The out-of-memory handler: throws exception</font>
int <font color="#cc0066"><b>NewHandler</b></font> (size_t size)
{
    throw WinException ( "Out of memory" );
    return 0;
}

class <font color="#cc0066"><b>ResString</b></font>
{
    enum { MAX_RESSTRING = 255 };
public:
    ResString (HINSTANCE hInst, int resId);
    operator char const * () { return _buf; }
private:
    char _buf [MAX_RESSTRING + 1];
};

<font color="#cc0066"><b>ResString::ResString</b></font> (HINSTANCE hInst, int resId)
{
    if (!::<font color="#000099"><b>LoadString</b></font> (hInst, resId, _buf, MAX_RESSTRING + 1))
        throw WinException ("Load String failed");
}</font></pre>

<!--End Code-->
                      <td width=20>
        </table>
        <!--End of yellow background-->
<hr><!--Text-->
The <b>Controller</b> is the nervous system of a particular <i>window instance</i>. It is created with that window, stored with it and finally destroyed with it. You can put any state information pertaining to a particular window instance in its controller. In general, the controller has a <i>view</i> that deals with painting on the window's surface and it has access to the <i>model</i>, which is the brain of your application (this is called the MVC, or Model-View-Controller pattern invented by Smalltalk programmers). 
<p>If, as it often happens, your application has only one top-level window, you can directly embed the <i>model</i> in its controller. That simplifies the management of resources but at the cost of tight coupling of the controller with the model. In large projects one should avoid such couplings--the use of a (smart) pointer to the model inside the controller is then preferred.
<p>Most controller methods require a handle to the window on which behalf they are operating. This handle is passed with every Windows message, but it is simpler to store it once inside the controller object and use it whenever necessary. Remember--there is a one-to-one correspondence between window instances (and therefore window handles) and <i>controller</i> objects.
<hr><!--End Text-->

         <!--Yellow background-->
        <table cellpadding=10 cellspacing=0 width="100%">
                <tr>
                      <td width=20>
                      <td bgcolor="#e0e080">
<pre><font face="courier">
class <font color="#cc0066"><b>Controller</b></font>
{
public:
    Controller(HWND hwnd, CREATESTRUCT * pCreate);
    ~Controller ();
    void    Size (int x, int y);
    void    Paint ();
    void    Command (int cmd);

private:

    HWND        _hwnd;

    Model       _model;
    View        _view;
};</font></pre><!--End Code-->
                      <td width=20>
        </table>
        <!--End of yellow background-->
<hr><!--Text-->
The <b>Window Procedure</b> is the main switchboard of a Windows application. You don't call it from your program--Windows calls it! Every time something interesting happens, Windows sends your program a message. This message is passed to your window procedure. You may deal with it, or you may pass it on to the <i>default window procedure</i>.

<p>Window procedure is called with a handle to a window to which a given message is directed. This handle uniquely identifies an internal Windows' data structure that corresponds to a given window instance. It so happens that we can access this data structure and use it to store some instance-specific data. Here's the type safe way of accessing this structure. By the way, the <font color="#009966">GWL_USERDATA</font> member of this structure is guaranteed to be present in all windows, including message boxes, dialog boxes and even buttons.
<hr><!--End Text-->
         <!--Yellow background-->
        <table cellpadding=10 cellspacing=0 width="100%">
                <tr>
                      <td width=20>
                      <td bgcolor="#e0e080">
<pre><font face="courier"><!--Code-->
template &lt;class T&gt;
inline T <font color="#cc0066"><b>WinGetLong</b></font> (HWND hwnd, int which = <font color="#009966">GWL_USERDATA</font>)
{
    return reinterpret_cast&lt;T&gt; (::<font color="#000099"><b>GetWindowLong</b></font> (hwnd, which));
}

template &lt;class T&gt;
inline void <font color="#cc0066"><b>WinSetLong</b></font> (HWND hwnd, T value, int which = <font color="#009966">GWL_USERDATA</font>)
{
    ::<font color="#000099"><b>SetWindowLong</b></font> (hwnd, which, reinterpret_cast&lt;long&gt; (value));
}
</font></pre><!--End Code-->
                       <td width=20>
        </table>
        <!--End of yellow background-->
<hr><!--Text-->
Every time Windows calls our window procedure, we want to first retrieve its controller object. Remember, there may be several windows sharing the same window procedure and we want to have a separate controller for each window. How do we know which controller to use when we are called? We find out by looking at the window handle. In this handle we store the pointer to this particular window's controller using the Win[Set/Get]Long trick.

<p>The Window procedure is first called with the <font color="#009966">WM_CREATE</font> message. At that time we <b>create the controller</b> object and initialize it with the window handle and a special data structure called <font color="#009966">CREATESTRUCT</font> that is passed to us by Windows. Once we have the controller, we store the pointer to it in the corresponding internal Windows' data structure under the label of the current <b>hwnd</b>. Next time the Window procedure is called, with a message other than <font color="#009966">WM_CREATE</font>, we simply retrieve the pointer to our controller using the <b>hwnd</b>.
<p>The rest is easy. The Window procedure interprets message parameters and calls the appropriate methods of the controller.
<hr><!--End Text-->
         <!--Yellow background-->
        <table cellpadding=10 cellspacing=0 width="100%">
                <tr>
                      <td width=20>
                      <td bgcolor="#e0e080">
<pre><font face="courier">
LRESULT CALLBACK <font color="#cc0066"><b>WndProc</b></font>
    (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品人妖ts系列视频| 色综合色综合色综合| 日韩一级大片在线| 日韩精品一级二级 | 精品污污网站免费看| 亚洲精品一二三区| 欧美三级午夜理伦三级中视频| 亚洲最大成人网4388xx| 777午夜精品免费视频| 麻豆一区二区在线| 久久久久免费观看| 91社区在线播放| 亚洲一区二区三区激情| 欧美一区二区三区日韩视频| 国产一区二区三区香蕉| 中文字幕日韩一区| 欧美精品在线视频| 国产一区二区三区久久悠悠色av| ●精品国产综合乱码久久久久| 欧美午夜精品久久久久久孕妇| 日本欧美在线观看| 国产女同互慰高潮91漫画| 成人av在线播放网址| 亚洲成人动漫一区| 国产欧美一区二区在线| 在线一区二区三区四区五区| 美腿丝袜亚洲色图| 亚洲日本电影在线| 欧美tickling挠脚心丨vk| 99久久精品免费看国产| 人人狠狠综合久久亚洲| 综合色中文字幕| 日韩视频一区在线观看| 色综合久久久久网| 国产一区二区在线影院| 午夜精品久久一牛影视| 欧美国产一区在线| 国产精品电影一区二区三区| 欧洲亚洲国产日韩| 高清shemale亚洲人妖| 日本不卡不码高清免费观看| 国产精品美女久久久久av爽李琼 | 99免费精品视频| 久久精品国产澳门| 艳妇臀荡乳欲伦亚洲一区| 欧美精彩视频一区二区三区| 91精品国产全国免费观看| 91猫先生在线| 懂色av一区二区三区免费看| 老司机精品视频线观看86| 亚洲精选免费视频| 国产精品免费丝袜| 久久久久久久精| 欧美va亚洲va香蕉在线 | 欧美午夜电影网| 白白色 亚洲乱淫| 国产乱码精品1区2区3区| 婷婷夜色潮精品综合在线| 亚洲欧美日韩国产中文在线| 日本一区二区视频在线| 欧美电视剧在线看免费| 欧美视频在线不卡| 91麻豆视频网站| 色综合亚洲欧洲| 色婷婷香蕉在线一区二区| 激情综合网av| 蜜臀av亚洲一区中文字幕| 菠萝蜜视频在线观看一区| 国产最新精品免费| 精品一区二区在线看| 蜜臀av性久久久久av蜜臀妖精| 亚洲一区欧美一区| 亚洲一区二区综合| 亚洲女同ⅹxx女同tv| 亚洲免费电影在线| 一区二区三区免费在线观看| 亚洲精品视频一区| 亚洲电影视频在线| 午夜精品久久久久久久久久久| 一区二区免费看| 午夜免费久久看| 奇米在线7777在线精品| 另类小说图片综合网| 狠狠狠色丁香婷婷综合久久五月| 久久国内精品自在自线400部| 美女视频第一区二区三区免费观看网站| 五月天视频一区| 久久精品国产一区二区三 | 国产亚洲综合在线| 欧美激情综合网| 亚洲特黄一级片| 亚洲一区电影777| 秋霞电影网一区二区| 狠狠色丁香久久婷婷综合_中| 国产高清在线观看免费不卡| 99久免费精品视频在线观看| 欧洲av一区二区嗯嗯嗯啊| 5858s免费视频成人| 久久青草欧美一区二区三区| 国产精品久久久久久户外露出| 亚洲精品成人在线| 免费成人av在线| 成人aa视频在线观看| 欧美日韩在线三级| 久久综合九色欧美综合狠狠| 国产精品乱码久久久久久| 亚洲国产一区视频| 国产精品自拍在线| 一本色道a无线码一区v| 在线播放国产精品二区一二区四区| 欧美videossexotv100| 亚洲人精品午夜| 极品美女销魂一区二区三区 | 九色综合狠狠综合久久| 成人一区在线观看| 欧美日韩视频专区在线播放| 久久综合久久综合久久综合| 亚洲精品国产品国语在线app| 人人超碰91尤物精品国产| caoporn国产一区二区| 欧美丰满少妇xxxbbb| 中文字幕欧美国产| 奇米四色…亚洲| 色综合天天做天天爱| 欧美成人性战久久| 一区二区日韩电影| 国产精品1024| 欧美一区二区三区视频在线| 亚洲视频一区二区在线| 国产永久精品大片wwwapp| 欧美综合色免费| 中文欧美字幕免费| 老司机精品视频导航| 欧美三片在线视频观看| 亚洲国产精品ⅴa在线观看| 久久99久久精品| 欧美日本在线播放| 亚洲欧美一区二区三区国产精品| 精一区二区三区| 欧美巨大另类极品videosbest | 欧美一级艳片视频免费观看| 日韩毛片视频在线看| 懂色中文一区二区在线播放| 日韩一级高清毛片| 三级成人在线视频| 欧美视频在线播放| 亚洲一线二线三线久久久| av男人天堂一区| 中文字幕欧美区| 国产99精品在线观看| 日韩精品中文字幕一区 | 久久蜜桃av一区精品变态类天堂 | 精品一区二区影视| 欧美一级片在线观看| 五月激情综合色| 欧美日韩一区二区三区免费看| 日韩美女视频19| 色综合网站在线| 亚洲精选免费视频| 91久久免费观看| 亚洲人123区| 一本色道亚洲精品aⅴ| 亚洲视频小说图片| 一本色道久久综合亚洲91| 中文字幕综合网| 91色九色蝌蚪| 一区二区三区日韩精品视频| 一本色道**综合亚洲精品蜜桃冫| 亚洲天堂网中文字| 欧美影视一区在线| 偷拍一区二区三区四区| 欧美精品三级在线观看| 日本麻豆一区二区三区视频| 日韩亚洲电影在线| 激情图片小说一区| 久久精品男人天堂av| 福利91精品一区二区三区| 国产精品三级电影| 色香蕉久久蜜桃| 五月综合激情婷婷六月色窝| 欧美一区中文字幕| 精彩视频一区二区| 国产精品久久久久久久久图文区| 99精品视频中文字幕| 亚洲综合色区另类av| 337p亚洲精品色噜噜噜| 久久草av在线| 国产欧美日韩精品a在线观看| 91影院在线免费观看| 午夜激情综合网| 久久先锋影音av鲁色资源 | 色狠狠一区二区| 丝袜亚洲另类丝袜在线| www成人在线观看| 99久久综合色| 日韩制服丝袜av| 久久久一区二区| 色欧美乱欧美15图片| 日韩精品久久久久久| 国产欧美一区二区在线|