Author Topic: Request for Help: Joystick Problem  (Read 603 times)

yindengxie

  • Member
  • ***
  • Posts: 28
Request for Help: Joystick Problem
« on: August 24, 2020, 02:14:52 pm »
Hello Everyone!

 The Joystick is denied by using HID to read USB port data.  We use DirectX Input to
get the USB port data. However, there is problem to request for help:

When we type data from Dialog Box, the program  immediately stops receving Joystick data.
In this time, if we hit Main Menu Window bar,  the program will recover to receive
Joystick data.  Is it possible that while we  type data from Dialog Box, the program
will continue to receive Joystick data?

   THANKS for YOUR HELP!

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2959
    • Lakeview Research
Re: Request for Help: Joystick Problem
« Reply #1 on: August 24, 2020, 02:46:36 pm »
What does the application do with the input from the dialog box!

yindengxie

  • Member
  • ***
  • Posts: 28
Re: Request for Help: Joystick Problem
« Reply #2 on: August 24, 2020, 03:23:42 pm »
Hello Jan,

 We use Joystick to test our simulator.  Our program receives Aileron, Elevator, Rudder
and Throttle data from Joystick, but we need to input Propeller and Mixture data from Dialog
Box.  While we type the Propeller and Mixture data into Windows Dialog Box, the program
stops receiving Joystick data. In this time, we have to hit Windows Main Menu anywere, to
recover to read Joystick data. 

   THANKS Jan!

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2959
    • Lakeview Research
Re: Request for Help: Joystick Problem
« Reply #3 on: August 26, 2020, 05:42:56 pm »
What does the application do with the data that is typed in, since that is the code that is likely causing the problem.

yindengxie

  • Member
  • ***
  • Posts: 28
Re: Request for Help: Joystick Problem
« Reply #4 on: August 27, 2020, 09:03:33 am »
Hello Jan,

    The application do with the data that is typed in, No problem. It is the Windows Handle problem.
Now for the test purpose,  I use one computer and its USB port to get Joystick data, then by using
UDP to send the Joydata to the other one computer 's application program, OK!
 
    The problem is that the Directx Input needs a Windows HANDLE.  HID USB is not!
   
    THANKS, Jan!
   

ulao

  • Frequent Contributor
  • ****
  • Posts: 161
Re: Request for Help: Joystick Problem
« Reply #5 on: August 28, 2020, 08:54:56 am »


The docs already tell you what is happening:

Per MSDN

    For a windowed-mode application, this handle will be the default target window for Present. If this handle is NULL, the focus window will be taken.

So it's using whatever window happens to be in focus at the time you call Present.

Note this ambiguity was fixed for Direct3D 10 or later via DXGI. The window handle is only needed for creating the swap chain, and Direct3D device can be created independently of the swap chain (unless you are using the somewhat clunky helper function D3D11CreateDeviceAndSwapChain which does both operations at the same time).

yindengxie

  • Member
  • ***
  • Posts: 28
Re: Request for Help: Joystick Problem
« Reply #6 on: August 28, 2020, 03:01:44 pm »
THANKS ulao for your Info.