Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

DirectInput problems

Featured Replies

I am still trying to have keystrokes in my gauges.I really can't make it, I am definitely not good at using DirectX...I tried to do like it was coded in the DirectInput keyboard sample, and the very first line fails:HRESULT result = DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID**)&g_pDI, NULL);Compilation gives the following error:'DirectInput8Create' : different types for formal and actual parameter 3That's strange, because this line is exactly the same as in the sample "keyboard.cpp".If you know anything about DirectX or DirectInput, please let me know, I'm stuck.Thanks for any help !!

I can't recall why, but I use:if( FAILED( hr = DirectInputCreate( GetModuleHandle(NULL), DIRECTINPUT_VERSION, /*IID_IDirectInput, (VOID**)*/&g_pDI, NULL ) ) ).... together with #define DIRECTINPUT_VERSION 0x0300 before #include . Maybe it was something with the DirectX version.Arne Bartels

I have just discovered that the problem is the difference between C and C++. My gauges are in C, based on the FS2002 SDK. The DirectX SDK and samples are in C++.I have just compiled a very small C++ sample and it works fine. The same in C does NOT work.Can someone tell me how can I compile the FS2002 gauges in C++ instead of C?Thanks in advance !!

I finally could make it work, everything is fine.I have understood that COM objects could also be called from C using their virtual table pointer. It is strange, but it works.Keyboard shortcuts now work fine in my gauges.Thanks for your help !!

If you insist on compiling in C++ you can do several things: - save your gauges source with .cpp extension, so they will be compiled as C++ code (provided you use the fs2k2gauges.h which is adapted to allow C++ compiling). The main gauge code will still be plain C, but this way should give better results if compiled together with C++ parts.- use different files for different code, e.g. let all gauge specific code in .c files and the C++ part in .cpp files, add the .cpp to the gauge project (VC++, makefile approach is different). To allow access to the C++ parts create an interface .h file that uses extern "C" declaration for C-style functions, include the interface .h from both C and C++ files and profgram the functions itself in the C++ part. e.g. in the interface .h #ifdef __cplusplusextern "C" {#endifanytype0 function0(anytype00 variable00,....);anytype1 function1(anytype10 variable10,....);...#ifdef __cplusplus}#endifPlace the actual function code in the .cpp fileanytype0 function0(anytype00 variable00,....){....//You can place any C++ specific code here, because it is a C++ file...}...The functions are plain C style and can be called this way both from .c and .cpp files.-the last way as you described is that possibly C and C++ access is possible for COM- and related code (I haven't tried this approach yet).Arne Bartels

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.