“WINAPI”是什么意思? main函数中的意思是什么?

发布于 2024-08-23 08:28:43 字数 406 浏览 4 评论 0原文

您能给我解释一下 WinMain() 函数中的 WINAPI 一词吗?

以最简单的方式..

#include <windows.h>

int -->WINAPI<-- WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
    LPSTR lpCmdLine, int nCmdShow)
{
    MessageBox(NULL, "Goodbye, cruel world!", "Note", MB_OK);
    return 0;
}

这只是一些 Windows 时髦模式吗?

它有什么作用?或者更确切地说,我还没有遇到过这个 C++ 功能是什么?

Could you please explain to me the WINAPI word in the WinMain() function?

In the simplest way..

#include <windows.h>

int -->WINAPI<-- WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
    LPSTR lpCmdLine, int nCmdShow)
{
    MessageBox(NULL, "Goodbye, cruel world!", "Note", MB_OK);
    return 0;
}

Is it just some Windows funky mode?

What does it do? Or rather what is this C++ feature I haven't encountered yet?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

吃→可爱长大的 2024-08-30 08:28:43

WINAPI 是一个宏,其计算结果为 __stdcall< /code>,一个 Microsoft 特定的关键字,指定被调用者清理堆栈的调用约定。函数的调用者和被调用者需要就调用约定达成一致,以避免损坏堆栈。

WINAPI is a macro that evaluates to __stdcall, a Microsoft-specific keyword that specifies a calling convention where the callee cleans the stack. The function's caller and callee need to agree on a calling convention to avoid corrupting the stack.

输什么也不输骨气 2024-08-30 08:28:43

这是一个宏定义,旨在表示 Windows 调用约定。来自 MSDN

名称的装饰方式取决于
关于语言以及编译器如何
被指示执行该功能
可用,即调用
习俗。标准进程间
Windows 使用的调用约定
DLL 称为 WinAPI
习俗。它是在 Windows 中定义的
头文件为 WINAPI,位于
使用 Win32 转定义
声明符 __stdcall。

This is a macro definition intended to denote the Windows calling convention. From MSDN:

The way the name is decorated depends
on the language and how the compiler
is instructed to make the function
available, that is, the calling
convention. The standard inter-process
calling convention for Windows used by
DLLs is known as the WinAPI
convention. It is defined in Windows
header files as WINAPI, which is in
turn defined using the Win32
declarator __stdcall.

我的痛♀有谁懂 2024-08-30 08:28:43

WINAPI 是一个扩展为 __stdcall 的宏,这意味着被调用者清理堆栈。

WINAPI is a macro that expands to __stdcall which means that the callee cleans the stack.

独自←快乐 2024-08-30 08:28:43

它是 Windows 特定的。它指定调用约定。 WinMain 由 Windows 调用,这可确保调用者和被调用者就调用约定达成一致。

It's Windows-specific. It specifies the calling convention. WinMain gets called by Windows, and this ensures that the caller and callee agree on the calling convention.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文