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.

GDI+ Shutdown

Featured Replies

Gentlemen,I am at my wits end :) I have a very odd problem with my gauge. Whenever I add the GDI+ shutdown code to my PANEL_SERVICE_DISCONNECT FSAPI callback function, the gauge will not display. However, if I do not add this code my gauge works fine.I have the GDI+ handling code in its own class:ULONG_PTR GDI_FRED::gdiInit(){ GdiplusStartupInput input; ULONG_PTR token; GdiplusStartup(&token, &input, NULL); return token;}void GDI_FRED::gdiShutdown(ULONG_PTR token){ GdiplusShutdown(token);}and the API Callback function(I have stuck this stuff in a dummy gauge so that when I add tons of GDI+ gauges to this thing, it will all display just fine with no headaches; at least that is the theory, as yet untested)void FSAPI dummyCallBack ( PGAUGEHDR pgauge, SINT32 service_id, UINT32 extra_data ){ switch (service_id) { case PANEL_SERVICE_CONNECT_TO_WINDOW: gdiplusToken = fred.gdiInit(); break; case PANEL_SERVICE_DISCONNECT: fred.gdiShutdown(gdiplusToken); // This line, when removed, allows everything to be displayed break; }}fred is the variable that is declared as GDI_FRED fred. And yes, I do chose interesting class names :)I don't know how to proceed. I have put my code through the debugger, and from that experience I know that the drawing code is executing, there is a HDC that I think is valid, and I know that the CONNECT_TO_WINDOW case has been called one more time than the DISCONNECT case. However, no gauge is being displayed.Thank you guys!

Each gauge have module_init and module_deinit function.By default they are empty.Put GDI+ startup and shutdown there.Works fine for me.

Strange, my GdiplusStartup/GdiplusShutdown functions are also at PANEL_SERVICE_CONNECT_TO_WINDOW and PANEL_SERVICE_DISCONNECT and never caused any problems. I haven't checked yor code in detail though.Arne Bartels

I have tried inserting that GDI+ stuff in the module init and deinit functions, with no joy.

  • Commercial Member

I have mine in PANEL_SERVICE_POST_INSTALL and PANEL_SERVICE_POST_KILL. Try that :-)Wade

  • Commercial Member

Hey Fred, I seem to have found an answer to the problem.citation_fred.pfd.cppcase PANEL_SERVICE_CONNECT_TO_WINDOW: gdiplusToken = fred.gdiInit(); //you forgot to add this linebreak;//now this workscase PANEL_SERVICE_DISCONNECT: fred.gdiShutdown(gdiplusToken);break;citation_fred.dummy.cpp//uncomment this linecase PANEL_SERVICE_DISCONNECT: GdiplusShutdown(gdiplusToken); //this onebreak;Now everything works very good, and the frames boosted. Talk to you on MSN tonight.Sincerely,Tiberiu Brasov

  • Commercial Member

Fred and guys, What was I thinking when I wrote this, it seems that I provided insufficient info. Here is the fix.// add this line, and everything is working goodcase PANEL_SERVICE_POST_INSTALL: gdiplusToken = fred.gdiInit();I apologise again for the mistake. Everything works good now.Sincerely,Tiberiu Brasov

Tibi,It works, I just don't know why ;) Talk to you on MSN.

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.