Keda and I are working on a new project together, he's off for some holidays now, and I'm stuck with a simple problem, at least, it should be simple since I've done this before.

Ok here's the deal. I'm making an app that detects right-clicks everywhere on the screen, and using a systemwide hook for it, and yes that's the way I want to do it

It compiles without errors, but when I debug, I see that when I try to get the address with GetProcAddress that it returns 0.
So I think it must be in the DLL, that it doesn't export the functions well or something.

main.cpp
Code:
#include <windows.h>
#include <iostream>
#include <string>
#include <vector>

#include "main.h"
#include "resource.h"


using namespace std;

//Global variables
HHOOK g_hMouseHook;
HWND g_hWnd;
HINSTANCE g_hInstDLL;

typedef HHOOK (*INITPROC)(HOOKPROC); 
typedef VOID (*KILLPROC)(VOID); 

INITPROC mInitProc;
KILLPROC mKillProc;

HINSTANCE g_hInst; 

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){
	g_hInst = hInstance;
	DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(DLG_Main), NULL, MainDialogProc);
	return 0;
}

BOOL CALLBACK MainDialogProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam){
switch(Message)
	{
	case WM_INITDIALOG:
		//Set global variables.
		g_hWnd = hwnd;

		//Load DLL and hook mouse
		g_hInstDLL = LoadLibrary((LPCTSTR) "dll"); 
			if (!g_hInstDLL) DisplayError("Failed opening DLL");
		mInitProc = (INITPROC) GetProcAddress(g_hInstDLL, "InitHook");
		/*if 	(!mInitProc){
			DisplayError("Failed getting ProcAddress"); 
			return 0; 
		} */
		g_hMouseHook = mInitProc(MouseProc); //Access violation over here.


		if (!g_hMouseHook) DisplayError("Failed creating Hook");
			
	return TRUE;

	case WM_COMMAND:
		switch(LOWORD(wParam))
            {
					//Knopjes en ****
				break;
            }
    break;

	case WM_CLOSE:
		//KILL THE ****ING HOOK 
		mKillProc = (KILLPROC)GetProcAddress(g_hInstDLL, "KillHook");
		(mKillProc);
	FreeLibrary(g_hInstDLL); 
		EndDialog(hwnd, WM_CLOSE);
		
	break;

	default:
		return FALSE;
	}	

	return TRUE;
}

dll.cpp
Code:
#include <windows.h>

HHOOK g_hMouseHook;


__declspec(dllexport) HHOOK __stdcall InitHook(HOOKPROC MouseProc){
	g_hMouseHook = SetWindowsHookEx(WH_MOUSE, MouseProc,NULL,0); 
	return g_hMouseHook;
}

__declspec(dllexport) void __stdcall KillHook(){
	UnhookWindowsHookEx(g_hMouseHook);
}
dll.def
Code:
LIBRARY DLL

EXPORTS
    InitHook
    KillHook

I've tried different things with the DLL, like no __declspec etc. but I just can't get it to work.
Maybe I'm missing something? or is my VS just ****ing me by not using the DEF file? (it's in the same dir as the dll.cpp)

Anyhow, thanks alot for all your time reading this, appreciate it Glad to be back by the way, for the people who still know me over here