how to know where a dll is loaded?

Hi,

Is there an easy way for a dll to know where it is located, i.e. the 
path where it is loaded into memory?  I found out that using 
GetModuleFileName() I need to get the dll handle first.  But where I can 
get the handle?  Some dlls don't have DllMain(), where I suppose to get 
the handle.  Your advise is most appreciated.

Tony
0
jdt_young (239)
2/21/2006 10:13:38 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
314 Views

Similar Articles

[PageSpeed] 43

I am still new with windows development, but I had to do something like
this.  So.. this is what I did.  I first grabbed the handle to the
window, and then grabbed the process ID.  Once I had the process ID, I
made a snap shot of all the modules within that process and iterated
over all the modules until I found my dll.

some function calls I used:

Module32Next(..) to cycle through the modules.  I had to use some
FirstModule call as well to get the first module in the process snap
shot.

I forgot how I did it exactly.  I hope this helps in any way or form.

good luck

0
TheFakeJon (91)
2/22/2006 4:30:38 AM
Reply:

Similar Artilces:

OWA not loading (Exch5.5)
Hi Everyone, apologies if this has been asked before ... About 1 month ago, OWA stopped working. After entering the URL, IE times out loading the initial page. It wasn't a huge problem at the time as OWA and Exchange 5.5 were to be installed on a new server and it was thought by doing that the problem would be rectified. Anyway, OWA has been moved to the new server but this problem is still happening. The only way to resolve it (and I found this by accident) is by resetting IIS on that server (iisreset from cmd prompt). Anyone have any ideas? Could this be some kind of exploit of our s...

Excel crashed with ntdll.dll when opening a file
Dears, My Excel crashed with ntdll.dll when opening a file Error signature AppName: excel.exe AppVer: 10.0.6834.0 ModName: ntdll.dll ModVer: 5.1.2600.2180 Offset: 00010f29 I am using Office XP with SP3, Windows XP with SP2. Thanks B. G. ...

Batch loading Timesheets data from Excel files to EPM
Dear all, I had a request from one of our clients' regarding the batch loading of Timesheet Data from Excel files to EPM. I investigated the request and my conclusion is that this can be done using SQL Integration Services (via a DTS). My questions are the following: 1. Is it enough to batch load data on the following tables (of Published database) ? MSP_TIMESHEET_ACTUALS MSP_TIMESHEET_LINES MSP_TIMESHEETS 2. How can I batch create the UID (identifiers)? Is there a specific Stored Procedure for that? I'll appreciate any answer on that. Best regards, Kons...

Sending a UserRegistered Message from a dll to the main applicaition
Hello! I have an MFC 7.1 application that uses a dll. The dll is not MFC it's a SDK DLL. Both the application and the dll is compiled as UNICODE. I want to send a user registered message from the .dll to the main .exe I have used static const UINT UWM_OUTPORT_MSG = ::RegisterWindowMessage(_T("UWM_OUTPORT_{737386A0-62B1-4701-A9D5-436A8C07B83F}")); In both the .dll and the .exe and in the dll i do: PostMessage(NULL,UWM_OUTPORT_MSG,0,0); and in the main app I have: BEGIN_MESSAGE_MAP(CIOOutputDlg, CTabPageSSL) ON_REGISTERED_MESSAGE(UWM_OUTPORT_MSG, OnOutPortMsg) END_MESS...

How to do this?-Dialogs in Dll
I am doing a regular .dll with a Customed Dialog in it. As I know this dialog do not have message loop for them and they are receiving event from activeX object with event map and so forth. How I can get those dialog event_map and message map work for me? ...

XmlDocument.Load failing with CR must be followed by LF #2
We have an application using Dim doc As New XmlDocument doc.Load(VariableForUNCFilePath) in VB.NET 2.0 to load an XML document for operating on the nodes thereof. This was functioning wonderfully up until yesterday. It worked at 10:20 AM EST on 02/10/2009, but at the next operation (3:42 PM EST) it didn't work anymore. Now, when I attempt to load the same documents that had loaded previously using this same code as before, I get the error "The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF". Anyo...

FYI
I upgraded to v1.3R on a workstation that also has Microsoft Solomon IV v6.0 installed. After the upgrade, I could not print crystal reports in Solomon at all, it was giving me error messages. After much head scratching it was determined that the problem was an older version of the file capicom.dll was installed into the C:\Program Files\Microsoft Retail Management\Headquarters\ folder. Solomon must utilize the file too, and it didn't like the fact that the file was only version 1.0.0.1. So I renamed the older file, and copied and pasted the newer file, version 2.1.0.1, from C:...

Loading XML file into XMLDocument
Hey There!... I've been dealing for hours trying to figure out why do I get the following error message: Type 'System.Xml.XmlDocument' in Assembly 'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable. I'm using the following method to get the XML: private XmlDocument loadXmlFile() { XmlDocument xmlDoc= new XmlDocument(); try { xmlDoc.LoadXml(File.ReadAllText(Server.MapPath("~/ links.xml"))); } catch (Exception) { t...

Loading older publisher files?
I have some publisher files from Publisher version '03 that will not load in Publisher '07. I have tried to double click them or using the open file optioin, but they just sit there not loading? When I re-start Publisher, they show up on the right side as "recent publications", but if I try to load them from there, the program again just sits there untill I stoop and re-load Publisher. I need to re-load these Training Certificates to publish new ones for an upcoming class. What am I missing????? Did you install the service pack 2? If you did you may have to install the...

Creating a user DLL in VC++
Hi, I am trying to use VTune profiler on my application, But Vtune is not instrumenting the private functions of applications DLL because the DLL's have "System=true" attribute in their header and VTune instrument only exported functions for a System DLL. So I want to know how can I make the DLL as a "User DLL". Is there any option in VC++ (or any linker option ) to do the same. Thanks in advance Rahul It is difficult to answer this question when it is so vague. What DLL? How was it created? I looked at features like the 'characteristics' in the main he...

Does any one know where and how to modify the standard ppreview re
Hi there Every CRM record has a little printer icon on them, pusing this button run a standard print preview report which display all fields+ notes attached to the rcord. How do we modify this standard preview report? Thanks Kyaw Unfortunately you can't edit this - it isn't a report, but rather a rendered page.... -- Fortis "K.Zay Ya" wrote: > Hi there > > Every CRM record has a little printer icon on them, pusing this button run a > standard print preview report which display all fields+ notes attached to the > rcord. > > How do we modi...

Outlook cannot find MSO97.DLL
I am trying to start Outlook and I get the error "A required .DLL file, MSO97.DLL, was not found." I checked Microsoft's support site and found a document that described the problem asked me to fix the registry. However all the registry entries are fine and the dll's are in the same location (MSO97.DLL MSO7enu.dll). Does anyone know what the problem could be? I am not connecting to an exchange server, I am running Outlook on my home computer (stand alone). Thanks for the help! Hi pnagpal, have you already read this article? http://support.microsoft.com/default.aspx...

Loading SMO Assemblies within a Start-Job -File always hangs
I have a PS script which uses SMO to back up an SQL Server Database. The Script works fine without any problems. However, I want to asynchronously process several backups so I tried using Start-Job -file to execute the script in the background. When I do, the backup script hangs when loading the first assembly:[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO"). I know it hangs on this because I included a Set-PSDebug -Trace 2 and when I issue a Receive Job 1 -keep, that is as far as the script goes. No matter how long I wait, the script just hangs at that co...

down load mircosoft publisher 2003
I have microsoft publisher 2000 and would like to up-grade it to microsoft publisher 2003. Here is one place you can download Microsoft Publisher 2003 for a price. I don't know if this is legit or not but something to look into. http://www.bizrate.com/computers_software/search__keyword--microsoft+publisher+2003__lp--1__sfsk--1.html Bottom of the page. -- Don Vancouver, USA "Jeanne" <Jeanne@discussions.microsoft.com> wrote in message news:311016B4-4D98-4916-BE91-9D32DD18E8B4@microsoft.com... >I have microsoft publisher 2000 and would like to up-grade it to mi...

Combo Box selection to auto load a field and ability to detect cha
I have a form that has a combo box called "Product", now each product has an associated RO#. So when a user selects a Product the related RO# should auto fill in the second text field. Secondly, the user may decide to change the product selection during form entry the RO# field which is filled already based on the earlier Product selection should be able to detect that the combo box Product has been updated and populate itself with the relevant Ro#. Let me, try to explain by example I have a combo box called "Product", having the following enteries each with a uni...

XMLDoc.Load problem
Hi! I'd like to know, how can I fix or ignore the XmlDocument Load or LoadXML error when the XML file is wrong (unended tag, missing start tag, missing "" from attribute ...), like IE Developer Toolbar or just a simple Browser? Thx! Hoszi Horv�th Szil�rd wrote: > I'd like to know, how can I fix or ignore the XmlDocument Load or > LoadXML error when the XML file is wrong (unended tag, missing start > tag, missing "" from attribute ...), like IE Developer Toolbar or just a > simple Browser? If the markup you are trying to load is not well-forme...

How do I get a jscript function to load in CRM?
I am a newbie. I just passed by CRM Customization exam, but have yet to do any real work. My first assignment was to write a format function that could be called from several fields. I assumed that I could just load the function into the OnLoad event, but I now see that the OnLoad event is itself a function. The window allows you only to enter the code that would fall between function OnLoad () { }, but not to add a different function. So how do I get this code loaded? I have seen code snippets that showed a line or two of code assigned to a javascript attribute, and I could, pre...

MbfPackager Failed Loading Packager Data
Hi, I have recently installed GP 10 and Business Portal 4.0.I later uninstalled GP 10, Business Portal 4.0, WSS 3.0, MOSS 2007 and insatlled WSS 2.0 and installed GP 9.0 with SP1,SP2 and Business Portal 3.0. While installing Business Portal 3.0, i got the error "MbfPackager Failed Loading Packager Data" with error summary as "Failed Loading Packager Data Element (PD_HRM_COMMON) for Install Feature (HRM)" What might be the cause for this and how to resolve this? Thanks, Mohan. ...

Prop Res DLL not loaded
I get the error message, "Prop Res DLL not loaded" each time I try to print a message from Outlook. I'm running Outlook 2007 (12.0.6316.5000) SP1 MSO (12.0.6320.5000). This error message will go into hiding if I click the Enter key enough times, then the print process goes to completion as if everything was okay. Any suggestions??? Gordon you have a lexmark printer? try reinstalling the software. if that fails, try going to c:\windows\system3\spool\drivers\w32x86\[Lexmark folder] and copy lxbkprpr.dll to c:\windows\system32 -- Diane Poremsky [MVP - Outlook] Outlook Tips: h...

.doc Save As -> .htm -> load in IIS -> Clipart disappears ??!!
Hello, I edited one .doc putting two sets of cliparts at two positions in document. Saved document as .htm through MS Word only.[ Save As - .htm option] Loaded that .htm in IE, looks perfect. But when loaded under IIS, including html's image directory [which carries all image data etc], one set of cliparts are shown perfectly whereas other set of cliparts is not shown. I find this is strange, as one set of clipart is shown very well, and the images are present very well in the htm's directory, which also I copied under IIS besided html. Kindly guide. [I am not Web developer] Tha...

pushbutton with bitmap loaded
I loaded a bitmap to a pushbutton, with SetBitmap. Can I still write text after the bitmap is loaded? (I coudn't so far). y/ Not normally. There are special buttons that you can use though where people have already worked through the issue: I paticularly like this one: http://www.codeguru.com/Cpp/controls/buttonctrl/bitmapbuttons/article.php/c5181/ Tom "Patrick Zou" <patrick_zou@no_spam_hotmail.com> wrote in message news:uJS8dncaEHA.2632@TK2MSFTNGP10.phx.gbl... > I loaded a bitmap to a pushbutton, with SetBitmap. Can I still write text > after the bitmap is loa...

C'mon does'nt anybody know the answer to this one?
Dear Friends, Outlook XP(2002) and Windows Xp I have a problem where my Find a Contact search box, situated in the Standard Menu tool bar no longer works. This has happened after a fresh install of outlook and then adding another pst file [ all my old info ]. When moving the default location for email to receive email to my old pst file and then deleting the original pst file the search box fails to work anymore! I can only search for something using the FIND button which is situated next to the Send/Recieve button Anybody got any ideas? Many Thanks Chris Make sure your Outlook Addres...

how do i get excel 2003 e mail attachments to load to excel 2007?
Have Excel 2007 as the default application for Excel. On Thu, 29 May 2008 15:41:06 -0700, jimtailwind <jimtailwind@discussions.microsoft.com> wrote: ...

Anyone know of a free sample demand letter for personal injury?
I've contacted several lawyers through a pre paid legal program, and they all say my injuries aren't severe enough for them to make enough money to offset the time they would put into actually representing me. So the last one suggested I write up a demand letter, gave me an overview of what to put in it, and then the program can review my letter before sending. I've searched online for sample demand letters and got some pointers but wanted an actual sample. Anyone-ideas? ...

Loading xml schema from database
The XmlDataDocument can load xml from a string <script> string sXml = "<Root><Elemenet>Example</Element></Root>"; xdd.LaodXml(sXml) <.script> The question is, can I load a xml schema the same way(with string i retrieve from a databas)? I wand to load the schema into a DataSet or into a XmlDataDucument, and use the document DataSet member. Thank you ZAky ...