开发者

How to start a process using a .dll file in VC++ 2010

I am trying to learn how to use DLL file in C++. According to my research, this should open notepad when I use the DisplayNotepad() in my code. I am trying to compile it but I am getting compiler errors and I know for a fact windows.h de开发者_运维问答fines ShellExecute but it says identifier not found. here is my code:

#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);
 }
}

My compiler is giving me the following error: error C3861: 'ShellExecute': identifier not found. Am I doing this completely wrong? Thanks for the input.


The declaration of ShellExecute is found in Shellapi.h, not windows.h.


Shell headers are not included by default. Always include the header listed in the documentation (in this case shellapi.h).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜