gpt4 book ai didi

c++ gui 编程资源

转载 作者:行者123 更新时间:2023-11-30 04:29:13 24 4
gpt4 key购买 nike

我正在参加 Skills USA 编程比赛,我不确定比赛将如何进行,但我知道一些规则。最大的问题是你不能带任何源代码。我也听老师说QT Creator是不允许的。

如果我要在没有 QT(或任何其他库包)的情况下使用 C++ 进行编码,但我必须使用 Windows 本地的东西...我应该怎么做。

我在一个网站上找到了这组代码。它所做的只是创建一个窗口,我会更多地探索这个选择,但看看它有多少代码......

#include <windows.h>

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

static char sClassName[] = "MyClass";
static HINSTANCE zhInstance = NULL;

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
WNDCLASSEX WndClass;
HWND hwnd;
MSG Msg;

zhInstance = hInstance;

WndClass.cbSize = sizeof(WNDCLASSEX);
WndClass.style = NULL;
WndClass.lpfnWndProc = WndProc;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hInstance = zhInstance;
WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
WndClass.lpszMenuName = NULL;
WndClass.lpszClassName = sClassName;
WndClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);

if(!RegisterClassEx(&WndClass)) {
MessageBox(0, "Error Registering Class!", "Error!", MB_ICONSTOP | MB_OK);
return 0;
}

hwnd = CreateWindowEx(WS_EX_STATICEDGE, sClassName, "db Tutorial", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,

CW_USEDEFAULT,
320, 240, NULL, NULL, zhInstance, NULL);

if(hwnd == NULL) {
MessageBox(0, "Error Creating Window!", "Error!", MB_ICONSTOP | MB_OK);
return 0;
}

ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);

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

return Msg.wParam;
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
switch(Message) {
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, Message, wParam, lParam);
}
return 0;
}

学习更多这方面的知识我不会有问题,但由于不允许我携带源代码,我将不得不记住其中的大部分内容。那没有发生。

有没有什么方法可以在 C++ 中创建窗口/按钮而不需要我使用 QT 之类的东西或键入一页代码来创建一个空窗口?我看过谷歌,一切都是关于 QT 创建者的。任何帮助都会很棒。

我不是在寻找“简单的出路”,只是我能够记住并当场输入的东西,而无需访问 c++ 教科书之外的示例。

最佳答案

我查看了 web site它说
计算机程序设计

Competition consists of project coding and output, a skill-related written test and an interview. The contestants will receive a packet that includes instructions to the written test and each of the two projects. Each project's specifications are written for Visual Basic, Java, C#, C++ and RPG. The projects will be saved on the Desktop in a folder called "SkillsUSA Contestant#_." All projects will be downloaded to a jump drive or diskette (whichever the student prefers) and transferred to a main station to be printed, both code and screen.

似乎您可以使用上述任何一种语言。您将获得一两个作业,并被要求对其进行编码。如果要包含任何 UI,作为 C++ 编码器,您将处于劣势。 VB 编码人员可能最容易分配 UI 类型。

关于c++ gui 编程资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9536684/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com