-
February 19th, 2007, 09:22 AM
#1
dll question
In a vb 6.0 dll how can I find the App.Title of the calling application (the application that invoked the dll).
App.Title only gives me the title of the dll. Do I have to pass this is in as a param or is there a better way?
Thanks
-
February 19th, 2007, 09:51 AM
#2
Re: dll question
From inside the DLL code ? what kind of DLL is this ?
By title, you meant the main form's Caption (text on the title bar), right ?
Regards,
Ramkrishna Pawar
-
February 19th, 2007, 12:10 PM
#3
Re: dll question
This is what is happening.
1) We have a stand alone COM exe that runs.
2) Usually an application invokes the COM to do its work. When the application invokes the COM exe it passes in the application name (App.Title).
3) The COM exe has a timer that runs to check if the "application name" window still exists using FindWindow(). If it does not exist it shuts itself down to avoid a hung process.
4) The problem is that if this COM exe is invoked using a dll, the dll passes in the dll application name, the COM timer does not find that window and so shuts down prematurely.
5) So I need the DLL to be able to pass in the application name of the application that invoked the DLL, not of the DLL itself.
Thanks for any help.
Last edited by bluesource; February 19th, 2007 at 12:16 PM.
-
February 19th, 2007, 12:54 PM
#4
Re: dll question
Why don't you just pass a reference to the form object instead of the application title???
++++++++[>++++++++<-]>+.<+++[>++++<-]>+.<++[>-----<-]>.<+++[>++++<-]>++.<+++[>----<-]>-.----.
God does not play dice with the universe.(A.Einstein)
-
February 19th, 2007, 01:02 PM
#5
Re: dll question
The form is a part of the dll and a reference to it is passed into the COM exe, but the COM exe is using FindWindow with the application name to see if it exists.
Unfortunately modifying the COM exe is not an option, it presents too many compatibilty issues and considered too much work for the nature of this "hot fix".
To think how much code in our system should be re-written and how much was developed with poor coding standards gives me the chills...
-
February 19th, 2007, 11:55 PM
#6
Re: dll question
Code:
Private Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" _
(ByVal hModule As Long, ByVal lpFileName As String, ByVal nSize As Long) As Long
...
Dim sFilename As String, i As Long
sFilename = String(256, " ")
i = GetModuleFileName(0, sFilename, 256)
sFilename = Left(sFilename, i)
With best wishes,
Vita
-----------------------
Russian Software Development Network -- http://www.rsdn.ru
-
February 20th, 2007, 09:23 AM
#7
Re: dll question
If I run GetModuleFileName within the dll, it returns the name of the dll, not the application that invoked the dll.
-
February 20th, 2007, 09:45 AM
#8
Re: dll question
I think there is some confusion, as far as I know GetModuleFileName gives you name of the Executable used to create process, not the current module name.
What kind of DLL is this ?
Another thing is that the Executable name and App.Title is not the same thing, can you explain what you want to achieve by doing all this ?
Regards,
Ramkrishna Pawar
-
February 20th, 2007, 09:34 PM
#9
Re: dll question
why pass the app.title when there is the form's handle/caption?
if you used the form's handle you would have been using the IsWindow API function inside the COM exe to check if the window exists.
Last edited by Thread1; February 20th, 2007 at 09:37 PM.
Busy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|