Sign in to follow this  
Wicked Ewok

Windows Shell Extensions again

Recommended Posts

Hi, I've traced a problem with my windows shell extension for generating thumbnails to an invalid DC issue that seemed to cause the shell to restart and recreate the COM object everytime it failed. To fix this, I'm trying to create a hidden window from the shell extension, but my usual window creation code is failing. I would like to know why it is failing. It fails on a CreateWindowEx call with GetLastError() returning 0x06L, Invalid Handle value. The code I use is the same that I use on a standard window creation skeleton. Can anyone tell me if creating a window through the shell extension would be any different? Oh, to get the HInstance for creating the window, I use HINSTANCE hInstacne = GetModuleHandle( NULL ). Thanks, Marv

Share this post


Link to post
Share on other sites
I count 3 possible source of handle error: the instance handle, the menu handle (but this one is probably NULL) and the parent window handle. You might want to check these values - and not assume that the problem comes from the instance handle.

I'm not even sure whether you can create child windows or not. I don't see anything about this subject in the msdn.

Regards,

Share this post


Link to post
Share on other sites
K we figured out the problem. It had to do with setfocus being called, which called redraw on all the currently open windows, including the explorer window where we were browsing our filetypes. This caused explorer to generate a thumbnail for the file again, recursively digging into our code. When we were stepping through, this would not happen since the explorer window was in the backgroud(in back of the debugger) and therefore not updated. The solution was to do a LockWindowUpdate( GetDesktopWindow() ); which made all windows unable to update before we finished our thumbnail generation. The whole problem was caused by the fact that the 3D engine we're using for generating thumbnails creates it's own window and calls SetFocus() which updates the screen by putting the window in focus and redrawing any other window not hidden.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this