Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / March 2008



Tip: Looking for answers? Try searching our database.

Possibility of calling function in dll(MFCAppWizardDLL) from VB Ac

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
KSMH - 07 Mar 2008 09:51 GMT
Greetings,

when i call a function of a VB activeX DLL which interns call the VC++ MFC
DLL function, results in error .I am using the late binding to access the
ActiveX DLL from my VB application . Can you help me regarding this?

Run Time error Message displayed:
Run-time error '-2147417848(80010108)':
Method 'Add' of the object '_AddNumbers' failed'

If I use the early binding also result in
Runtime error’-2147221231(80040111)’
ClassFactory cannot supply requested class

I can able to directly access the MFC DLL function from my VB application .
But i need to call the function through the wrapper VB ActiveX DLL function.
Please help me.

(SimpleCalculator )VB ActiveX DLL code:

Option Explicit
Private Declare Function pstrGetHostName _
   Lib "C:\WINDOWS\system32\DLLExDEF.dll" _
   () As String

Public Function Add() As String
Dim strA As String
strA = pstrGetHostName()
Add = strA
End Function

VB Application Code:

Private Sub Command1_Click()
Dim obj As Object
Set obj = CreateObject("SimpleCalculator.AddNumbers")
Dim a As String
a = obj.Add()
MsgBox a
End Sub
 
Thank You,
Regards,
Mohamed Hanif KS
Ralph - 07 Mar 2008 13:50 GMT
> Greetings,
>
[quoted text clipped - 40 lines]
> Regards,
> Mohamed Hanif KS

This is a Registry problem.
The component is either not installed and thus not Registered, or installed
but not Registered correctly, or you have installed an incompatible version,
or the ProgID is not actually "SimpleCalculator.AddNumbers", but something
else.

1) Make sure you are using Binary Compatibility with your VB ActiveX DLL
project.
http://www.vbsight.com/BinaryComp.htm

2) Open the Registry and make sure you have a "SimpleCalculator.AddNumbers"
ProgID. If found delete all of them, including any 'versions' that are
present.

    HKEY_CLASSES_ROOT\SimpleCalculator.AddNumbers

[Versions will look like this ""SimpleCalculator.AddNumbers.1",
"SimpleCalculator.AddNumbers.2", etc.]

3) Register the component.

4) Open the Registry and make sure you have a "SimpleCalculator.AddNumbers"
ProgID.

[An easier way of getting back to zero is to delete/rename all instances of
your component and then run a Registry Cleaner to remove all references.
Then re-register your component.]

Let me know if this works, or if you need more details concerning the cause.

-ralph
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.