Click here to Skip to main content
15,905,508 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Vista Alt+Tab Pin
Ric Ashton26-Feb-09 8:40
Ric Ashton26-Feb-09 8:40 
GeneralRe: Vista Alt+Tab Pin
Code-o-mat26-Feb-09 9:14
Code-o-mat26-Feb-09 9:14 
GeneralRe: Vista Alt+Tab Pin
Luc Pattyn26-Feb-09 11:08
sitebuilderLuc Pattyn26-Feb-09 11:08 
QuestionExpression in a variable name Pin
callmeishmael2526-Feb-09 4:47
callmeishmael2526-Feb-09 4:47 
AnswerRe: Expression in a variable name Pin
Code-o-mat26-Feb-09 5:07
Code-o-mat26-Feb-09 5:07 
GeneralRe: Expression in a variable name Pin
callmeishmael2526-Feb-09 5:41
callmeishmael2526-Feb-09 5:41 
AnswerRe: Expression in a variable name Pin
David Crow26-Feb-09 7:41
David Crow26-Feb-09 7:41 
QuestionATL MFC shell extension DLL LoadImage fails with 1813 Pin
Kuniva26-Feb-09 2:49
Kuniva26-Feb-09 2:49 
Not sure if this is the right forum since it also has to do with ATL but..

I'm programming a shell extension dll (context menu) based off the article "The Complete Idiot's Guide to Writing Shell Extensions" by Michael Dunn. So I made an ATL project with MFC and COM support. At first I started by using SetMenuItemBitmaps() to set the menu item icons, but then I found out that this method doesn't support transparency.

Because achieving transparency for menu icons is apparently far from straightforward, I had the marvelous idea of looking at the Tortoise CVS shell code. I incorporated some of the ideas like using LoadImage() and GDI plus on Vista to blit the icons to a bitmap and make them look good that way, but I also noticed that they didn't use ATL and did reference counting themselves (and as such are also easily able to access the DLL's instance handle).

My problem now is that each LoadImage() call fails with error code 1813 which according to MSDN means "The specified resource type cannot be found in the image file.".

Now my best bet is that I'm somehow using the wrong module handle (the one of the EXE perhaps instead of the DLL), but I've tried everything I can think of to get the correct handle including:

1. Use the m_hInstance member of the global CWinApp instance.
2. Just pass in NULL for LoadImage().
3. Use GetModuleHandle() with the dll name passed in. This returns a handle but it still fails with 1813.
4. Use MFC's AfxFindResourceHandle() to get a handle to the dll instance. This fails with an assertion error in some MFC file saying the current resource handle is not set (so i tried setting it with AfxSetResourceHandle() to the theApp.m_hInstance handle, but that just crashed).

I'm starting to wonder if the people from tortoise intentionally decided not to use ATL so they could get the instance handle from DllMain(). Either way, it seems to me that I've bumped into some internal MFC/ATL funkyness and I can't figure it out.

So if anyone knows more about this or has any suggestions, do tell Smile | :)

Oh yea, note:
For the resource I'm testing with I'm simply using a string id such as "IDI_TORTU" which I then pass to LoadImage().

greets

Kuniva
--------------------------------------------

AnswerRe: ATL MFC shell extension DLL LoadImage fails with 1813 Pin
Code-o-mat26-Feb-09 3:10
Code-o-mat26-Feb-09 3:10 
GeneralRe: ATL MFC shell extension DLL LoadImage fails with 1813 Pin
Kuniva26-Feb-09 3:23
Kuniva26-Feb-09 3:23 
GeneralRe: ATL MFC shell extension DLL LoadImage fails with 1813 Pin
Code-o-mat26-Feb-09 3:31
Code-o-mat26-Feb-09 3:31 
GeneralRe: ATL MFC shell extension DLL LoadImage fails with 1813 Pin
Kuniva26-Feb-09 3:34
Kuniva26-Feb-09 3:34 
GeneralRe: ATL MFC shell extension DLL LoadImage fails with 1813 Pin
Code-o-mat26-Feb-09 3:38
Code-o-mat26-Feb-09 3:38 
Questioninterprocess communication between flash and visual c++ Pin
praveensweb26-Feb-09 1:05
praveensweb26-Feb-09 1:05 
AnswerRe: interprocess communication between flash and visual c++ Pin
Code-o-mat26-Feb-09 1:16
Code-o-mat26-Feb-09 1:16 
GeneralRe: interprocess communication between flash and visual c++ Pin
Jim Crafton26-Feb-09 10:52
Jim Crafton26-Feb-09 10:52 
AnswerRe: interprocess communication between flash and visual c++ Pin
Nishad S26-Feb-09 1:58
Nishad S26-Feb-09 1:58 
AnswerRe: interprocess communication between flash and visual c++ Pin
lebaer26-Feb-09 19:22
lebaer26-Feb-09 19:22 
GeneralRe: interprocess communication between flash and visual c++ Pin
JackPuppy28-Feb-09 8:08
JackPuppy28-Feb-09 8:08 
QuestionLarge file handling using MFC Pin
Vikas K.26-Feb-09 1:03
Vikas K.26-Feb-09 1:03 
AnswerRe: Large file handling using MFC Pin
Vikas K.26-Feb-09 1:04
Vikas K.26-Feb-09 1:04 
AnswerRe: Large file handling using MFC Pin
«_Superman_»26-Feb-09 1:54
professional«_Superman_»26-Feb-09 1:54 
AnswerRe: Large file handling using MFC Pin
Nishad S26-Feb-09 2:06
Nishad S26-Feb-09 2:06 
AnswerRe: Large file handling using MFC Pin
Stuart Dootson26-Feb-09 4:02
professionalStuart Dootson26-Feb-09 4:02 
GeneralRe: Large file handling using MFC Pin
Vikas K.3-Mar-09 19:22
Vikas K.3-Mar-09 19:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.