MFC extension DLL not attached to chain

Hello,

I have a big problem: a simple MFC application using MFC in a shared
DLL + An extension DLL (wizard-made) with a bitmap inside: IDB_BMP.

When I try to load the IDB_BMP bitmap I get error 1814: "The specified
resource name cannot be found in the image file. " Here is the code
from myapp.cpp:

...........................................................

HMODULE hh;
VERIFY(hh = AfxLoadLibrary("myextension.dll"));

//AfxSetResourceHandle(hh); -> if I uncomment this line it works!
CBitmap bmp;
int n = bmp.LoadBitmap(IDB_BMP); // n == 0
DWORD dw = GetLastError(); // -> error 1814

...........................................................

I don't want to use AfxSetResourceHandle() because I also want to
access resources from the .exe module. I'm guessing that the MFC
extension DLL doesn't get added to the chain but I don't know why...

Please help, I have no idea why this happens!

0
10/8/2007 3:10:03 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
776 Views

Similar Articles

[PageSpeed] 25

You will need to add it to the chain using CDynLinkLibrary.

---
Ajay

"Alexandru Halmagean" <alexandru.halmagean@gmail.com> wrote in message 
news:1191856203.268619.155180@d55g2000hsg.googlegroups.com...
> Hello,
>
> I have a big problem: a simple MFC application using MFC in a shared
> DLL + An extension DLL (wizard-made) with a bitmap inside: IDB_BMP.
>
> When I try to load the IDB_BMP bitmap I get error 1814: "The specified
> resource name cannot be found in the image file. " Here is the code
> from myapp.cpp:
>
> ..........................................................
>
> HMODULE hh;
> VERIFY(hh = AfxLoadLibrary("myextension.dll"));
>
> //AfxSetResourceHandle(hh); -> if I uncomment this line it works!
> CBitmap bmp;
> int n = bmp.LoadBitmap(IDB_BMP); // n == 0
> DWORD dw = GetLastError(); // -> error 1814
>
> ..........................................................
>
> I don't want to use AfxSetResourceHandle() because I also want to
> access resources from the .exe module. I'm guessing that the MFC
> extension DLL doesn't get added to the chain but I don't know why...
>
> Please help, I have no idea why this happens!
> 

0
ajaykalra (6842)
10/8/2007 10:22:26 PM
Hi Ajay and thanks for answering!

I did use CDynLinkLibrary (the code is generated by the MFC
ExtensionDLL Wizard) and I stepped into DllMain to make sure that a
new CDynLinkLibrary is created. Everything seemed OK but I still was
unable to load the bitmap...

However I think found the problem - the .exe and the .dll were using
different character sets! I set them both to Multi-byte and everything
works great!

Thanks again,
Alex

0
10/9/2007 7:20:00 AM
"Alexandru Halmagean" <alexandru.halmagean@gmail.com> wrote in message 
news:1191914400.742148.260170@22g2000hsm.googlegroups.com...
> Hi Ajay and thanks for answering!
>
> I did use CDynLinkLibrary (the code is generated by the MFC
> ExtensionDLL Wizard) and I stepped into DllMain to make sure that a
> new CDynLinkLibrary is created. Everything seemed OK but I still was
> unable to load the bitmap...
>
> However I think found the problem - the .exe and the .dll were using
> different character sets! I set them both to Multi-byte and everything
> works great!

That will do it. You were linking against two different versions of MFC.

---
Ajay


0
ajaykalra (6842)
10/10/2007 12:07:53 AM
Reply:

Similar Artilces:

Large Attachments
Outlook Constanly trys to resend an email with an attachment that is too big to email server. As in the email is 12m and outgoing limit is 10m then outlook tries to send and fails then tries again and again. Is there any way to fix this?? By being nice to your sys admin and getting the outgoing limit raised temporarily to allow this to go through. "Jeromy Cullen" <jcullen@csiweb.com> wrote in message news:000f01c352bf$6b7e0d00$a301280a@phx.gbl... > Outlook Constanly trys to resend an email with an > attachment that is too big to email server. As in the > email ...

winmail.dat attachments for CRM-tracked emails
Hello, our users are experiencing an issue with CRM-tracked emails from Outlook when the email is sent to Lotus Notes recipients: Email created in Outlook 2003 on Windows XPSP2 with CRM 3.0 desktop or laptop client installed (CRM server running Windows Server 2003SP1, SQL Server 2005SP1) Email has an attachment (usually a PDF file) Email is tracked in CRM using 'Track in CRM' button on new message in Outlook Outlook is using a POP3 mailbox, not Exchange Server Recipient is not using Outlook, usually Lotus Notes Attachment is called winmail.dat and the sender's attachment is gon...

How to spwan(in MFC)?
how to spwan??? Hello, WinExec() system() ShellExecute[Ex]() CreateProcess() Regards, Elias http://www.codeproject.com/system/newbiespawn.asp -- Regards, Nish [VC++ MVP] "�Ϲο�" <fuerza@kebi.com> wrote in message news:bh79mv$m1n$1@news1.kornet.net... > how to spwan??? > > ...

Saving e-mail including attachments problem
Saving Outlook e-mail including attachments has alwawys worked until recently. Can still save an e-mail but the attachemnts disappear. Please help! ...

Cannot preview of open any email with an attachment
I am unable to open or preview any email in Outlook 2003 that has an attachment. This includes old emails I have previously opened. The program locks up and I must to the Task Manager, End Task procedure to close the program. I have run "detect and repair" with no difference in performance. I have created a new .pst and imported my old .pst with no change. Any help would be most appreciated. ...

Attachments #118
Hello, I am reciving a lot of email with attachments. I would like save the files enclosed automatically in a directory, if the file extensions are .pdf,... Could do it? Thanks for all, SilviaLl. Look here: http://www.slipstick.com/addins/housekeeping.htm Housekeeping and Message Management Hal -- Hal Hostetler, CPBE -- hhh@kvoa.com Senior Engineer/MIS -- MS MVP-Print/Imaging -- WA7BGX http://www.kvoa.com -- "When News breaks, we fix it!" KVOA Television, Tucson, AZ. NBC Channel 4 Still Cadillacin' - www.badnewsbluesband.com "Silviall" <slladoARROBAg...

Unable to open PDF file attachments
Summary: - OS: WINDOWS VISTA - EMAIL SERVICE: WINDOWS MAIL - ADOBE READER 9.3.2 - PROBLEM: UNABLE TO OPEN ANY PDF FILE ATTACHMENTS - ATTEMPTS: UNINSTALLED/REINSTALLED ADOBE READER MULTIPLE TIMES : CHECKED FORUMS : pdf. EXTENSION FILES DEFAULT PROGRAM ADOBE READER NEED HELP URGENTLY EMILY Take a look at this.... http://www.winhelponline.com/articles/236/1/Unable-to-open-PDF-file-attachments-directly-from-Windows-Mail-in-Windows-Vista.html -- Dave N. MS-MVP (Mail) Windows 7 Ultimate http://download.live.com/wlmail "...

Entourage won't forward attachments
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel Email Client: Exchange I have a user that is no longer able to forward attachments. When she clicks Forward on a message that has attachments the message is preserved but the attachments are lost. I know she could use &quot;Forward as Attachment&quot; but then the person on the receiving end of the message has to open the original message to get to the attachment. These are just normal files in the attachments, jpeg's, pdf's ect. Also, the machine is running fully updated 13.0.4 entourage EWS conne...

Downloading of Attachments from a POP3 Server
Is there a way to configure Outlook 2007 to download headers and bodies of emails with attachments but not download the attachments? When needing to use a dial-up connection, having this ability will allow reading emails but not tie up the connection for hours downloading the attachments. Thanks! -- System Administrator Sprotte + Watson Architecture and Planning Vista, CA System Administrator wrote: > Is there a way to configure Outlook 2007 to download headers and > bodies of emails with attachments but not download the attachments? > When needing to use a dial-up c...

Outlook07-message with mp3 attachment won't send/stalls in outbox
)I can recieve mp3 attachments, multiple pictures, files, etc. but when I try to send more than 3 pictures or one mp3 (9.43 to 13.0mb size), outlook stalls and doesn't allow me to send any emails with these attachments. I can send regular files with no problem but not these. It is frustrating, does anyone know how I can fix this in Outlook so it will work? Thanks -- jani jani wrote: > )I can recieve mp3 attachments, multiple pictures, files, etc. but when I try > to send more than 3 pictures or one mp3 (9.43 to 13.0mb size), outlook stalls > and doesn't all...

Slowness opening Outlook attachment
it would take about 2-3 min to open outlook attachment don't matter what the size is. >-----Original Message----- >it would take about 2-3 min to open outlook attachment >don't matter what the size is. >. >has anybody have fix for that? ...

Portable app and mfc42u.dll
I am writing an application that is to run from a USB. It links dynamically with mfc42u.dll and I cant be sure it will be available on every system. So, I plan on including a copy of mfc42u.dll in the same directory as the app. Is this the way to proceed? Will this cause any conflict, problem, or whatever dll-hellish situation? I think this is ok. The dll is special and not on every system, so you should release a copy of it in the app directory. That's what I do with dlls to be used, too. Regards "Alexander" <the44secs@yahoo.com> schrieb im Newsbeitrag news:1172037426.1...

How to get the resource from Resource Only Dll
hmod=LoadLibrary("testdll.dll"); hr=FindResource(hmod,MAKEINTRESOURCE(504),"GIF"); if(hr == NULL) MessageBox("This is not working"); else MessageBox("This is working"); here, i am try to get the image(gif) resource,which is stored in the dll(for example testdll.dll). Where as image resource type is "GIF" And resource ID is 504. But i am unable to find the resource. But when i try this FindResource(hmod,MAKEINTRESOURCE(501),RT_BITMAP); Where i have also stored an BITMAP file, and tried find the resource . i have succeded in th...

MS Outlook will not start
Unable to display the folder. Microsoft Outlook could not access the specified folder location. The .DLL file for the information service could not be found. MAPI was unable to load the information service PSTPRX.DLL. Be sure the service is correctly installed and configured. Recreate your mailprofile in Control Panel-> Mail-> button Show Profiles... -- Roady [MVP] www.howto-outlook.com Tips of the month: -Creating Signatures -Create an Office XP CD slipstreamed with Service Pack 3 ----- "Damian ten Bohmer" <damiantenbohmer@iprimus.com.au> wrote in message news:...

Can't start Money: Error on file "mnyob99.dll"
My OS is WinXP Home Ed. I just bought Money 2004 Standard. After installation, I tried to start the application but an error occured and shut it down. Error Msg: AppName: msmoney.exe AppVer: 12.0.0.613 ModName: mnyob99.dll ModVer: 12.0.0.613 Offset: 000dc6e5 Does anyone know how to overcome this? Thanks. Patrick Try the instructions in the article below to Modify the Shortcut: http://support.microsoft.com/default.aspx?scid=kb;en-us;181008&Product=mny "Patrick" <cwt@idirect.ca> wrote in message news:03f101c3b253$ddb65690$a501280a@phx.gbl... > My OS is WinXP ...

Finding Desktop region in MFC
I am working on a commercial application, and recently discovered a bug I have been asked to fix (they threw it back in my lap). Run the application on a 2-monitor system, such as a laptop in a dock with an external monitor. Drag the main window to the second (non-taskbar) window and quit. Now move the laptop to a different dock with the second menu on the other side (or without a second monitor at all) and launch the app. Oops. The app continues to want to go on the side it was last put, even though there is now no monitor there. (Yes, my dock in the office and at home have the second ...

Promted for opening of attachment form Outlook
I have tasks linked to notes in One Note, whenever I click the attachment to open the notebook, I get a "Opening Mail Attachment" you should only open attachments from trustworthy.......... and the " always ask before opening" box is checked and grayed out so I cant change it. Although not the biggest problem in the world, it is an annoyance. Any thoughts on how to eliminate this? -------- Original-Nachricht -------- > I have tasks linked to notes in One Note, whenever I click the attachment to > open the notebook, I get a "Opening Mail...

print attachement
Hello, I would like Outlook to check for a specific attachement in incoming email (for example all attached word documents in format "ras*.doc") and to print the attached document automatically. Is is possible using rules ? do I need a script ? any idea how to do it ? Thank you ...

attachments #45
I cannot open Word or excell attachments from my email. I can open jpeg attachments. Any ideas? I am on outlook 2000 Buddy "buddy@busylad.com" <anonymous@discussions.microsoft.com> wrote in message news:051d01c3d63d$bf42c8c0$a301280a@phx.gbl... > I cannot open Word or excell attachments from my email. I > can open jpeg attachments. Any ideas? I am on outlook 2000 > Buddy You do have Word and Excel installed, don't you? ...

Removing attachment from reply
I want to reply to a message with an attachment without sending the attachment back, simply and easily "crownnut" <crownnut@discussions.microsoft.com> wrote in message news:B8F6825E-69E1-410E-846F-4D8139AAB456@microsoft.com... > I want to reply to a message with an attachment without sending the > attachment back, simply and easily Reply shouldn't keep the attachment by default. Replies do not include the attachment. Forwards include attachments. -- Ron Sommer MS MVP-Mail "crownnut" <crownnut@discussions.microsoft.com> wrote i...

How to get rid of error with WFOLADIN.DLL? TIA!
I uninstalled WinFax but I get an error message when I open Outlook 2003 saying "C:\Doc...etc..\wfoladin.dll is not a valid Office AddIn." I looked in the folder though and the file doesn't exist any more. Suggestions on how to get rid of the error message? Much thanks!!! Remove the WinFax Pro extensions in the Add-in Manager (Tools > Options > Other > Advanced Options...) -- Russ Valentine [MVP-Outlook] "scripteez" <scripteez@yahoo.com> wrote in message news:3gkd105q664tsocnhsak0f12h1cnttc3nl@4ax.com... > I uninstalled WinFax but I get an error me...

Printing Attachments
I print my emails to PDF at times, I would like the file attachment information to print also(just the file names so I know what was sent) seems like it used to do this but not anymore. Change in settings? Sorry wrong group - this was for outlook 2003 "LarryH" <larry@lkfire.com> wrote in message news:BeudnUnGaKYdS5jUnZ2dnUVZ_hmdnZ2d@shawneelink.net... >I print my emails to PDF at times, I would like the file attachment >information to print also(just the file names so I know what was sent) >seems like it used to do this but not anymore. Change in settings? &...

Timing-Out Error Message for 1 MB Attachment
I'm getting a Timing-Out Error Message when I send an attachment that's about 1.0 MB. It started after some (Microsoft, I think) updates and it seems like it should be easy to change some criteria in Outlook, but haven't found it yet. I can still send the attachment thru BellSouth/DSL mailbox, so why won't Outlook handle it? Any help would be appreciated. ...

Access 2003 in Windows 7 and OWC10.DLL
I just upgraded from XP to Windows 7 and installed Office Professional 2003. The 2003 access database I'd been running without problems is suddenly not functioning. I get the message "the database contains a missing or broken link to the file OWC10.DLL version 1.2. You must fix this reference". Does anyone know what that means and how to remedy it? The database is my accounting software for my business so I'm desperate to get it fixed .... Thanks, FJ If you google the subject you'll find tons of posts on this very subject with various p...

getting rid of the standard mfc icon (in taskbar)
i made an application based on mfc, and used the standard mfc icon up until now. i thought changing it would be a simple task. in the resource editor i got rid of all mfc icons in various resolutions, and replaced it with my own icon in 3 different resolutions. it does work in almost all the places: the main window is shown with the correct icon, the taskbar shows correctly with the icon, even MessageBox() shows the icon now, but as soon as i do open a MessageBox while my main-window is shown, the counter in taskbar moves up to two (you know how windows xp groups together tasks with th...