March 10, 200422 yr 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!
March 10, 200422 yr Each gauge have module_init and module_deinit function.By default they are empty.Put GDI+ startup and shutdown there.Works fine for me.
March 10, 200422 yr 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
March 10, 200422 yr I have tried inserting that GDI+ stuff in the module init and deinit functions, with no joy.
March 12, 200422 yr Commercial Member I have mine in PANEL_SERVICE_POST_INSTALL and PANEL_SERVICE_POST_KILL. Try that :-)Wade
March 12, 200422 yr 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
March 13, 200422 yr 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
Create an account or sign in to comment