• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

VS2010 - HUDplusC++

Started by Patrice Terrier, February 23, 2011, 03:33:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Patrice Terrier

Here is the final version of the VS2010 C++ HUDplus project.


What is new:


  • You can use drag & drop from the explorer to play a specific audio file.
  • Sometimes the maximized HUD window could be overlapped by the visual plugin during restore, it has been fixed.
  • Further EXE size reduction (25 Kb), using Florent Heyworth's project configuration.
  • The fall down effect being used at startup, has been reworked to be flicker free.
  • New audio theme Attractor.ogg.
  • New visual plugin Hud_Attractor.dll (it will never have twice the same appearance).


Screen shot




How to use the project:


  • Use the combo to select an audio file from the dedicated audio folder, or use drag and drop from explorer.
  • Use the combo to select a new visual plugin.
  • Use the checkbox "Visual plugin" to start the background animation.
  • Use the checkbox "Transparent HUD mode" to see the animation behind the graphic control.
  • Use any of the circular knob gauges to rotate the sprite image at any angle.
  • Use the left mouse button to move the sprite image inside of the graphic control.
  • Use the vertical slider on the right of the graphic control to zoom the sprite image in/out.
  • Use the folder button, to select a new image to display in the graphic control.
  • To select a new theme frame, click with the left or right mouse button on the Neytiri's face icon, located on the top left corner.


Note:
This project is meant to be used on VISTA/Seven running in AERO mode.
Because the size of the ZIP has increased to 9060 Kb, i was not able to post it here as an attachment.
You will have to download it from this link: HUDplusC++.zip

Note:
The extended window class WS_EX_ACCEPTFILES has been used with the main window to ease the handling of drag and drop (no need to use DragAcceptFiles first).

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Florent Heyworth

Hi Patrice

I downloaded the new HUDPlius project - just one comment and this is connected to UAC in Windows 7 (and probably in Vista):

The ShellExecute() function can result in Windows prompting the user whether he/she wants to allow the shelled program to run - since you use ShellExecute with no parent window and before ShowWindow(g_hMain) the prompt for allowing ZWP.exe may not be displayed blocking Hudplus.exe.

I'd move the ShellExecuteA after the ShowWindow(g_hMain) call - something like:


          string sRunProg = ExePath(); sRunProg += "ZWP.exe";
          char szRunProg[MAX_PATH]; strncpy_s(szRunProg, sRunProg.c_str(), sRunProg.size() ); sRunProg = "";
          string sPlaythis = g_sPluginPath; sPlaythis += szFullpathToFile;
          char szPlaythis[MAX_PATH]; strncpy_s(szPlaythis, sPlaythis.c_str(), sPlaythis.size() ); sPlaythis = "";
          char szExePath[MAX_PATH]; strncpy_s(szExePath, sExePath.c_str(), sExePath.size() );
          // Start the background plugin player.
 

          ShowWindow(g_hMain, SW_SHOW);
          if (hZWP == 0) {
                ShellExecuteA(g_hMain, "open", szRunProg, szPlaythis, szExePath, SW_SHOWNOACTIVATE);
          }


By the way - nice work, Patrice ;)

Cheers, Florent

Patrice Terrier

#2
Florent,

Thank you for the feedback.

Have you encountered any UAC problem yourself when ZWP.exe is being fired?
I, for myself, never got any prompt from the UAC.

About the location of the code that starts zwp.exe, it should not be moved, in order to preserve the fluidity of the fall down effect.

Also it is important that zwp.exe should not be associated to any specific window, thus using "ShellExecuteA(0, "open"...", because ZWP.exe could be already running (it could be used by another process as well).

And this is the reason why its presence is checked very early in the code:
   // Check if ZWP is already running.
   char zClass[] = "ZWALLPAPER"; HWND hZWP = FindWindowA(zClass, zClass);


...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Florent Heyworth

Hi Patrice

good point about zwp.exe already running however:

I usually flag trusted downloads as trusted (no prompting on run) -butI did test this with HUDPLUS (indicating that UAC should prompt on running zwp) - when this is set HUDPLUS appears to hang because it is waiting for the user to address the UAC prompt but no prompt window is displayed. You can still start ShellExecute with a NULL window but I'd recommend moving the ShellExecute call to bypass this potential problem.

Cheers, Florent

Patrice Terrier

#4
Florent,

I always run UAC in quiet mode ;)

Perhaps you could try to use "runas" lpVerb instead of "open" to prompt the user.

I could add a specific manifest into ZWP to elevate its privilege?
for example:

   <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
     <security>
       <requestedPrivileges>
         <requestedExecutionLevel level="highestAvailable"/>
       </requestedPrivileges>
     </security>
   </trustInfo>




Note:
Before you download a ZIP file from this forum, you must add this web site to your Internet Explorer security zone, to avoid problems with UAC.

Another solution is to unlock downloaded ZIP file, using a right click to popup the contextual menu, and select "properties" to unlock the ZIP before to extract the embedded files. 

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

#5
Point of interest in HUD window.

Everything is rendered onto the DirectDraw surface with a 60 hertz/fps frequency.
It means, there is no latency when moving the main popup and the underlaying window.
There is no flickering, and the animation keeps playing while moving the application around.
No need to use a timer or to hog the CPU with an intensive graphic loop animation.
You can mix 2D and 3D animation altogether running at full speed, because of the use of the GPU features.

Using a slave underlaying window produces better time slicing, without the drawback of using threads.
The two applications are working together through one single private message using the standard SendMessage/PostMessage mechanism (kind of DDE).

HUD window is able to display opaque and/or translucent child controls, something not possible with a standard Layered window.
For example, it is possible to draw a halo or a true shadow around the frame of the window.

HUD window illustrates the amazing capabilities of WinLIFT and GDImage working together, using the latest technology available in VISTA/Seven DWM Aero.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com