March 29, 200719 yr Arne,I notice that you do this:void FSAPI gauge_cb( PGAUGEHDR pgauge, int service_id, UINT32 extra_data ){ static HWND fswnd = NULL; switch(service_id) { CASE PANEL_SERVICE_PRE_INSTALL fswnd = FindWindow("FS98", NULL); StoreInstanceHandle( (HINSTANCE)extra_data ); InitDirectInput( fswnd ); SetAcquire( fswnd ); break; }}First, I notice that you can get the window handle like this: if ( FAILED( hr = InitDirectInput( GetModuleHandle(NULL) ) ) ) { return(0); }or SetAcquire( GetModuleHandle(NULL));when you make the calls, like above, so no need to base it on the "FS98", or even store it.But, I have a question... what the heck is this StoreInstanceHandle( (HINSTANCE)extra_data ); call doing, and what is "extra_data"?Thanks
March 29, 200719 yr Correction, you can't get the window handle like that, only a HMODULE (but then you knew that no doubt).Anyway, DirectInput is much easier than DirectSound, and I have it working now, but still wondering what the extra_data and function do.
March 29, 200719 yr extra_data is one of the parameters passed to the callback function. Check the definition of PANEL_SERVICE_PRE_INSTALL in GAUGES.H. The various values are outlined there as comments.Doug
March 29, 200719 yr Moderator Actually, I find the comment on the PANEL_SERVICE_POST_INSTALL a bit on the confusing side, since that is where most folks read any so-called "5th parameter information" that one might wish to pass to the gauge from the panel.cfg entry.Am I correct to assume then that - absent any such 5th parameter data - that the "extra_data" will still contain the resource_handle? Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
March 29, 200719 yr >Actually, I find the comment on the>PANEL_SERVICE_POST_INSTALL a bit on the confusing side, since>that is where most folks read any so-called "5th parameter>information" that one might wish to pass to the gauge from the>panel.cfg entry.>>Am I correct to assume then that - absent any such 5th>parameter data - that the "extra_data" will still contain the>resource_handle?Not sure what it will contain on POST_INSTALL - nothing is noted in gauges.h on that line. Sounds like an interesting experiment...Keep in mind that the parameter information you mention is at pgauge->parameters, not extra_data.Doug
March 30, 200719 yr OK, so I was on drugs this afternoon... :-eek POST_INSTALL will get the resource handle as the extra_data value. Full Stop.Doug
March 30, 200719 yr Moderator >Not sure what it will contain on POST_INSTALL - nothing is>noted in gauges.h on that line. Sounds like an interesting>experiment...>Keep in mind that the parameter information you mention is at>pgauge->parameters, not extra_data.My gauges.h file shows the same comment for both PRE and POST_INSTALL:#define PANEL_SERVICE_PRE_INSTALL 2 // extra_data = resource_handle#define PANEL_SERVICE_POST_INSTALL 3 // extra_data = resource_handleActually, I've never fully comprehended what 'magic' is happening in the gauges.h file. I'd always assumed that "extra_data" and "parameters" were referring to the same thing. I guess I just know enough to be a bit less dangerous than a complete ignoramous! *:-* Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
March 30, 200719 yr Resources are still a bit of magic for me... so I'm not entirely sure how to use a resourc_handle, but reminding me about the 5th parameter thing helped.Anyway, turned out it was not necessary to get DirectInput working for the keyboard or joystick. But it gives me an idea of an easy way to have the user be able to set the key which will actuate a particular gauge. They can pass it in the 5th parameter. Now where is that code to read the 5th parameter again.... haha =)
Create an account or sign in to comment