[RESOLVED] Refer to spefic dll
Hi All,
As I know, when I declare functions from DLL, like this:
Code:
Private Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
If refer to system dll
When I declare function like this:
Code:
Private Declare Function MyFunc Lib "test.dll" Alias "DLLMyFunc" (ByVal lpText As String) As Long
I refer to test.dll file which may be located in app folder or in system folders (windows, windows\system32 etc.)
If test.dll located in app folder and system folder too, to which dll VB would refer?
How can I refer to specfic dll? For example, only for DLL, which located in app folder, event such dll is located in system folder too
Thanks all
P.S. Sorry for my eng ;)))):thumb:
Re: [RESOLVED] Refer to spefic dll
Glad you're all good!!!
Quote:
Originally Posted by okosv
But may be user from which name the app is started, can't have access for registry
I doubt this. All you're doing is reading the registry. If the user cant read the registry, when the app is running how would it know what Object to instantiate when it can't get the relevant GUID/CLSID and the path (usually from InprocServer32). Remember, ActiveX controls are only required to be registered at the point before of instantiation, hence why registering controls at run-time will work (though not recommended). The information about COM is stored in the registry. So, as far as I know, whatever route you take, you need to read from the registry. Correct me if I'm wrong.
A
Quote:
Originally Posted by Xiphias3
I believe it's the InprocServer32 key.
B
Quote:
Originally Posted by okosv
Is there way to detect file path of this control?
C
Quote:
Originally Posted by okosv
WScript.Echo "InprocServer (file): " & objCOMClassItem.InprocServer32
Reasons like this is why I always try to find or make my own type library and utilize the Watch window as much as I can. I made a somewhat long rant about the HTML Type library in another thread, and told the guy to reference they HTML Obj lib and declare his variables properly using the relevant DataTypes rather than Varianting everything.
I decided to look into this "WMI" and no surprise found a TypeLib and pumped out all the properties. Gotta love it when dot-notation shows something. For anyone interested in using WMI in VB6, then check out:
http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx
Also, here's how to use VB6 to get ALL the information by enumerating the properties and not missing out because you don't know the actual property name (as seen above, it was InprocServer32).
TypeLibrary:
Code:
Microsoft WMI Scripting V1.2 Library
System32\wbem\wbemdisp.tlb
Code:
vb Code:
Option Explicit
Private Sub Form_Load()
Dim oWMIService As WbemScripting.SWbemServices, oCOMSet As SWbemObjectSet, oCOM As SWbemObjectEx, _
oProp As SWbemProperty
Set oWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set oCOMSet = oWMIService.ExecQuery("Select * from Win32_ClassicCOMClassSetting where CAPTION LIKE '%X3Button%'")
For Each oCOM In oCOMSet
For Each oProp In oCOM.Properties_
If (Not IsNull(oProp.Value)) Then
Debug.Print Left(oProp.Name + String(16, " "), 16) + ": " + CStr(oProp.Value)
End If
Next oProp
Next oCOM
Set oCOMSet = Nothing
Set oWMIService = Nothing
End
End Sub
Output:
Code:
Caption : X3Button.ucX3Button
ComponentId : {86D8BF0F-163D-459F-A897-6BBA1870D3B9}
Control : True
Description : X3Button.ucX3Button
InprocServer32 : D:\Programming\X3 Button\X3Button.ocx
Insertable : False
JavaClass : False
ProgId : X3Button.ucX3Button
ToolBoxBitmap32 : D:\Programming\X3 Button\X3Button.ocx, 30000
TypeLibraryId : {E4BFA0E6-5F95-4C5C-AD49-FADB2AFCD5C6}
Version : 17.0
Re: [RESOLVED] Refer to spefic dll
thanks, there is some another way to detect file of ActiveX control:
Code:
Const HKEY_CLASSES_ROOT=&H80000000
Dim strValue
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
oReg.GetExpandedStringValue HKEY_CLASSES_ROOT,"ActiveLock3.Globals\CLSID", "", strValue
oReg.GetExpandedStringValue HKEY_CLASSES_ROOT,"CLSID\{4910BEE2-6F80-406B-B80F-3715B327C5F1}\InProcServer32", "", strValue
WScript.Echo strValue
Re: [RESOLVED] Refer to spefic dll
Detecting is easy. In the app, theres the function:
Code:
isOLEServerRegistered
Re: [RESOLVED] Refer to spefic dll