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 defines 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
ShellExecuteis found in Shellapi.h, not windows.h.