vbAdvance general dll problem

I want to create a plugin for an external application in VB6. To do this I
create a regular dll, export the necessary functions and compile the dll. So
far so good. The problem comes when I developed a second plugin (also in vb6
with vbAdvance) and try to load both in the external application. The first
plugin is loaded fine, but the second fails with error 998 (ERROR_NOACCESS).
I traced the problem to the code that starts the required vb stuff, in 
MRuntimeInit:
...
pGetClass = GetProcAddress(hMod, "DllGetClassObject") 
 If pGetClass Then 
   CopyMemory pCall, InitDelegator(FD, pGetClass), 4 
   'Fails on next line 
   lRet = pCall.Call(TA.iid, IID_ClassFactory, pICF)
...

Any ideas?

Thanks!

-- 
Message posted via http://www.vbmonster.com

0
kbkforums
8/23/2010 11:41:00 AM
vb.general.discussion 1016 articles. 0 followers. Follow

5 Replies
695 Views

Similar Articles

[PageSpeed] 54

"kbkforums via VBMonster.com" <u63178@uwe> schrieb im Newsbeitrag
news:acf32440dbda5@uwe...

> I want to create a plugin for an external application in VB6.
Why not use VBs "native ActiveX-Dlls" for your
plugin-concept - why fiddle around with vbAdvance,
to expose the functionality as "normally Declarable StdCalls"
when you can have "real Objects instead" (meaning:
"work *with* VB, not against it" ... ;-)

Just define a Plugin-interface (basically emtpy Function-
Calls and Method-Defs) in a separate Dll-Project.
Compile that as MyInterface.dll - and the only Class
in it as eg.: iMyPlugin.

Then "tell" any Plugin-Writer, that his Plugin can
be implemented in a normal VB5/VB6 ActiveX-Dll,
by putting a reference to your "Interface Dll" in the
plugin-project - and using VBs Implements-Keyword.

In your Main-Project you would do the same, reference
the Interface-Dll - and load any external Plugin-Library
against this Interface.

'In your Main-Project..

Dim SomePlugin As iMyPlugin 'declare the Plugin-Type

'load and cast the MainClass in your Plugin against the
'predefined iMyPlugin-Variable
Set SomePlugin = CreateInstanceRegfree( _
                            PluginDllFileName, "MainClass")


The above mentioned MyInterface.dll would not need
to be deployed at all - it is only there, to provide the
Plugin-Interface into your Main-Project - as well as
into the Plugin-Writers Dll-Projects.

And regarding RegFree instantiations directly per "Plugin-
Filename" - there are helper-solutions available.
(e.g. per 20kByte DirectCOM.dll - which you would need
to place beside your Main.exe)

Olaf


0
Schmidt
8/23/2010 12:31:27 PM
The external application requires that plugins expose their functionality as
"stdcalls" 

Schmidt wrote:
>> I want to create a plugin for an external application in VB6.
>Why not use VBs "native ActiveX-Dlls" for your
>plugin-concept - why fiddle around with vbAdvance,
>to expose the functionality as "normally Declarable StdCalls"
>when you can have "real Objects instead" (meaning:
>"work *with* VB, not against it" ... ;-)
>
>Just define a Plugin-interface (basically emtpy Function-
>Calls and Method-Defs) in a separate Dll-Project.
>Compile that as MyInterface.dll - and the only Class
>in it as eg.: iMyPlugin.
>
>Then "tell" any Plugin-Writer, that his Plugin can
>be implemented in a normal VB5/VB6 ActiveX-Dll,
>by putting a reference to your "Interface Dll" in the
>plugin-project - and using VBs Implements-Keyword.
>
>In your Main-Project you would do the same, reference
>the Interface-Dll - and load any external Plugin-Library
>against this Interface.
>
>'In your Main-Project..
>
>Dim SomePlugin As iMyPlugin 'declare the Plugin-Type
>
>'load and cast the MainClass in your Plugin against the
>'predefined iMyPlugin-Variable
>Set SomePlugin = CreateInstanceRegfree( _
>                            PluginDllFileName, "MainClass")
>
>The above mentioned MyInterface.dll would not need
>to be deployed at all - it is only there, to provide the
>Plugin-Interface into your Main-Project - as well as
>into the Plugin-Writers Dll-Projects.
>
>And regarding RegFree instantiations directly per "Plugin-
>Filename" - there are helper-solutions available.
>(e.g. per 20kByte DirectCOM.dll - which you would need
>to place beside your Main.exe)
>
>Olaf

-- 
Message posted via VBMonster.com
http://www.vbmonster.com/Uwe/Forums.aspx/vb/201008/1

0
kbkforums
8/23/2010 12:42:40 PM
"kbkforums via VBMonster.com" <u63178@uwe> schrieb im Newsbeitrag
news:acf3ae2ebc0a7@uwe...

> The external application requires that plugins expose
> their functionality as "stdcalls"
So you are apparently a Plugin-Writer then...

Ok, in case this "external application" was not written
yourself (in VB5/6) - then why not use another, more
suitable language, to produce your StdCall-plugin-dll(s)?

E.g. FreeBasic is one such language, which allows to
produce Windows-StdCall-Dlls in Basic-Syntax.
FreeBasic is in this regard very similar to PowerBasic,
but usable for free - coming under LGPL.

Please look at www.freebasic.net for more information.

Olaf


0
Schmidt
8/23/2010 1:24:37 PM
"kbkforums via VBMonster.com" <u63178@uwe> wrote in message 
news:acf32440dbda5@uwe...
:I want to create a plugin for an external application in VB6. To do this I
: create a regular dll, export the necessary functions and compile the dll. 
So
: far so good. The problem comes when I developed a second plugin (also in 
vb6
: with vbAdvance) and try to load both in the external application. The 
first
: plugin is loaded fine, but the second fails with error 998 
(ERROR_NOACCESS).
: I traced the problem to the code that starts the required vb stuff, in
: MRuntimeInit:
: ..
: pGetClass = GetProcAddress(hMod, "DllGetClassObject")
: If pGetClass Then
:   CopyMemory pCall, InitDelegator(FD, pGetClass), 4
:   'Fails on next line
:   lRet = pCall.Call(TA.iid, IID_ClassFactory, pICF)
: ..

This code is incomplete.  What file is used to get the return value of hMod? 

0
Kevin
8/23/2010 2:35:25 PM
Complete code:

Public Function DllMain(ByVal hinstDLL As Long, ByVal fdwReason As Long,
ByVal lpvReserved As Long) As Long
    
    Const DLL_PROCESS_ATTACH As Long = 1
    Const DLL_PROCESS_DETACH As Long = 0
    
    If fdwReason = DLL_PROCESS_ATTACH Then
        
        'Initialize the VB Runtime when this DLL is first
        'loaded by a process:
         RuntimeInitialize hinstDLL
            
        'Must return TRUE for success:
        DllMain = 1
        
    ElseIf fdwReason = DLL_PROCESS_DETACH Then
    
        DllMain = 1
        
    End If
    
End Function

In module MRuntimeInit (from vbAdvance samples):

Public Sub RuntimeInitialize(ByVal hMod As Long)
    
    Dim sFile As String
    Dim lLen As Long
    Dim lRet As Long
    Dim i As Long
    Dim lpTypeLib As Long
    Dim TLI As ITypeLib
    Dim lppTypeInfo As Long
    Dim TI As ITypeInfo
    Dim sName As String
    Dim pAttr As Long
    Dim TA As TYPEATTR
    Dim IID_ClassFactory As VBGUID
    Dim IID_IUnknown As VBGUID
    Dim pGetClass As Long
    Dim pCall As ICallDLLGetClassObject
    Dim FD As FunctionDelegator
    Dim pICF As IClassFactory
    Dim pUnk As IUnknown
    
    'Make sure parent process is not VB IDE:
    If GetModuleHandle("VBA6.DLL") <> 0 Then Exit Sub
    If GetModuleHandle("VBA5.DLL") <> 0 Then Exit Sub
    
    sFile = Space$(260)
    lLen = Len(sFile)
    lRet = GetModuleFileName(hMod, sFile, lLen)
    If lRet Then
        sFile = Left$(sFile, lLen - 1)
        lpTypeLib = LoadTypeLibEx(sFile, REGKIND_NONE)
        CopyMemory TLI, lpTypeLib, 4
        For i = 0 To TLI.GetTypeInfoCount - 1
            If TLI.GetTypeInfoType(i) = TKIND_COCLASS Then
                lppTypeInfo = TLI.GetTypeInfo(i)
                CopyMemory TI, lppTypeInfo, 4
                TI.GetDocumentation DISPID_UNKNOWN, sName, "", 0, ""
                If lstrcmp(sName, "CRuntimeInit") = 0 Then
                    pAttr = TI.GetTypeAttr
                    CopyMemory TA, ByVal pAttr, Len(TA)
                    TI.ReleaseTypeAttr pAttr
                    If TA.wTypeFlags Then
                        Exit For
                    End If
                End If
            End If
        Next i
        With IID_ClassFactory
            .Data1 = 1
            .Data4(0) = &HC0
            .Data4(7) = &H46
        End With
        With IID_IUnknown
            .Data4(0) = &HC0
            .Data4(7) = &H46
        End With
        pGetClass = GetProcAddress(hMod, "DllGetClassObject")
        If pGetClass Then
            CopyMemory pCall, InitDelegator(FD, pGetClass), 4
            lRet = pCall.Call(TA.iid, IID_ClassFactory, pICF)
'Fails on this line!!!!!
            If lRet <> CLASS_E_CLASSNOTAVAILABLE Then
                lRet = pICF.CreateInstance(0&, IID_IUnknown, pUnk)
                If lRet = S_OK Then
                    Set moInitObject = pUnk
                    moInitObject.InitVBCall
                    CopyMemory pCall, 0&, 4
                    Set pICF = Nothing
                    Set pUnk = Nothing
                End If
            End If
        End If
    End If
End Sub

Kevin Provance wrote:
>:I want to create a plugin for an external application in VB6. To do this I
>: create a regular dll, export the necessary functions and compile the dll. So
>[quoted text clipped - 10 lines]
>:   lRet = pCall.Call(TA.iid, IID_ClassFactory, pICF)
>: ..
>
>This code is incomplete.  What file is used to get the return value of hMod?

-- 
Message posted via http://www.vbmonster.com

0
kbkforums
8/24/2010 7:44:07 AM
Reply:

Similar Artilces:

General maintenance ALERTS
I'm resoponsible on a Critical SQL Server and would like to set up Alerts which will be send to me when things go wrong. In general, Which Alerts would you set for normal tracking? Gal See Tibor's great article http://www.karaszi.com/SQLServer/util_agent_alerts.asp "Gal" <Gal@discussions.microsoft.com> wrote in message news:A0B76076-9AF4-4C68-BA9F-A399A5C3D534@microsoft.com... > I'm resoponsible on a Critical SQL Server and would like to set up Alerts > which will be send to me when things go wrong. > In general, Which Alerts would you se...

Problem opening Excel files from Windows Explorer
Hi All, When I go to open up and Excel file from Windows Explorer by double-clicking it, a 1 is added to the filename. If I open the same file from within Excel itself there is no problem. Any ideas? Thanks From Windows Explorer's Tools menu | Folder Options | File Types Scroll to find XLS | Advanced Select Open then Edit Application used (for me running XL2003) is: "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" /e -- Rob van Gelder - http://www.vangelder.co.nz/excel "aj" <amandasteele@dodo.com.au> wrote in message news:1107057566.980551.234180@...

Dll Object
Hello All I Create A Dll Class In VB6 And I Want To Use It In Access XP But Without Set Is As A Reference So Can I Use The Create Object Methode To Create It As An Object In My Form As We Use The Create Object With Excel , If Yes What The Parameters Should Be Given To THe Method And Thanks For Every One For This Help Thanks Again Rabea Khalil Developer wrote: > Hello All See reply in m.p.a.forms -- Peter Doering [MVP Access] VB6 can only create ActiveX DLLs, so you must use regsvr32.exe to register the DLL. Then, as Peter suggested, you use Late Binding. Since there are entri...

recieving problem with the pop connector
on Small Buisiness Server 2003 with exchange im having a problem with incoming email from outside sources using a pop connector.. nothing gets thru and i get no error messages ... but with with email from "internal to internal" addresses and outgoing email to outside addresses both go thru fine... any ideas would be helpful thanks Justin wrote: > on Small Buisiness Server 2003 with exchange im having a problem with > incoming email from outside sources using a pop connector.. nothing > gets thru and i get no error messages ... but with with email from > "interna...

Very odd build problem
As part of my BSPs build process I am checking whether some components are built within a batch file, if these files are build the batch file exits and the build continues. If the components are not built then the batch file calls into a 3rd party build system and builds these components. The problem that I am finding is that during the build (lets say initialiated using blddemo -qbsp) the variable '_winceosver' is lower case, but if I build myself from the command prompt (for example openned using Build > Open Build Directory In Build Window) then the variable is in ...

Date Serial Problem
I have a querry in which I am using the Date Serial in the querry criteria as follows Between DateSerial([Enter Year:],[Enter Month:],1) And DateSerial([Enter Year:],[Enter Month:]+1,0) the result i get is for a a perticular month in a year. What I want is: 1. if i want to get the results between june to november 2009. how can i do it? 2. If i want to get the restult of 2008 only e.g. from 01 Jan 2008 (or any year) upto 31 December 2008. This should give result only for 1 year only. not by months like from june 2008 to june 2009 Please help me fix this querry ...

Problems reverse Engineering and Oracle 10g database
Has anybody figured out how to get rid of the error below, in Visio 2003, after converting from Oracle 9i to 10g? Error Msg box: MS-Visio - Encountered a fatal error during reverse engineer of information from database. Thanks. ------=_NextPart_0001_33969CE2 Content-Type: text/plain Content-Transfer-Encoding: 7bit Visio's drivers are only rated to support Oracle versions up to 8.x. So newer constructs, data types and objects found in the more recent versions of Oracle cannot be reverse engineered many times. As a workaround, you can try using the 'Generic ODBC' driver ...

Declare Sub Sleep Lib "kernel32.dll" ( ByVal dwMilliseconds As Lon
Greetings, I Have a few questions, and am quite stumped 1. In Word is there an alternitive to the API call to pause the applications progress? 2. Does the Sleep Procedure halt the OS or just the application? 3. My over all problem is I am moving a file from one folder to the another. The trouble is at runtime I get a "Permission denied" error, If I place a Break Point on the sub procedure to move the file or step through it it works fine this problem only occurs @ runtime. See Code below Sub MovePrintedFile(ByVal sFileName As String) Dim oFSO As Object Dim sDest...

COMLdap.dll and nsldapssl32v30.dll
Can someone please tell me is these two dll's belong to the Microsoft Exchange server and if they are missing do I need to re-install Exchange Server? Thanks. I believe comldap.dll is an Exchange system file and nsldapsslv30.dll is a Windows system file. Are you experiencing errors? Nue "siglov" <siglov@discussions.microsoft.com> wrote in message news:2BD7BAAB-7CD1-434D-BF37-C63FB81007AF@microsoft.com... > Can someone please tell me is these two dll's belong to the Microsoft > Exchange server and if they are missing do I need to re-install Exchange > Se...

OWA Logoff problem
I just implemented Exchange Server 2003 OWA to access email over the internet. One issue I have is on a Win 98 laptop using IE 5. When I click the Log Off button, a screen comes up with a button to close the brower. The browser closes ok, but my login credentials are not deleted until like 10 minutes after I log off. Until that point, I can just pull up the URL, and OWA comes up authenticated!! After approximately 10 minutes, a little window flashes on the screen (flashes too quick to even read it). After that window flashes, OWA requires authentication. My XP clients with IE 6 log off i...

Excel 2000 hyperlink problem
I have a spreadsheet of personnel from other offices that has the usual items: Name, Address, City..., Phone, emails, etc. For some reason in the middle of the worksheet, every cell has an email hyperlink, and not necessarily for the associated person. It's in cells that are not even email addresses. If I try to remove the hyperlink, Excel hangs- up and I have to task-manager out of it. Some of the items have been copied and pasted from another workbook, but there were no macros involved, if that means anything to you. So my question is, how do I either remove the hyperlinks fro...

Problem running demos
I am presently looking at this site http://office.microsoft.com/home/video.aspx?assetid=ES102019711033&width=884&height=540&startindex=0&CTT=11&Origin=HA102019691033&app=WINWORD&ver=12# I get a blank screen with the word "done" at the bottom and no video. I have followed all the instructions to install Silverlight and have looked at the troubleshooting tips on the page regarding this problem. I don't see the words buffering, connecting, or ready on the screen. Can someone help me with this? Thanks, Jim B. Hi Jim, It's no...

Registration for vbAdvanced
I know I had the registration code for vbAdvanced before, but am unable to find it now. It seems that I remember it now being free, since the program is no longer for sale. A search on Google failed to turn anything about a registration code and the site that the program takes you to does not mention anything about it or have anyway to contact anyone. Does anyone know where to get a registration code now? Thanks, Norm I also seem to remember it being freed, but like you can no longer google to it. In witness thereof, I as income@ihug.co.nz hereby agree that the given c...

calling/loading c++ dll
I made a dll in c++ to do some calculations, and i call it from vba ( for excel XP, also tried it fro access and excel 2000) Problem is that when i copy the dll to another PC and run the same vba code i get "run time error 53, dll file not found", on the pc where the dll i created everything works nice I've tried to register the dll with regsvr32 and from the vba code, with "regsvr32 myDll.dll" i get the error "the specified module could not be found" I used a "MFC DLL " project in visual studio .net to create the dll, in basic i followed this exa...

Outlook client 3.0 problem
Hi, One of the clients i installed the laptop client on has a problem. when in online mode and you click accounts, you get a verification error and the option to retry or close. When you click retry, it all works fine. Its always the first click on accounts after oulook is started. anybody any idea? Thanx ...

OWA Logon Problems #2
Exchange 2003 Frontend/backend scenario. Both are Win2k3 SP1 with Exchange 2003 (no SP1, not SBS). Both servers are on their own VLAN right now for testing and I have enabled the following reg key so FBA does not need SSL to work: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeWeb\OWA create DWORD AllowRetailHTTPAuth and set this to 1 Problem is that when I try to logon to my Frontend OWA page I get "You could not be logged on to Outlook Web Access. Ensure that your user name and password are correct, and then try again". This happens when I use credentials in &qu...

Password problem #6
I am on the phone right now with MS, actually I am on hold with them. So far they have asked everything to me about who I am and what software I have, but have given me NO answer. They even asked for the PID for the software which they specifically say you must LOG IN to Money to get it. (Little Ironic) or should I say Moronic. So I ended up having to give the part number off the CD and she come back and tells me there are no items in here database referring to my part number. You would think they would just look up Money 2004 instead of some random part number on my CD!!!!! Sti...

Problem with Outlook 2002...
I have been using Outlook 2002 as part of Office XP for some time now. Suddenly, I start getting the following error: Task 'pop.mail.yahoo.ca - Sending and Receiving' reported error (0x8004210A) : 'The operation timed out waiting for a response from the receiving (POP) server. If you continue to receive this message, contact your server administrator or Internet service provider (ISP).' I am using Yahoo as a POP3 and SMTP gateway. Please note that this configuration has been working for almost a year and a half! I can ping Yahoo's servers no problem. I did some Googli...

C:\WINDOWS\system32\ieframe.dll\1
Hello, if you have problems with VB6 - C:\WINDOWS\system32\ieframe.dll\1 1. open regedit 2. search for: C:\WINDOWS\system32\ieframe.dll\1 3. change to: C:\WINDOWS\system32\ieframe.dll 4. save regedit finished :) ---------------------------------------------------------------------------= ---------- Hallo, wenn ihr Probleme mit VB6 habt - C:\WINDOWS\system32\ieframe.dll\1 1. =F6ffnet regedit 2. sucht nach: C:\WINDOWS\system32\ieframe.dll\1 3. =E4ndern zu : C:\WINDOWS\system32\ieframe.dll\ 4. speichert regedit fertig :) "netbase4web" <netbase4web@web.de&...

Microsoft word 2007 (problem)
Why i can't use my Microsoft word 2007 2 open doc. document? When i open doc. document, it doesn't appear any alert message, it just a blind and automatic close my Microsoft word 2007. If i open docx. document, it doesn't affected. Any experts on here mind to tell me wat's going on? pls help me solve it as soon as possible.. Thanks.. i really ur hands, guys... -- magnat_pvl See http://www.gmayor.com/what_to_do_when_word_crashes.htm then http://word.mvps.org/FAQs/AppErrors/ProblemsStartingWord.htm attending to the normal template, the registry data key ...

Concatenate Problem #3
Hi, I frequently have problems concatenating cells in Excel. I have three columns of data that I want to concatenate. I click on the Fx key and select function. In the first cell in the wizard, I select C2, in the next cell I select D2 and in the third I select E2. When I click ok, the cell reads =CONCATENATE(C2,D2,E2) rather than actually concatenating the data in the three rows. Sometimes Excel will concatenate other times it will simply give me my formula. Can anyone help? Thanks, Chuck Hi check the format of this cell. It is probably 'Text'. change this to '...

RMS General Info
I am interested in using RMS store operations and Headquaters. Does anyone have any documentation on how the product works? I want to present it to a group...(in hopes of approval) I want a document or something that shows step by step how things are done...inventory, cash/check/tender transactions, return/exchange etc. Please help...ASAP Contact a reseller or go to the RMS site they have demos and white papers "Millie" <anonymous@discussions.microsoft.com> wrote in message news:041101c48b04$b330daf0$a301280a@phx.gbl... > I am interested in using RMS store opera...

Outlook problem #38
Lately when I attempt to delete spam from the incoming mail, Outlook hangs up and I receive the following message:CiceroUIWndFrame Anybody know what is happening. I have checked for virus and do not have any. ...

Error in mso9.dll file
Requesting assistance correcting error message. When I am attempting to start a new e-mail message in microsoft outlook, I receive an error message stateing that an error has occurred in the mso9.dll file. Outlook then shuts down. * I can still receive mail in outlook ( Can't reply or generate new outgoing mail) * No new programs have been installed * This is the original outlook program that came with the laptop on purchase. Recommendations are appreciated. ...

Outlook 2003 SMTP problem
I have one user in a group of 15 that is the only person having this problem When I try to send mail I get (The server responded: 503 no recipient (s) The account works fine in Outlook Express, also when I hit send/receive without any messages in the outbox, I get this same error. I reinstalled Office 2003 and that did not help at all Any idea's? Thanks Tom ...