1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
|
/*
Ce fichier va contenir toutes les informations utile au chargement de la DLL
Auteur: Anubisas
Création: 27 janvier 2017
Modification: 27 janvier 2017
*/
#include "header\core.h"
#include <stdexcept>
//Variables et constantes globales
static HINSTANCE hInst = NULL;
using namespace std;
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
//Attachement d'un processuse
hInst = (HINSTANCE)hModule;
break;
case DLL_THREAD_ATTACH:
//Attachement d'un thread
break;
case DLL_THREAD_DETACH:
//Détachamemet d'un thread
break;
case DLL_PROCESS_DETACH:
//Détachamemet d'un processuse
hInst = NULL;
break;
}
return TRUE;
}
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_CREATE:
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
}
namespace Anubisas
{
void clsWindows::acCreateW(int nCmdShow)
{
MessageBox(NULL, L"Et nous voici dans la création de la fenêtre", L"Anucore.dll: init", MB_ICONINFORMATION | MB_OK);
HWND hwnd = NULL;
MSG msg;
WNDCLASS wc;
wc.style = 0;
wc.lpfnWndProc = MainWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInst;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
wc.lpszMenuName = NULL;
wc.lpszClassName = L"MaWinClass";
if (!RegisterClass(&wc)) return ;
hwnd = CreateWindow(L"MaWinClass", L"Titre", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 400, 300, NULL, NULL, hInst, NULL);
if (!hwnd) return ;
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return;
}
} |
Partager