I did try apply DirectX input to using joystick for my HID emulation, but my testing program failure in SetCooperativeLevel() API on dinput. At the result of analyse, I found FLTK API fl_xid() returns wrong HWND value from debuger.
Just inspected real HWND(handle of window) value with Process Hacker. It was something wrong in internal value of calling fl_xid(); like below image.
To verify in presumption of fact, I did compare with my FLTK DX8 joystick example, and it has exactly right HWND value in calling fl_xid();. Difference is only multi window in one program. Is it a cause of wrong HWND?
Whatever is reason, I need change my code to getting HWND in source code.
//HWND hCurWin = fl_xid( winMain ); HWND hCurWin = GetWinHandle( GetCurrentProcessId() );
It was just simple, and GetWinHandle() is following.
HWND GetWinHandle(ULONG pid)
{
HWND hTmp = FindWindow( NULL, NULL );
while( hTmp != NULL )
{
if( GetParent(hTmp) == NULL )
{
if( pid == ProcIDFromWnd( hTmp ) )
{
return hTmp;
}
}
hTmp = GetWindow( hTmp, GW_HWNDNEXT );
}
return NULL;
}I don’t have time to know what’s wrong in fl_xid(), but it will be good solution to using DirectX devices in FLTK windows program.

