norains的专栏

只专注于WINCE开发

用户操作
[即时聊天] [发私信] [加为好友]
norainsID:norains
131143次访问,排名641好友0人,关注者28
代码其实是一种乐趣
norains的文章
原创 186 篇
翻译 0 篇
转载 10 篇
评论 258 篇
norains的公告
联系方式请看置顶文章
最近评论
zhli6:如果我们想令该PIN作为GPIO并输出high,那么代码如下:
REG_HW_PINCTRL_MUXSEL0_SET(BF_PINCTRL_MUXSEL0_BANK0_PIN08(3));
REG_HW_PINCTRL_DOUT0_CLR(1 << 8);
REG_HW_PINCTRL_DOE0_SET(1 << 8);……
晴天:請問一下:
如果要寫成Watchdog timer 納在這這要如何實現呢?
hustpanda:电子书看不了呢?
bobo:“耍大牌”...... 你就该直接拉黑
bulrush:你好,首先先感谢一下。我看了你的音量控制,自己也去实现了一下,但是我个人感觉“AudioUpdateFromRegistry”没有依据注册表的设置来更新控制面板的音量。没有马上更新,我重启系统后才看到更新的结果。也就是说这种方法是可行,但是必须要重启,显然这不合理。上面的兄弟说:引用了这两个类后不起作用
如:
void CSoundDlg::OnSoft()
……
文章分类
收藏
    相册
    动漫
    文章图片
    程序交流
    xumercury的BLOG
    狗友们的博客
    清蒸石斑鱼
    美女如刀锋
    茁茁的BLOG
    魅力老姐的窝
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    原创 用SDK创建一个简单的窗口收藏

    新一篇: EVC的"OK"和"X" | 旧一篇: EVC隐藏任务栏

    //=====================================================================================================
    //TITLE:
    //  用SDK创建一个简单的窗口
    //AUTHOR:
    //  norains
    //DATE:
    //  Friday 7-April-2006
    //=====================================================================================================
      在EVC编译环境下,不使用MFC框架创建一个极其简单的窗口----甚至连关闭按钮都没有,只有最简单的消息循环.
      此代码分为两个文件,分别是:HelloWindow.h和HelloWindow.cpp;代码根据《WindowCE程序设计》一书的第一个代码例子进行精简。
      
      
    /*-----------------HelloWindow.h----------------------*/
    //----------------------------------------------------------------------
    // Function prototypes

    // Returns number of elements
    int InitApp (HINSTANCE);
    HWND InitInstance (HINSTANCE, LPWSTR, int);
    int TermInstance (HINSTANCE, int);

    // Window procedures
    LRESULT CALLBACK MainWndProc (HWND, UINT, WPARAM, LPARAM);

    // Message handlers
    LRESULT DoDestroyMain (HWND, UINT, WPARAM, LPARAM);

     


    /*---------------HelloWindow.cpp----------------------*/
    #include "stdafx.h"
    #include "HelloWindow.h"
    //----------------------------------------------------------------------
    // Global data
    //
    const TCHAR szAppName[] = TEXT ("HelloCE");
    HINSTANCE hInst;                     // Program instance handle

    int WINAPI WinMain( HINSTANCE hInstance,
         HINSTANCE hPrevInstance,
         LPTSTR    lpCmdLine,
         int       nCmdShow)
    {
      // TODO: Place code here.
     
      MSG msg;
        int rc = 0;
        HWND hwndMain;

        // init application
        rc = InitApp (hInstance);
        if (rc) return rc;

        // Initialize this instance.
        hwndMain = InitInstance (hInstance, lpCmdLine, nCmdShow);
        if (hwndMain == 0)
            return 0x10;

        // Application message loop
        while (GetMessage (&msg, NULL, 0, 0)) {
            TranslateMessage (&msg);
            DispatchMessage (&msg);
        }
        // Instance cleanup
        return TermInstance (hInstance, msg.wParam);

     return 0;
    }

    //----------------------------------------------------------------------
    // InitApp - Application initialization
    //
    int InitApp (HINSTANCE hInstance) {
        WNDCLASS wc;

        // Register application main window class.
        wc.style = 0;                             // Window style
        wc.lpfnWndProc = MainWndProc;             // Callback function
        wc.cbClsExtra = 0;                        // Extra class data
        wc.cbWndExtra = 0;                        // Extra window data
        wc.hInstance = hInstance;                 // Owner handle
        wc.hIcon = NULL,                          // Application icon
        wc.hCursor = NULL;                        // Default cursor
        wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
        wc.lpszMenuName =  NULL;                  // Menu name
        wc.lpszClassName = szAppName;             // Window class name

        if (RegisterClass (&wc) == 0) return 1;

        return 0;
    }

    //----------------------------------------------------------------------
    // InitInstance - Instance initialization
    //
    HWND InitInstance (HINSTANCE hInstance, LPWSTR lpCmdLine,
                       int nCmdShow) {
        HWND hWnd;

        // Save program instance handle in global variable.
        hInst = hInstance;

        // Create main window.
        hWnd = CreateWindow (szAppName,           // Window class
                             TEXT("Hello"),       // Window title
                             WS_VISIBLE,          // Style flags
                             CW_USEDEFAULT,       // x position
                             CW_USEDEFAULT,       // y position
                             CW_USEDEFAULT,      // Initial width
                             CW_USEDEFAULT,      // Initial height
                             NULL,                // Parent
                             NULL,                // Menu, must be null
                             hInstance,           // Application instance
                             NULL);               // Pointer to create parameters
                            
         /*----------------------------------------------------------------------------------------------------
         //------If you want the window not to display in the taskbar,you should use the following code.------//
          hWnd=CreateWindowEx(WS_EX_TOOLWINDOW|WS_EX_NOACTIVATE, // Window type
                         szAppName,      // Window class
                         TEXT("Hello"),    // Window title
                         WS_POPUP,       // Style flags
                         CW_USEDEFAULT,    // x position
                         CW_USEDEFAULT,    // y position
                         CW_USEDEFAULT,    // Initial width
                         CW_USEDEFAULT,    // Initial height
                         NULL,        // Parent
                         NULL,        // Menu, must be null
                         hInstance,      // Application instance
                         NULL         // Pointer to create parameters
                         );
        
         -----------------------------------------------------------------------------------------------------*/

        // Return fail code if window not created.
        if (!IsWindow (hWnd)) return 0;

        // Standard show and update calls
        ShowWindow (hWnd, nCmdShow);
        UpdateWindow (hWnd);
        return hWnd;
    }

    //----------------------------------------------------------------------
    // TermInstance - Program cleanup
    //
    int TermInstance (HINSTANCE hInstance, int nDefRC) {

        return nDefRC;
    }

    //----------------------------------------------------------------------
    // MainWndProc - Callback function for application window
    //
    LRESULT CALLBACK MainWndProc (HWND hWnd, UINT wMsg, WPARAM wParam,
                                  LPARAM lParam)
    {
       
        // Search message list to see if we need to handle this
        // message.  If in list, call procedure.
      switch(wMsg)
      {
     case WM_DESTROY:
      return DoDestroyMain(hWnd,wMsg,wParam,lParam);
     default:
      return DefWindowProc (hWnd, wMsg, wParam, lParam);
      }
    }

    //----------------------------------------------------------------------
    // DoDestroyMain - Process WM_DESTROY message for window.
    //
    LRESULT DoDestroyMain (HWND hWnd, UINT wMsg, WPARAM wParam,
                           LPARAM lParam) {
        PostQuitMessage (0);
        return 0;
    }

    发表于 @ 2006年06月02日 14:28:00|评论(loading...)|编辑

    新一篇: EVC的"OK"和"X" | 旧一篇: EVC隐藏任务栏

    评论:没有评论。

    发表评论  


    登录
    Csdn Blog version 3.1a
    Copyright © norains