zoukankan      html  css  js  c++  java
  • 添加启动类

    添加.h和cpp

    #pragma once
    #include "afxwin.h"
    class mySplash :
        public CWnd
    {
        DECLARE_DYNAMIC(mySplash)
    
    protected:
    
        DECLARE_MESSAGE_MAP()
    
    public:
    
        CBitmap m_bitmap;
    
        void Create(UINT nBitmapID);
    
        afx_msg void OnPaint();
    
        afx_msg void OnTimer(UINT_PTR nIDEvent);
    public:
        mySplash(void);
        ~mySplash(void);
    };
    #include "stdafx.h"
    
    #include "mySplash.h"
    
    IMPLEMENT_DYNAMIC(mySplash, CWnd)
    
    mySplash::mySplash()
    
    {
    
    }
    
    mySplash::~mySplash()
    
    {
    
    }
    
    BEGIN_MESSAGE_MAP(mySplash, CWnd)
    
        ON_WM_PAINT()
    
        ON_WM_TIMER()
    
    END_MESSAGE_MAP()
    
    void mySplash::Create(UINT nBitmapID)
    
    {
    
        m_bitmap.LoadBitmap(nBitmapID);
    
        BITMAP bitmap;
    
        m_bitmap.GetBitmap(&bitmap);
    
        CreateEx(0,AfxRegisterWndClass(0, AfxGetApp()->LoadStandardCursor(IDC_ARROW)),NULL, WS_POPUP | WS_VISIBLE, 0, 0, bitmap.bmWidth, bitmap.bmHeight, NULL, NULL);
    
    }
    
    void mySplash::OnPaint()
    
    {
    
        CPaintDC dc(this); 
    
        BITMAP bitmap;
    
        m_bitmap.GetBitmap(&bitmap);
    
        CDC dcComp;
    
        dcComp.CreateCompatibleDC(&dc);
    
        dcComp.SelectObject(&m_bitmap);
    
        dc.BitBlt(0, 0, bitmap.bmWidth, bitmap.bmHeight, &dcComp, 0, 0, SRCCOPY);
    
    }
    
    void mySplash::OnTimer(UINT_PTR nIDEvent)
    
    {
        DestroyWindow(); //销毁初始画面窗口
    }

    而后在initdialog中添加

    mySplash wndSplash; //创建启动窗口类的实例
    wndSplash.Create(IDB_BITMAP1);
    wndSplash.CenterWindow();
    wndSplash.UpdateWindow(); //send WM_PAINT
    Sleep(2500);
    wndSplash.DestroyWindow();//销毁初始画面窗口
  • 相关阅读:
    ubuntu环境下快速搭建开发环境
    Ubuntu安装mysql及设置远程访问方法
    lua 获取指定目录下指定后缀文件名
    DLL远程注入及卸载实现
    c字符检测函数
    数据库bcp导入导出批处理工具
    Schtasks命令详解(计划任务DOS批处理)
    lmathlib文件
    Github常用命令【转】
    Github上传代码菜鸟超详细教程【转】
  • 原文地址:https://www.cnblogs.com/jsxyhelu/p/5971285.html
Copyright © 2011-2022 走看看