|
I am having a simple COM object (COM wrapper) in C#. I register the object for COM Interop by using regasm and gacutil /i (.Net Command Prompt).
I am able to call my COM object from classic COM capable applications.
My question is if I want to update my COM object, it seems to me that I have to reboot my machine before the updated COM object works. If I don't reboot the machine, the COM capable applications still reference my old COM object. Is there a way to update COM object (COM wrapper) without restart the machine?
Note: I can not use Cofiguration Properties->Register for COM Interop (VS.NET 2003) because I need to deploy my COM object to my production server.
Any suggestion will be appreciated.
|
|
|
|
|
Are you un-registering and removing the old com wrapper from the GAC first? (gacutil /u , regasm /u)? Note that if there are outstanding references gacutil /u will fail and echo the reference count.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
This is what I did for register my new version of COM wrapper.
1. gacutil /u xxx
2. delete the dll and tlb files on one location. (Note: most of the time, windows won't allow me to delete the tlb file, so tlb file couldn't updated. Therefore, I will create a new directory, and register in the new directory)
3. regasm xxx.dll /tlb:xxx.tlb
4. gacutil /i xxx.dll
I check the GAC, etc. Every things updated. But when I use SQL Server, TSQL to access my COM wrapper, the COM wrapper is not my new version.
One question is do I have to use regasm /u also??
Thank YOu for your reply.
|
|
|
|
|
hchiu wrote:
One question is do I have to use regasm /u also??
if you are changing the type library, yes.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
Actually I need to stop the SQL server in order to update my COM wrapper.
Therefore, everythings work now.
|
|
|
|
|
Hello
I am using an ActiveX component in my web page, it all works fine localy on my machine, but when I put my code on a server and access it from a client the ActiveX dosent load. All I get is an error saying "ActiveX Component Can't Creat Object".
What do I have to change to make my solution work on the server
Spaz
|
|
|
|
|
hi,
I have a set of avi files how I can I read one avi and write the video and audio assoiated with that avi to another new avi(to be created).
and also let me know how to join to avi,s in c++(vc++/borland c++)
regards
shaan
se
|
|
|
|
|
Hi ,
I need to show only selected activeX controls in a list box of a dialog.
Are there any API's to do so. I came across some demo applications which show all registered MFC activeX controls but not the one which shows only user-defined.
Is there any way out ?
|
|
|
|
|
Hi,
I am trying with a program that will create an ActiveDesktop using IActiveDesktop. I want to manipulate the buttons on ActiveDesktop which is intented to manipulate the state of the ActiveDesktop as IS_NORMAL, IS_FULLSCREEN, IS_SPLIT. Is there any option for doing it programically?
Waiting your responses
Vinod
|
|
|
|
|
I want to create a group of COM+ objects and put into system pool so that:
It can access objects by name(or index) from different processes in same server along with availability to access from another machine on network. The object state will be remembered during calls.
Hope there is a solution for this. Appreciate your help in advance!
|
|
|
|
|
Hi folks!
I need to create a DCOM Server to manage multiple objects (hardware driver wrappers).
I Created DCOM Server with object classes and methods declaration, but I wanted to envelope every object in a separate DLL, to be modular. (just to make things easier if I wanna change a board, i.e.)
Now, I created a Win32 DLL (I do not need COM support, while I'm just implementing functions) but I need to get by parameter the effective class of my COM object. I tried that by including the object H file with class declaration, but it tells me that ATL_NO_VTABLE cannot be understood.
What can I do? Did I reason well? Or I need a COM DLL anyway?
Thanks a lot for now,
Morenz
|
|
|
|
|
Hi,
I'm not sure what are you trying to achieve. I assume, that you have some DCOM object, exposing a set of functions, these being implemented in different .dlls, that can be dynamically loaded from your object. Problem is, that one of the parameters to these functions implemented in .dlls should be a pointer to the DCOM object that calls them. Is that right?
I think you need to include the ATL headers into your dlls as well, to have defined the ATL macro ATL_NO_VTABLE . This will not change your .dlls to COM dlls (they will not require the registration)
There's also another problem with the ALT objects. There's an interesting twist, because of IUnknown implementation. To keep it short, simply your ATL object is not really the object being constructed. If I assume your object name is CMyObject then the object constructed is in fact CComObject<CMyObject> . So to stay on the safe side, your parameter should not be only CMyClass& , but CComObject<CMyClass>& (or pointer if you prefer)
Anyway, safest way would be to export some sort of interface from the DCOM object, that these dlls will use to communicate. Then you can take the declaration of the interface from the header file generated by MIDL and use it in the .dlls. (filename is usually projectname.h )
Hope this helps
|
|
|
|
|
First of all thanx a lot,
then... it's right what you say (about project architecure) but if I try to only #import my MIDL result (thats .TLB, not .h, I think) in my DLL, I have the error on ATL_NO_VTABLE. Do I have to #import all .idl files in my DLL? Or creating my CComObject<cmyclass>& can work well?
Thanx a lot again, I'm neither a COM nor a DLL expert (my last COM written was about in 1998... my last DLL in 1997...)
Best regards,
Morenz
|
|
|
|
|
hm, as I could understand the ATL_NO_VTABLE problem, when you're including the object.h file, the code generated with #import never contain the ATL macros. You probably forgot to remove the object.h include.
I always used #import "blahblah.tlb" no_namespace named_guids for including COM objects to my projects. Problem is, that this doesn't import the object as-is from the C++ point of view. It defines all interfaces the object is derived from and all Guids required for the object - Guids of interfaces and of the object itself. If you look into your debug (or release) directory, you'll see object.tlh and object.tli (optional), that contains code generated by the #import .
Well, when you have the interfaces imported, you can use one of them as a controlling interface. General interface is IUnknown . From this you can QueryInterface to get any other interface exported by the object.
The CComObject thing is when you decide not to import interfaces, but the C++ object definition.
The method I would choose depends on what you want to achieve, but generally I'd prefer to
a) create a special interface for controlling the DCOM object, passed to the .dlls
b) create a third c++ object, that is included in the DCOM as well as in the .dlls. It's purpose is only for exchanging the information - the DCOM object creates one instance and passes it to all calls to the .dlls. Or even considering the implementation to be in the C++ object and only calls from outside will be proxied through the DCOM object.
Then the DCOM object will be only very thin wrapper - generally only thing it will does will be to create the third object (or derive from) and then simply proxy all calls from DCOM to the C++ object. I hope the explanation is clear, here's 7:00 morning
The a) and b) are more or less equal, the a) is more COMish, while the b) is more C++ish.
|
|
|
|
|
Yeah, I know what you meant, it was 7.00 here, too!
I read this only now, and tomorrow I will give it a shot.
I 'll make you know.
For now, many thanks.
|
|
|
|
|
Hi,
I have a COM object that exports a couple of interfaces and some enums. I need to access this from JScript, and everything works expect for the enums.
Here's the idl file:
in myCOM.dll
typedef [uuid(someIDHere.....)] enum tagEnum
{
a = 0xFFF,
b = 0,
c = 1,
}enumType;
[
object,
uuid(..................),
dual,
helpstring("IMyInterface"),
pointer_default(unique)
]
interface IMyInterface : IDispatch
{
[id(1), helpstring("test")] HRESULT Test();
};
[
uuid(E0691460-B804-11D5-ADF6-00C04F029739),
version(1.0),
helpstring("MyCOM 1.0 Type Library")
]
library MyCOMLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
uuid(....................),
helpstring("MyCOM Class")
]
coclass MyInterface
{
[default] interface IMyInterface;
};
};
The JScript code looks something like this:
var mycom = WScript.CreateObject("MyCom.MyInterface");
mycom.Test();
etc.
I tried to access the methods and the enum from VB and it works fine. So there's nothing wrong with myCOM.
How can I access the enum from JScript?
Thanks!
|
|
|
|
|
My DCOM program works in a local network,
but if connect to some computer via VPN,
DCOM is not working ,
what is the reason ?
If this is a security - which settings I must configure,
that VPN become true transparent for DCOM ?
thanks you.
|
|
|
|
|
Hi,
I developed application for handling incoming call using Tapi 3.0 (COM base)
now i want to convert that application in to DLL. but i don't know how to
create COM DLL. because in that application i used COM interface.
I will use that DLL in VB. but i don't how to create DLL .
Please help me.
if anyone knows, send me source code for that.
waithing for +ve reply
Regards,
Riya jain
|
|
|
|
|
Usually you can not convert exe to DLL,
but it is usually fast to create new COM DLL envelope
using (your language VB or C++) application wizard,
- create there new interface with same methods and transfer code to it.
It is suitable for all.
- or if your more experienced,
when created new DLL - transfer just COM to it, if you know how to it for VB.
- or - ugly solution -create new DLL that makes simple one COM method,
that return interface pointer IDispatch*
with it create your EXE COM and return interface - each time you call this method for DLL,
exe COM will be created and returned - and will use as if it is placed in DLL.
This method is good when you already created complexsolution and do not whant rewrite
COM interfaces and transfer code - but use tested EXE unit as fast as possible.
|
|
|
|
|
Hi,
I am also new to COM and I manage to create my 1st DLL from this article.
http://www.codeproject.com/atl/SimpleATLCom.asp
Hope it is useful to you.
Regards
w_logan
|
|
|
|
|
Hi,
I developed application for handling incoming call using Tapi 3.0 (COM base)
now i want to convert that application in to DLL. but i don't know how to
create COM DLL. because in that application i used COM interface.
I will use that DLL in VB. but i don't how to create DLL .
Please help me.
if anyone knows, send me source code for that.
waithing for +ve reply
Regards,
Riya jain
|
|
|
|
|
I am using a .NET library from VB6 using COM interop. Functions / subs etc. can be called from the VB6 code and work as expected. However, I want to get VB6 to handle events generated in the VB.NET code. When I declare the library as "withevents", I get this error:
Runtime Error 459
Object or class does not support the set of events
The code is below, sorry if it is not that clear - the issue is the first few declarations etc. - the sink interface does not seem to connect to the class!!!
Imports System.Runtime.InteropServices
Imports CommsModulePC
', GuidAttribute("{ECB60CBD-42D7-4a93-9DB7-E6F4F0FEE3BA}")> _
'Public Event CommandReceived(ByVal theCommand As DeskCommands, ByVal args As String)
Public Delegate Sub CommandReceivedDelegate(ByVal theCommand As DeskCommands, ByVal args As String)
' Step 1: Defines an event sink interface (ButtonEvents) to be
' implemented by the COM sink.
<guidattribute("1a585c4d-3371-48dc-af8a-affecc1b0967"), _
interfacetypeattribute(cominterfacetype.interfaceisidispatch)=""> _
Public Interface CommandEvents
Sub CommandReceivedDelegate(ByVal theCommand As DeskCommands, ByVal args As String)
End Interface
' Step 2: Connects the event sink interface to a class
' by passing the namespace and event sink interface
' ("EventSource.ButtonEvents, EventSrc").
'ClassInterface(ClassInterfaceType.AutoDual),
'<comsourceinterfaces("hwmoduleplugin.commandevents, hwmoduleplugin")=""> _
<comsourceinterfaces(gettype(commandevents))> _
Public Class PluginOwner
Public Event CommandReceived As CommandReceivedDelegate
Dim WithEvents theCommsOwner As CommsOwner
Public Function Startup(ByVal theIP As String, ByVal thePort As Int16)
theCommsOwner = New CommsOwner(theIP, thePort)
theCommsOwner.Startup()
End Function
Public Property target() As String
Get
Return theCommsOwner.ToEndPoint.Address.ToString
End Get
Set(ByVal Value As String)
theCommsOwner.ToEndPoint.Address.Parse(Value)
End Set
End Property
Public Sub Connect() 'note that CommsOwner just assumes it has connected! change handshake routine!
If Not theCommsOwner.GetConnectionStatus Then theCommsOwner.Connect()
End Sub
Public Sub DisConnect()
If theCommsOwner.GetConnectionStatus Then theCommsOwner.Disconnect()
End Sub
Public Sub Shutdown()
If theCommsOwner.GetConnectionStatus Then theCommsOwner.Disconnect()
theCommsOwner.Shutdown()
End Sub
Public Sub triggereventtest()
MsgBox("trigger called")
RaiseEvent CommandReceived(DeskCommands.nmCmdAxis, "test")
End Sub
Private Sub theCommsOwner_NewData1(ByVal type As CommsModulePC.MessageTypes, ByRef mBody As String) Handles theCommsOwner.NewData
'ListBox1.Items.Insert(0, "REC " & mBody)
Dim resultarraylist As ArrayList
resultarraylist = ParseTokens(mBody)
Dim todo As DoList
Select Case type
Case MessageTypes.COMMAND
For Each todo In resultarraylist
RaiseEvent CommandReceived(System.Enum.GetName(GetType(DeskCommands), todo.Ident), todo.args)
'ListBox1.Items.Insert(0, System.Enum.GetName(GetType(DeskCommands), todo.Ident) & ": " & todo.args)
Next
'send some commands on
Case MessageTypes.DATA
For Each todo In resultarraylist
'ListBox1.Items.Insert(0, System.Enum.GetName(GetType(KETOPDataOutputs), todo.Ident) & ": " & todo.args)
Next
'send some data on
Case Else
'ListBox1.Items.Insert(0, "Some other stuff has arrived")
End Select
End Sub
End Class
|
|
|
|
|
Hi
I have a program that loads some activex components. When I run it as an administrator, there is no problem but when I run it in limitted user accounts, the "ActiveX Component Can't Creat Object." error raises.
I tried to search group policy to solve this problem for the limitted user groups, but I couldn't find anything helpful.
Please help me with that...
Is it possible for a program run in a limitted user account, to load activex components?
Thanks in advance
|
|
|
|
|
Hi MohammadAmiry,
You need to register the activex control in restricted user mode(windows
would not allow you to do so). To register the activex control in restricted
user mode, pls. refer to the following article.
http://www.codeproject.com/w2k/regsvrex.asp[^]
OR if you have written the activex control for your program you can modify the
registration routine for that using "RegOverridePredefKey" API.
>>Is it possible for a program run in a limitted user account, to load activex components?
Offcourse it is possible.
Happy programming !
Cheers,
Vishal
|
|
|
|
|
Hi,
I have a C# windows application which is already running. I have another C++ application. I want to use the C++ application to send parameters or call functions in that running C# windows application. What should I do?
I am new in COM. I guess the C++ application uses something like getObject to get the running C# windows application object. Am I correct?
But how can I expose the COM interface in that running C# windows application, as it is not a componenet.
Thanks
|
|
|
|
|