|
I have created a COM+ component in VB.NET. This is a class library using factoring compiled into a dll file (MHC_ES.dll). This file references a C++ dll called "vb.dll". This is on a Windows Server 2003 using a Windows XP (eventually Windows 2000 to be used) client.
The problem is, when I have the service started on the server, the COM+ solution attached to the correct process, run the client, and get to one of the COM+ functions, it does not step into the breakpointed code on the server (COM+ solution open). I also get an error saying "Unable to load DLL (vb.dll)" - not the COM+ dll component, but the C++ dll it refers to.
The following code and methods are used to create the component service:
<assembly: applicationname("vbdll_es")="">
<assembly: descriptionattribute("vbdll_remoting="" component")="">
<assembly: applicationactivation(activationoption.library)="">
<assembly: assemblykeyfile("vbdll_es.snk")="">
<transaction(transactionoption.required), _
justintimeactivation(true),="" _
objectpooling(enabled:="True," minpoolsize:="2," maxpoolsize:="10)," _
constructionenabledattribute(default:="Server=192.168.0.46;Integrated Security=SSPI" )=""> _
Public Class vbdll_remoting
Inherits ServicedComponent
Public Shared attrs() As Object = {New System.Runtime.Remoting.Activation.UrlAttribute("tcp://192.168.0.46:50000/vbdll_remoting.rem")}
Public Shared instance As vbdll_remoting = Nothing
Public Shared Function get_instance() As vbdll_remoting
Dim intInput As Integer
If (instance Is Nothing) Then
Try
instance = New vbdll_remoting
Return instance
Catch ex As Exception
MsgBox(ex.Message & vbCrLf & vbCrLf & "'vbdll_remoting.get_instance' failed.")
End Try
End If
End Function
<autocompleteattribute(true)> _
Public Sub remote_check()
'See if App is up and running.
End Sub
End Class
' And a module here referring to vb.dll (C++ compiled dll)
' functions.
Imports System.Runtime.InteropServices
Module vbdll_ext
' /*** DLL test functions***/
<dllimport("vb.dll")> _
Public Sub vb_set(ByVal str_Renamed As String)
End Sub
' Other references to vb.dll (C++ compiled dll)
End Module
I use the following methods:
1. gacutil -i MHC_ES.dll
2. regsvcs.exe MHC_ES.dll
3. open Component Services
4. find corresponding COM+ component
5. open properties
6. Activation tab, change to Server Application
7. press "Apply"
8. check "Run application as NT Service"
9. go to Advanced tab
10. check Debugging "Launch in debugger"
11. OK and close properties
12. export as .MSI and install on client
13. refer to MHC_ES class on client
14. Start the component service on server
15. Open COM+ VB.NET solution on server
16. Go to Debug on menu and attach to appropriate process which appears as DllHost.exe
17. Run app on Client (Windows XP on network to Windows Server 2003)
18. Step to point at which it calls COM+ function
The breakpoint set in the COM+ VB.NET solution does not catch, and the "Unable to load DLL (vb.dll)" comes up.
I've been trying lots of things, but cannot get it to step into the COM+ code on the server side. I have run the client app on the Windows 2003 server itself. It will step into the COM+ code, but as soon as it hits the vb.dll function, it hangs. This vb.dll is a legacy dll that has been working fine.
In fact, using .NET remoting in stead of COM+, the stepping into the server side code was working fine! Including into the vb.dll C++ generated code. There were just other mysterious problems (crashing) running over night, so I wanted to give COM+ a try.
Any help appreciated! (Hope I didn't give anyone a headache ...)
Bryan
|
|
|
|
|
Been working on this - main problem now is "Unable to load DLL (vb.dll)". The COM+ object seems to work properly because I can see it running on the Client and Server, and I do a database call from Client to Server and the Client retrieves the appropriate data from the Server.
But when a call is made to the unmanaged C++ "vb.dll", it says "Unable to load DLL (vb.dll)".
So how do I enable the COM+ object to find or load the unmanaged DLL? I have put the vb.dll in the Windows/system32 folder - I have put it in the corresponding project folder.
Code is simply:
' /*** DLL test functions***/
<dllimport("vb.dll")> _
Public Sub vb_set(ByVal str_Renamed As String)
End Sub
Changing "vb.dll" to include path "C:/folder/vb.dll" will just cause error to read "Unable to read DLL ("C:/folder/vb.dll").
Help!
|
|
|
|
|
Could somebody tell me that in a Java application,how to call methods in a COM component?
William
|
|
|
|
|
Java provides JNI - java native interface. this is the only way to communicate between Java - Win32 paltfoprms. But JNI needs win32 components as pure win32 dlls and it doesnt understand COM components. So write a win32 dll wrpper over the com component and use it.
cheers..Milton KB
|
|
|
|
|
Thank you so much for your help. But I really need a simple way to call a method in a COM object from a Java application.
William
|
|
|
|
|
|
|
All,
I am currently using the Typelib wrappers for MSXML that was generated from the MFC Typelib Class wizard. I think I am using the objects incorrectly, and this is generating unhandled exception errors.
I use wizard MFC Class from Typelib to generate wrapper classes for the MSXML5 control (CXMLDOMDocument, CXMLDOMElement, CXMLDOMNode, and CXMLNodeList). The exception occurs when I pass a CXMLDOMNode reference to a function that I want it to work on by stepping down farther in the node tree. For example:
If(m_XMLDOMroot.hasChildNodes())
{
int rootchildcount = RootNodeList.get_length();
for(int i = 0; i < rootchildcount; ++i)
{
CXMLDOMElement childnode = RootNodeList.get_item(i); <- This code sometimes user breaks
SetChildNode(childnode);
}
}
PS - I did not know it this group would also apply to this message.
Robert
|
|
|
|
|
Hi,
Could anyone tell me how to detect the play of a video file (any video file like AVI, WMV, MPEG etc...)?
If any application (like RealPlayer or Windows Media Player) plays the video file, my application should recieve a notification.
Thanks in advance,
Pavan
Regards,
Pavan
|
|
|
|
|
Hi, I am trying to write a program to access messages from outlook express. I have downloaded 4 programs with source code which all work but will not compile on Bloodshed C++ Visual c++(4) nor visual studio 2005.
Is is possible to load mapi32.dll on any of these three compilers? I have writen programs to access the parrallel port / and usb ports no problem but can't find anything simple to start using mapi. MFC will not work either.
Alternatively what should I buy to make sure it will be possible to access outlook? (I have spent nearly 50 hours so far trying all combinations and no joy)
Is there an equivalent to this for mapi32.dll:
HMODULE myDll;
myDll = LoadLibrary("K8055D.DLL");
myOpenDevice = (tOpenDevice)GetProcAddress(myDll,"OpenDevice");
tWriteAllDigital myWriteAllDigital;
myWriteAllDigital = (tWriteAllDigital)GetProcAddress(myDll,"WriteAllDigital");
int j = myOpenDevice(0);
myWriteAllDigital(255-data);
if (data == 0) FreeLibrary(myDll);
Many thanks
|
|
|
|
|
Is there any downloadable book on internet to learn COM in C++ from the fundamental steps?
|
|
|
|
|
Inside COM by Dale Rogerson is a good book for beginners but I dont know u will get it as ebook
never say die
|
|
|
|
|
I have read the article "Building an Office2K COM addin with VC++/ATL"
Although I followed the steps one by one as it has been specified in the article and the registry entry for the dll was entered correctly by the code
HKCU
{
Software
{
Microsoft
{
Office
{
Outlook
{
Addins
{
'OutlookAddin.Addin'
{
val FriendlyName = s 'ADOutlook2K Addin'
val Description = s 'ATLCOM Outlook Addin'
val LoadBehavior = d '00000008'
val CommandLineSafe = d '00000000'
}
}
}
}
}
}
}
no addin is appeared in "Tools->Options, under Other tab,
Advanced Options->COM Addins "
would you help me with the matter, please
|
|
|
|
|
have u created the entries in HKEY_CLASSES_ROOT with the friendly anem and clsid?
hello
|
|
|
|
|
have u created the entries in HKEY_CLASSES_ROOT with the friendly name and clsid?
-- modified at 0:06 Wednesday 9th August, 2006
Sudeesh
|
|
|
|
|
What's the relation of ComBStr, _bstr_t, BStr??
|
|
|
|
|
|
|
|
|
In short: CComBSTR is a thin wrapper around the BSTR API, while _bstr_t is a rather thick one. By thick I mean that it wraps associated HRESULTs into exceptions.
_bstr_t is more suitable for applications, in which it's almost always possible to throw exceptions across calls. In certain scenarios however, such as in COM components, it's not advisable to do that because of threading/apartment issues (it's downright dangerous!). In such scenarios, CComBSTR is far better suitable, as it does not throw exceptions.
--
Mr. Bender's Wardrobe by ROBOTANY 500
|
|
|
|
|
|
Hi all,
i am trying to create GUID with CoCreateGuid but it is
not creating guid.
I am working on windows XP.
ole32.lib is added in link tab.
then what is the problem?
what is wrong in this code?
#include <iostream.h>
#include<objbase.h>
int main(void)
{
HRESULT Res;
GUID *pGuid=NULL;
LPVOID pIni = NULL;
if(CoInitialize(pIni) == S_OK)
{
Res = CoCreateGuid(pGuid);
if(Res == S_OK)
{
cout<<"Created";
}
CoUninitialize();
}
return 0;
}
Thanks in advance
|
|
|
|
|
Its failing because you are passing a NULL pointer into CoCreateGuid(), try this instead.
<br />
GUID guid;
LPVOID pIni = NULL;<br />
<br />
if(CoInitialize(pIni) == S_OK)<br />
{ <br />
HRESULT Res = CoCreateGuid(&guid);
if(Res == S_OK)<br />
{<br />
cout<<"Created";<br />
} <br />
CoUninitialize();<br />
}<br />
-- modified at 3:40 Friday 4th August, 2006
Darka [ Xanya]
"When you're taught to love everyone, to love your enemies, then what value does that place on love?"
|
|
|
|
|
how can i handling IHTMLElement event?
i want to process the onclick(maybe other) event in IE
|
|
|
|