怎么使用dev-c++ ?

joyv joyv 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
小弟我刚学c++,下载了个dev-c++编译器。建立一个工程,main.cpp页面中那么多东西,怎么写程序呢?? 在哪儿写?
  • main.cpp页面:

    #include <windows.h>


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

    /* Make the class name into a global variable */
    char szClassName[ ] = "WindowsApp";


    int WINAPI
    WinMain (HINSTANCE hThisInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpszArgument,
    int nFunsterStil)

    {
    HWND hwnd; /* This is the handle for our window */
    MSG messages; /* Here messages to the application are saved */
    WNDCLASSEX wincl; /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */
    wincl.style = CS_DBLCLKS; /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);

    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL; /* No menu */
    wincl.cbClsExtra = 0; /* No extra bytes after the window class */
    wincl.cbWndExtra = 0; /* structure or the window instance */
    /* Use Windows's default color as the background of the window */
    wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

    /* Register the window class, and if it fails quit the program */
    if (!RegisterClassEx (&wincl))
    return 0;

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
    0, /* Extended possibilites for variation */
    szClassName, /* Classname */
    "Windows App", /* Title Text */
    WS_OVERLAPPEDWINDOW, /* default window */
    CW_USEDEFAULT, /* Windows decides the position */
    CW_USEDEFAULT, /* where the window ends up on the screen */
    544, /* The programs width */
    375, /* and height in pixels */
    HWND_DESKTOP, /* The window is a child-window to desktop */
    NULL, /* No menu */
    hThisInstance, /* Program Instance handler */
    NULL /* No Window Creation data */
    );

    /* Make the window visible on the screen */
    ShowWindow (hwnd, nFunsterStil);

    /* Run the message loop. It will run until GetMessage() returns 0 */
    while (GetMessage (&messages, NULL, 0, 0))
    {
    /* Translate virtual-key messages into character messages */
    TranslateMessage(&messages);
    /* Send message to WindowProcedure */
    DispatchMessage(&messages);
    }

    /* The program return-value is 0 - The value that PostQuitMessage() gave */
    return messages.wParam;
    }


    /* This function is called by the Windows function DispatchMessage() */

    LRESULT CALLBACK
    WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    switch (message) /* handle the messages */
    {
    case WM_DESTROY:
    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);
    }

    return 0;
    }
...全文

相关推荐

Dev-cpp API

较全面的Dev-cpp API5.6.0文档,可以帮助你瞬间了解关于C/C++的类库,函数库等知识,较全面的Dev-cpp API5.6.0文档,可以帮助你瞬间了解关于C/C++的类库,函数库等知识更多下载资源、学习资料

Vax_Loves_1314

Dev-Cpp.zip:C++ IDE的安装与使用指南

Dev-Cpp作为一款广受欢迎的集成开发环境(IDE),在C++编程社区拥有着悠久的历史。尽管它不是最现代的IDE工具,但在开发者中依然有着坚实的拥趸。Dev-Cpp的核心组件包括:MinGW编译器:用于编译C/C++源代码。集成开发环境(IDE):提供代码编辑、编译和调试等集成工具。项目管理器:方便用户组织和管理多个项目。用户界面:提供图形化的操作环境。Dev-Cpp提供广泛的个性化设置选项,开发者可以根据自己的喜好和工作习惯对IDE进行配置。

明月清风晓星

Dev-c++怎么设置背景色

我们在使用Dev-c++这个软件的时候,遇到夜晚等的条件下,希望使用一种暗一点的颜色,而默认的是白色的背景十分亮眼,如何进行设置呢? 先附上设置后的效果图 这种背景适合晚上开发。 设置步骤: 1.菜单上面的工具选项 2.点击编辑器选项 3.点击语法 语法的预设里面有很多种设置,我这里设置的是Twillight 但是设置好后有个问题,我们发现,选中一行后会有个很亮眼的蓝色的杠,这种严重影响了体验感 那么怎么去掉这个杠呢?很简单就可以 1.点击编辑器选项 2,将高亮显示当前行去掉 这样,看上去就舒服一些了 最终效果 作者:爱电脑的小白

weixin_38655347

DEV C++安装-2021.01.17.pdf

DEV C++安装-2021.01.17.pdf

dllglvzhenfeng

DEV C++安装-2021.01.11.pdf

DEV C++安装-2021.01.11.pdf

dllglvzhenfeng
评论 2
收藏 已收藏
分享
返回顶部
joyv
非技术区 15,445 成员 58,111 内容