From: Haowei on 20 Apr 2010 16:53 Could you specify how to link the *.lib or *.dll? I tried whatever I can, but still can not get it through. Thanks, HS David Wilkinson wrote: Re: MFC application and Load DLL 21-Sep-08 Zack wrote: Zack: There s nothing special about MFC with regard to loading DLL's. Normally a Windows DLL will come with a header file (.h) that you #include in your code, and a static import library (.lib) that you link with your code. Then all you need to do is put the DLL in the same folder with your executable. Do you have these things? A DLL can also be loaded using LoadLibrary(), and the individual functions accessed using GetProcAddress(). In this case you do not need the import library. -- David Wilkinson Visual C++ MVP Previous Posts In This Thread: On Sunday, September 21, 2008 5:11 AM Zack wrote: MFC application and Load DLL Does a MFC Application can load to it DLL ? if yes were can i read how to do load the DLL, and get the DLL interfaces ? I am trying to load Ramdisk DLL to my application and create fast secondary storage option? On Sunday, September 21, 2008 5:24 AM Giovanni Dicanio wrote: Re: MFC application and Load DLL "Zack" <zackm(a)infinite-memories.com> ha scritto nel messaggio news:BA5F6E43-1340-4F17-987D-D26564BA6332(a)microsoft.com... There are several types of DLLs... If you have a DLL with a pure-C interface (the implementation can be in C++), you can load it from MFC. You can also load so called MFC "Extension DLLs". But, to do so, you must be sure that the EXE and the DLLs are built with the same compiler and the same version of MFC. There are COM DLLs, too. And MFC offers support to COM code, too. (In case of COM DLLs, you have isolation from particular compiler, e.g. an EXE built with MFC and VC2005 can load a COM DLL built using VC6.) There are also DLLs containing managed components (e.g. components written in C#). I'm not sure about them, but I think that since VC2005 MFC offers some support to managed code, too (e.g. you can embedd managed components in an MFC EXE). Giovanni On Sunday, September 21, 2008 7:49 AM David Wilkinson wrote: Re: MFC application and Load DLL Zack wrote: Zack: There s nothing special about MFC with regard to loading DLL's. Normally a Windows DLL will come with a header file (.h) that you #include in your code, and a static import library (.lib) that you link with your code. Then all you need to do is put the DLL in the same folder with your executable. Do you have these things? A DLL can also be loaded using LoadLibrary(), and the individual functions accessed using GetProcAddress(). In this case you do not need the import library. -- David Wilkinson Visual C++ MVP On Sunday, September 21, 2008 11:16 AM Giovanni Dicanio wrote: Re: MFC application and Load DLL "Zack" <zackm(a)infinite-memories.com> ha scritto nel messaggio news:BA5F6E43-1340-4F17-987D-D26564BA6332(a)microsoft.com... Searching for "ramdisk dll" with Google, I found that: http://www.codeguru.com/cpp/w-p/system/devicedriverdevelopment/article.php/c5789/ Are you refering to that link? If so, I think that that Ramdisk DLL is actually a kind of device driver, so I don't think you can load and use it from MFC... (As I wrote in my previous post, there are several kinds of DLLs...) If you are refering to a different "ramdisk dll", could you please provide a link? Giovanni On Sunday, September 21, 2008 12:17 PM zac wrote: Yes this is the DLL,what i want is to enter the Ramdisk features to my MFC Yes this is the DLL, what i want is to enter the Ramdisk features to my MFC application, and every body is talking about sample code but the "Download source - 256 Kb" is empty zip file (correct me if i wrong), and cann't find any source example ? if you know about code example it will be great ? Do i need to install any driver before using this Ramdisk API ? is it better to use devcon ? "Giovanni Dicanio" wrote: On Sunday, September 21, 2008 5:58 PM Joseph M. Newcomer wrote: Note that the DLL is NOT used by your program. Note that the DLL is NOT used by your program. It is used as part of the setup/configuration mechanism (notice it says "a property sheet DLL", which has NOTHING to do with your program at all; you will NEVER touch this DLL in any way, for any reason. The SYSTEM uses it as part of the Property Sheet display). It is a device driver, and as such, its value is questionable. It requires admin privileges to install, for example. This means that while you may use it, you would never want to use it on any program that you give or sell to anyone else. And what, exactly, does a "RAM Disk" do these days? Nothing I'm aware of that has much value. The file system cache in Windows is pretty good, and therefore there is rarely any advantage to using a "RAM Disk" like there was in Win16 or MS-DOS. It is almost certainly a Really Bad Idea most of the time. For example, the documentation suggests that it requires contiguous kernel virtual address space. This will decrease your overall system performance; the more RAMdisk you add, the less space you have for programs and file system cache. The more your overall system will slow down. In fact, your program that you THINK you are optimizing by this idea may actually run slower. There is no "RAMDisk API". It is called "CreateFile", "ReadFile", "WriteFile" and "CloseHandle". What problem do you think this is going to solve? There is usually a better solution than glomming up large amounts of kernel space. joe On Sun, 21 Sep 2008 09:17:00 -0700, zack <zack(a)discussions.microsoft.com> wrote: Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm On Tuesday, April 20, 2010 4:51 PM Haowei Song wrote: load dll with MFC Could you specify how to link the *.lib or *.dll in MFC application? I tried whatever I can, but never get it through. Thanks, HS Submitted via EggHeadCafe - Software Developer Portal of Choice Book Review: C# 4.0 In a Nutshell [O'Reilly] http://www.eggheadcafe.com/tutorials/aspnet/6dc05c04-c7f9-40cc-a2da-88dde2e6d891/book-review-c-40-in-a.aspx
|
Pages: 1 Prev: How to handle Windows 7 screen resolution change? Next: CreateProcess |