Required Tools: Microsoft Visual Studio (any version)
Steps:
1. Open Microsoft Visual Studio and select Create : Project.
2. In new Project select Visual C++ --> Win32 --> Win32 Project --> Put Your DLL Name then click OK.
3. In Win32 Application Wizard - Your DLL Name, click NEXT.
4. Then select DLL --> Empty Project and click FINISH.
5. Now in Solution Explorer Menu (Note: If you can't see your Solution Explorer Menu just select VIEW --> Solution Explorer or Ctrl + Alt + L). Right click Source Files --> Add --> New Item.
6. Then in New Item Menu select Code --> C++ File (.cpp) --> Enter Name (like: Main or Base) --> then click Add.
7. After adding your Item (Main.cpp).. time to paste the Main DLL source code.
- Code:
-
#include <windows.h>
BOOL WINAPI DllMain(HMODULE hDll, DWORD dwReason, LPVOID lpReserved)
{
switch(dwReason)
{
case DLL_PROCESS_ATTACH:
// If your DLL is attached or injected
// Call your code here
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
8. And that's it
.. Next Tutorial Building a DLL.