I'm writing an application profile launcher (can launch multiple apps based on profiles) using the Windows 7 Taskbar and Libraries .NET Interop Sample Library. Each profile can have a designated image to identify that profile. The profile image is then used with the interactive thumbnail feature of Windows 7. I implemented forward/back buttons (ripped them from the sample library for now) to let you select your profile and a button to launch the profile. Here's a screen shot just so you get the idea:
Now, to get the thumbnail previews to update properly I used the wrapper API provided from the sample library (compiled into DLLs which I incorporated into my own project):
WindowsFormsExtensions.EnableCustomWindowPreview(this);
WindowsFormsExtensions.SetIconicThumbnail(this, new Bitmap(pbProfilePicture.Image.GetThumbnailImage(200,120,null,IntPtr.Zero)));
The problem is, for the SetIconicThumbnail function to work properly, the EnableCustomWindowPreview function must be invoked with the handle to the window. And using the EnableCustomWindowPreview function then requires me to set a peek thumbnail manually (from an image/bmp), otherwise I get this (minimized or not):
The problem is, I tried several methods of manually setting the peek thumbnail, none of which worked properly. Here's some of the things I tried (Method 1 works halfway in that it doesn't create the bitmap properly (stretched/distorted) and also fails to grab a screenshot when minimized. Method 2 causes all kinds of problems which I'm too lazy to specify as well):
Now by default (with most applications), the peek feature works fine, but calling the EnableCustomWindowPreview function requires you to manually set the bitmap for the window preview. So my question is, is there anyway I can use SetIconicThumbnail to set the thumbnail icon while keeping the default aero peek functionality (without requiring to set my own bitmap previews)?
I suppose if I absolutely have to I could capture a screenshot of the app and set the peek bitmap to it and store it in case it's minimized (and update whenever tabs are switched). But since this functionality should work by itself it seems like a waste of extra code/memory resources. Though if anyone can point me to some code to easily do this I may consider it.
Anyway, thanks in advance. Hopefully someone can help me out =)
Question
svnO.o
I'm writing an application profile launcher (can launch multiple apps based on profiles) using the Windows 7 Taskbar and Libraries .NET Interop Sample Library. Each profile can have a designated image to identify that profile. The profile image is then used with the interactive thumbnail feature of Windows 7. I implemented forward/back buttons (ripped them from the sample library for now) to let you select your profile and a button to launch the profile. Here's a screen shot just so you get the idea:
Now, to get the thumbnail previews to update properly I used the wrapper API provided from the sample library (compiled into DLLs which I incorporated into my own project):
The problem is, for the SetIconicThumbnail function to work properly, the EnableCustomWindowPreview function must be invoked with the handle to the window. And using the EnableCustomWindowPreview function then requires me to set a peek thumbnail manually (from an image/bmp), otherwise I get this (minimized or not):
The problem is, I tried several methods of manually setting the peek thumbnail, none of which worked properly. Here's some of the things I tried (Method 1 works halfway in that it doesn't create the bitmap properly (stretched/distorted) and also fails to grab a screenshot when minimized. Method 2 causes all kinds of problems which I'm too lazy to specify as well):
_windowsManager = CustomWindowsManager.CreateWindowsManager(this.Handle, IntPtr.Zero); _windowsManager.PeekRequested += (o, e) => { e.Bitmap = Windows7.DesktopIntegration.ScreenCapture.GrabWindowBitmap(this.Handle, this.Size); // method 1 Windows7Taskbar.SetPeekBitmap(this.Handle, Windows7.DesktopIntegration.ScreenCapture.GrabWindowBitmap(this.Handle, this.Size), true); // method 2 };*/Now by default (with most applications), the peek feature works fine, but calling the EnableCustomWindowPreview function requires you to manually set the bitmap for the window preview. So my question is, is there anyway I can use SetIconicThumbnail to set the thumbnail icon while keeping the default aero peek functionality (without requiring to set my own bitmap previews)?
I suppose if I absolutely have to I could capture a screenshot of the app and set the peek bitmap to it and store it in case it's minimized (and update whenever tabs are switched). But since this functionality should work by itself it seems like a waste of extra code/memory resources. Though if anyone can point me to some code to easily do this I may consider it.
Anyway, thanks in advance. Hopefully someone can help me out =)
Link to comment
Share on other sites
3 answers to this question
Recommended Posts