gpt4 book ai didi

c++ - 如何在 VC++ 2010 中使用 .dll 文件启动进程

转载 作者:太空宇宙 更新时间:2023-11-04 15:09:18 24 4
gpt4 key购买 nike

我正在尝试学习如何在 C++ 中使用 DLL 文件。根据我的研究,当我在我的代码中使用 DisplayNotepad() 时,这应该会打开记事本。我正在尝试编译它,但出现编译器错误,我知道 windows.h 定义了 ShellExecute,但它说找不到标识符。这是我的代码:

#include "stdafx.h"
#include <windows.h>
#include <iostream>
extern "C"
{
__declspec(dllexport) void DisplayNotepad()
{
ShellExecute(NULL, "open", "c:\\windows\\notepad.exe", NULL,NULL, SW_SHOW);
}
}

我的编译器给我以下错误:error C3861: 'ShellExecute': identifier not found。我这样做完全错了吗?感谢您的输入。

最佳答案

ShellExecute 的声明是found in Shellapi.h ,而不是 windows.h。

关于c++ - 如何在 VC++ 2010 中使用 .dll 文件启动进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5628620/

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