ok, I'll try this, and tell you if it works. thank you General Reed and FERSIS
EDIT :
I took a look at the globstruct.h file, and I found a function ptr called "typedef DWORD ( *PTR_ProcessMessages ) ( void );"
I think I must use this function, but the windows message processing fucnton take 4 arguments, this does not match... :S
What really does this function???
re-EDIT :
I found where the function I was looking for was. I managed to replace it by my function, while still calling it at each call of mine. But a problem still remains : darkGDK can read my mouse and keyboard, but my window doesn't react. I mean I can't close it, resize it, etc...
re-re-EDIT :
I found the solution of my problem. I forgot to return the result of the old windowProc function.
here is my corrct code : (sorry for french comments :S)
#include <darkGDK.h>
#include <globstruct.h>
#include <windows.h>
LRESULT CALLBACK My_WM_Proc(HWND, UINT, WPARAM, LPARAM);
static WNDPROC message_process;
void DarkGDK(void)
{
unsigned int cpt;
unsigned int nDevices;
unsigned int res_size;
char tampon[1024];
char convert[512];
PRAWINPUTDEVICELIST pRawInputDeviceList;
RAWINPUTDEVICE to_register[1];
PRAWINPUT data;
data = (PRAWINPUT)malloc(5*sizeof(RAWINPUT));
if (GetRawInputDeviceList(NULL, &nDevices, sizeof(RAWINPUTDEVICELIST)) != 0) {exit(0);}
if ((pRawInputDeviceList = (PRAWINPUTDEVICELIST)malloc(sizeof(RAWINPUTDEVICELIST) * nDevices)) == NULL) {exit(0);}
if (GetRawInputDeviceList(pRawInputDeviceList, &nDevices, sizeof(RAWINPUTDEVICELIST)) == -1) {exit(0);}
for (cpt=0; cpt < nDevices; cpt++)
{
sprintf(tampon, "device no %dn", cpt);
dbPrint(tampon);
strcpy(tampon, "-> type = ");
switch(pRawInputDeviceList[cpt].dwType)
{
case RIM_TYPEHID:
strcat(tampon, "HID");
break;
case RIM_TYPEKEYBOARD:
strcat(tampon, "keyboard");
break;
case RIM_TYPEMOUSE:
strcat(tampon, "mouse");
break;
}
strcat(tampon, "(");
sprintf(convert, "%d", pRawInputDeviceList[cpt].dwType);
strcat(tampon, convert);
strcat(tampon, ")n");
dbPrint(tampon);
GetRawInputDeviceInfo(pRawInputDeviceList[cpt].hDevice, RIDI_DEVICENAME, tampon, &res_size);
dbPrint(tampon);
}
free(pRawInputDeviceList);
to_register[0].usUsagePage=0x01;
to_register[0].usUsage=0x02;
to_register[0].dwFlags=0;
to_register[0].hwndTarget=0;
//RegisterRawInputDevices(to_register, 1, sizeof(to_register));
// on change le pointeur de fonction vers la fonction de gestion des messages
message_process = (WNDPROC)GetWindowLongPtr(g_pGlob->hWnd, GWLP_WNDPROC);
SetWindowLongPtr(g_pGlob->hWnd, GWLP_WNDPROC, (LONG)My_WM_Proc);
dbWaitKey();
dbMakeObjectCube(1, 2);
while (LoopGDK())
{
dbSetCursor(0, 0);
dbPrint((LONGLONG)&message_process);
dbPrint((LONGLONG)dbMouseClick());
dbRotateObject(1, dbObjectAngleX(1)+0.1f, 0.0f, 0.0f);
dbSync();
}
exit (1);
}
LRESULT CALLBACK My_WM_Proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// I get what I want for my mouse
// then I return the call of old windowProc function
return CallWindowProc(message_process, hwnd, uMsg, wParam, lParam);
}
thank you very much to all of you and to thegamecreators team