|
You only have to generate a strong name for interop if you plan to put the class library assembly into the GAC. This is recommended if you're going to share the component between applications, for example have multiple applications install the same component, but isn't actually required. The regasm utility can be made to register a class library DLL in any location using the /codebase switch; the Visual Studio deployment project's Register property, if set to 'vsdraCOM', will set the Codebase registry value appropriately if you're not installing the assembly to the GAC.
If you do install the same assembly from two different locations, then uninstall one of them, the registration will be broken for the other one. That's why the GAC is recommended.
If you do want to use the GAC, all assemblies that this one depends on will need to be signed and installed to the GAC as well. You can sign the DAL using the C++ linker's /KEYFILE option; you must specify this option in the 'Additional Options' field in the Linker options.
|
|
|
|
|
Hi,
How to register XPCOM component using XPInstall?
Thank you.
Ayesha
|
|
|
|
|
|
which book is good for COM
|
|
|
|
|
|
Essential COM (Don Box) - it goes into a lot of depth and can be quite daunting in places but it's a goldmine of important information.
|
|
|
|
|
|
Hi!
I am a newer.,
What is COM?
Why we relates this one to .net..?
If i want to know basics abt the COM Can you refer any good site..?
T.Prabu
|
|
|
|
|
search in msdn site good one
|
|
|
|
|
|
Hello friends,
For the first time I am working with ActiveX control.I have search
through net but not getting the clear idea how t handle events in
active x.
I have dialog based application and i have added a contol in that
through project ->add to project
components and control. and then add arielapi control by which i got a
wrapper class ,.cpp file, and .h. file.
THIS ARE CLASS METHOD in arielapi.cpp
<br />
CString CArielAPI::Login(LPCTSTR UserName, LPCTSTR Password, LPCTSTR<br />
UserId)<br />
{<br />
CString result;<br />
static BYTE parms[] =<br />
VTS_BSTR VTS_BSTR VTS_BSTR;<br />
InvokeHelper(0x2, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms,<br />
UserName, Password, UserId);<br />
}<br />
<br />
CString CArielAPI::RequestPrices(LPCTSTR SessionId, short PageNumber)<br />
{<br />
CString result;<br />
static BYTE parms[] =<br />
VTS_BSTR VTS_I2;<br />
InvokeHelper(0x3, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms,<br />
SessionId, PageNumber);<br />
return result;<br />
}<br />
<br />
<br />
CString CArielAPI::RequestDeal(LPCTSTR SessionId, long MarketNo,<br />
LPCTSTR Amount, short TradeType, LPCTSTR Exchange, short BuySell,<br />
LPCTSTR Account, LPCTSTR ClientRef)<br />
{<br />
CString result;<br />
static BYTE parms[] =<br />
VTS_BSTR VTS_I4 VTS_BSTR VTS_I2 VTS_BSTR VTS_I2 VTS_BSTR VTS_BSTR;<br />
InvokeHelper(0x4, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms,<br />
SessionId, MarketNo, Amount, TradeType, Exchange, BuySell, Account,<br />
ClientRef);<br />
return result;<br />
}<br />
<br />
CString CArielAPI::RequestQuote(LPCTSTR SessionId, long MarketNo,<br />
LPCTSTR Amount, short TradeType, LPCTSTR Exchange, LPCTSTR Account,<br />
LPCTSTR ClientRef)<br />
{<br />
CString result;<br />
static BYTE parms[] =<br />
VTS_BSTR VTS_I4 VTS_BSTR VTS_I2 VTS_BSTR VTS_BSTR VTS_BSTR;<br />
InvokeHelper(0x5, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms,<br />
SessionId, MarketNo, Amount, TradeType, Exchange, Account,<br />
ClientRef);<br />
return result;<br />
}<br />
<br />
AND this are events method which are getting by right clicking the
control in dialog box.
<br />
void CWartz_newDlg::OnLoginArielapictrl1(LPCTSTR SessionId, short<br />
Accepted, LPCTSTR FailureMessage)<br />
{<br />
<br />
<br />
}<br />
<br />
void CWartz_newDlg::OnPriceQuoteArielapictrl1(LPCTSTR SessionId,<br />
LPCTSTR RequestId, LPCTSTR Price, short Timeout)<br />
{<br />
<br />
}<br />
<br />
i want that when i click button it get connected to server and if
successful and get sessionid start getting the price qoute.and display
it and i dont know what to do with events if i want to fire events what
should i do for that Can anybody help me to solve this problem..
for connection button the code is :
<br />
<br />
void CWartz_newDlg::OnConnect()<br />
{<br />
CString sessionid= m_arielapi.Login("wwtest2","RD9234","wwtest2");<br />
CString serveradd=m_arielapi.GetServerAddress(sessionid);<br />
<br />
<br />
CString cstrDisplayData;<br />
cstrDisplayData.Format(_T("==>Connected to<br />
server[%s][%s]"),serveradd,sessionid);<br />
LOG(0,cstrDisplayData);<br />
}<br />
<br />
-- modified at 2:05 Wednesday 23rd August, 2006
|
|
|
|
|
We can call activex function with object of activex control. The OnConnect function will be called like this
obj.Connect
or
You can write connect code in button click event
Thanks & Regards
Kumar
abc
|
|
|
|
|
I have a atl control, having two properties. I want to use the html tag "param" to set new value. How? Thanks.
|
|
|
|
|
Hi,
I have a problem with a C++ COM server which is a service.
I define my own data structure with a bstrName and an integer for example.
And I try to get a list of the structure with a VB Client.
Here is the code of my COM object :
<br />
class ATL_NO_VTABLE CGWCServerLorCom : <br />
public CComObjectRootEx<CComSingleThreadModel>,<br />
public CComCoClass<CGWCServerLorCom, &CLSID_GWCServerLorCom>,<br />
public IGWCServerLorCom<br />
{<br />
public:<br />
CGWCServerLorCom();<br />
~CGWCServerLorCom();<br />
<br />
DECLARE_REGISTRY_RESOURCEID(IDR_GWCSERVERLORCOM)<br />
<br />
DECLARE_PROTECT_FINAL_CONSTRUCT()<br />
<br />
BEGIN_COM_MAP(CGWCServerLorCom)<br />
COM_INTERFACE_ENTRY(IGWCServerLorCom)<br />
END_COM_MAP()<br />
<br />
DECLARE_CLASSFACTORY_SINGLETON(CGWCServerLorCom)<br />
<br />
public:<br />
STDMETHOD(GetTagSpy)(long lgTagSpy, long *plgTagSpyReal, GWC_TAG_SPY_INFOS *pTagSpyInfos);<br />
lgTagSpy = size of the list given
plgTagSpyReal = real size of the list
pTagSpyInfos = list of structures
The structure is defined like this :
<br />
typedef struct ST_GWC_TAG_SPY_INFOS<br />
{<br />
BSTR bstrTagName;<br />
BSTR bstrTagValue;<br />
LONG lgTagValue;<br />
} GWC_TAG_SPY_INFOS;<br />
Actually I have 2 problems nowdays.
in VB I defined a table m_tabTagSpy() as GWC_TAG_SPY_INFOS
Let say I want 10 Tags : redim m_tabTagSpy(10)
I call m_pIServerLorCom.GetTagSpy 10, lgRealSize, m_tabTagSpy(0)
In return I only have the first value filled, when I check in debug, the C++ fill the all structure whithout exception, but returning the hand to the VB and every datas are lost !!!
Moreover if I ask the values one by one, I have big memory leaks but I don't know where.
If anyone could help I would be very grateful.
Matt.
|
|
|
|
|
Since you're working with VB, you're best off with an Automation-compatible interface. I would recommend using a SAFEARRAY of your structure.
Your problem is stemming from the Automation marshaller not knowing that you actually want an array; it therefore does not marshal the data appropriately across the process boundary.
See this article[^] for information on how to use arrays of user-defined types in COM objects.
|
|
|
|
|
Hello everyone,
I’m starting on a new project. My major task is to create vb.net application using the existing com component which is created with MFC (I think it is kind of com component created and based on the c code).
I searched a lot of materials from internet and found all the examples are kind of vb.net call the com component created with vb6 (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callcomcomp.asp) and c application call the com component created with c code (http://www.codeproject.com/com/comintro.asp).
Could you tell me is that possible to create vb.net application calling the com component created with MFC (Kind of C code). Do you have an example on how to do it?
Thank you very much for your any information in advance
Jane
|
|
|
|
|
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
|
|
|
|
|