鱼C论坛

 找回密码
 立即注册
查看: 1021|回复: 1

[争议讨论] 来说说你们开发一个mfc程序的步骤

[复制链接]
发表于 2022-2-19 13:24:30 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
来说说你们开发一个mfc程序的步骤
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2022-10-25 23:55:06 | 显示全部楼层
本帖最后由 howzyao 于 2022-10-25 23:57 编辑

WinMain里写:

set_cursor_title();

    SetTimer(NULL, 10, 20, TimeProc);

    while (GetMessage (&messages, NULL, 0, 0))
    {
      
        TranslateMessage(&messages);
      
        DispatchMessage(&messages);
    }

   
    return messages.wParam;


回调里写:



EndBatchDraw();

    callback_input();

    switch (message)                  /* handle the messages */
    {
        case WM_CREATE:

            break;
        case WM_DESTROY:
            KillTimer(NULL, 10);
            PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
            break;
        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    KillTimer(NULL, 10);

    return 0;



定时事件里写
void CALLBACK TimeProc(HWND hwnd, UINT message, UINT idTimer, DWORD dwTime)
{
    cnt ++;
    //FlushBatchDraw(); //每20毫秒画一次
    //EndBatchDraw();


    update();

    EndBatchDraw();
}





顶上的写:


#if defined(UNICODE) && !defined(_UNICODE)
    #define _UNICODE
#elif defined(_UNICODE) && !defined(UNICODE)
    #define UNICODE
#endif

#include <tchar.h>
#include <graphics.h>
#include <mmsystem.h>
#include <Vfw.h>
#include <direct.h>
#include <math.h>
#include <time.h>
#include <stdio.h>
#include <conio.h>
UINT cnt = 0;
//定时器回调函数
void CALLBACK TimeProc(HWND hwnd, UINT message, UINT idTimer, DWORD dwTime);

//线程回调函数
DWORD CALLBACK WindowProcedure(PVOID pvoid);

/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/*  Make the class name into a global variable  */
TCHAR szClassName[ ] = _T("e3 首个GUI32工程 需要按一下win键才能点击关闭 退出");

const int gw=1024;
const int gh=768;

/*  Make the class name into a global variable  */
TCHAR szClassName[ ] = _T("e3 首个GUI32工程 需要按一下win键才能点击关闭 退出");

const int gw=1024;
const int gh=768;
MOUSEMSG msg;
MSG messages;
char name[128];
HWND mciwnd;
HWND hwnd;
RECT screen;
POINT screenlt,screenrb;
HCURSOR nullcursor;
void set_cursor_title();
int getmsg();
void up();
void down();
void left();


void right();
void pause();
void pause_title();
void play_sound(int);
void preparation();
void over();

IMAGE a,      b,         c,     d;
IMAGE amask,  bmask, cmask, dmask;
void loadimg()
{
        loadimage(&amask,"./res/bg00.dat");
        loadimage(&a,"./res/bg02.png");
        loadimage(&bmask,"./res/ball00.dat");
        loadimage(&b,"./res/ball01.dat");
        loadimage(&cmask,"./res/block00.dat");
        loadimage(&c,"./res/block01.dat");
        loadimage(&dmask,"./res/paddle00.dat");
        loadimage(&d,"./res/paddle01.dat");
}

class e
{
        int len;
        int *x,*y,*state,*mx,*my;
        public:
                e();
           ~e();
                e(int);
        void putpng(IMAGE&,IMAGE&);
        void set_statu(int,int);
        void set_xy(int,int,int);
        int  get_len();
        int  get_state();
        void paddle_move(IMAGE&);
        void block_stage(int);
};

e bg(1);
e ball(16);
e block(102);
e paddle(1);



void init_paddle();
void init_ball();
void init();
void update();
void the_millisecond_delay(int ms);
//加上几个e::中的方法不列举


外加说明:
GUI32工程学习
依旧要头库文件和设置链接器:
-leasyx //使用graphics.h时秘须要的参数
-lwinmm //使用mmsystem.h时必须要的参数


就跑起来了.



https://fishc.com.cn/thread-219940-1-1.html

这里有截图,和下载附件运行.
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-4-30 22:33

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表