|
Does anybody know about where the DLL is loaded when the DLL is registered on both the server and client computers (two separate computers), but client instantiatews this DLL remotely.
1.Is the DLL loaded in the client process becuase it is inprocess so it must load in the client. or
2.DLL is loaded in the server's memory space whereby a surrogate is used on the server side and whole communication is through proxy and stub.
Regards
Muhammad Nauman Khan
|
|
|
|
|
Hi All,
I need to create a COM Object in VC++ that should return some value.Taking up a simple example,suppose the COM component is created to add 2 numbers using ATL, then the implementation of methods in C++ files would look something like this.
// Util.cpp : Implementation of CUtil
#include "stdafx.h"
#include "Object.h"
#include "Util.h"
/////////////////////////////////////////////////////////////////////////////
// CUtil
STDMETHODIMP CUtil::Addnum(int x,int y, int *z)
{
// TODO: Add your implementation code here
*z = x + y;
return S_OK;
}
Now I need to use this COM Object in an ASP code, for which the code I've written is as follows:-
===========================================================================
ASP Code
<%
Dim objTest
Set objTest = CreateObject ("Object.Util")
Dim lngReturnValue
objTest.Addnum 10, 91, lngReturnValue
Response.Write "Random number from Scriptlet = " & lngReturnValue
%>
But this code isn't working.Is this code correct or is there some other way to implement the requirements.
Do I have to adopt some other way to create COM component or
Some other way to use the component in ASP.
(Note: The same code works perfect in VB but not in ASP)
Can Anybody Help Me.
Abhishek.
Learning is a never ending process of Life.
|
|
|
|
|
I do not know ASP, so I cannot help you with the current way that you are trying to do it. However if you change your definition in the IDL file that describes your interface for that function, and declare one of the options for your z value as retval as well as out like this:
HRESULT Addnum([in] int x, [in] int y, [out, retval] int *z);
It will make the z value a return value in langauges like VB, scripting languages and probably ASP. so instead of this:
objTest.Addnum x, y, IngReturnValue
you could write:
IngReturnValue = objText.Addnum(x,y)
I hope this helps,
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thanks Kilowatt,
You have solved my problem.The method is working now.
Thanks Once again,
Abhishek.
Learning is a never ending process of Life.
|
|
|
|
|
Hello, first of all, it would be of interest to know whether your COM component gets instantiated or not.
Here are reasons why you have problems :
- you should use Server.CreateObject(progid) instead of CreateObject(progid)
- the fact that you use ATL is not enough a way to ensure that your COM component can be used by VBScript. In other words, you must make sure that the default interface exposed is either a dispinterface with adequate DISPIDs facing each property and each method, or derives from IDispatch, also with DISPIDs.
You have prebuilt samples in the Devstudio CD-ROM, and probably in this site too.
- your COM component is not properly registered
- your server has default security launch permissions that prevents to launch COM components. Whether your COM component is a DLL or an EXE varies a lot in behaviours. You must use DCOMCNFG.EXE to handle that.
Good luck!
|
|
|
|
|
I have been reading articles on using COM+ in .NET, however most of them discourage its use for new applications. What is the recommended alternative(s)? I am building a client/server app and was going to make the Server a COM+ object and access it through .NET Remoting. Should I be using a Windows Service or something else. I would prefer to stay away from webservices due to the sensitive nature of the application. Thnaks.
Steve
Not all who wander are lost...
|
|
|
|
|
First of all, you probably don't need COM+ if you don't need absolute reliability or object pooling.
The MS documentation is a total fake about COM+. That's not a framework with drag&drop and voila! That's a predefined set of interfaces that YOU must implement without any help at all, that may provide, if you're lucky enough, some form of transaction, reliability, object pooling.
Be sure to understand that what COM+ gives you is the theory behind it. You may have spent a couple weeks inventing the wheel. With explained interfaces you just have to figure out the code for the interfaces.
And that's where the trick lies, because from a standard component, you'll get object pooling not only by implementing the adequate COM+ interfaces, but by making your current implementation stateless and so on, which in fact requires a total code reengineering.
Besides that, COM+ is very hard to handle. No matter how many articles you have in MSDN library, MSDN mag, and so on, I am not sure any one achieved an implementation in the real world.
AFAIK, I would either :
- stick with standard COM, and add a small proprietary layer for storing state and so on
- make my company buy a real COM+ framework implementation to play with. Don't know if that exists (equivalent of Iona's Corba for COM+).
|
|
|
|
|
Thanks for the reply. If you were me, what would you do? I am using .NET and have been told not to use COM+ but don't know what else todo. Thanks.
Steve
Not all who wander are lost...
|
|
|
|
|
I would indeed suggest .Net and especially System.Remoting
Many sites have working implementations beyond the ones found in .Net framework doc :
- mastercsharp.com
- dotnet247.com
- dotnetjunkies
- ...
Good luck!
Let's swallow a small raisin.
|
|
|
|
|
I'm currently developing a plugin for MS Outlook and when I try to access a contact's information, this pops-up in Outlook:
"A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this? Blablabla"
Is there a way to tell Outlook to calm down, that my plugin is not a threath? I can't see a user coping with this many times a day!!!
---------------
http://www.edovia.com
|
|
|
|
|
|
You are entering the dark and murky waters of Outlook development. I know them well.
You have some options, but for you the best choice would be to get Outlook Redemption from http://www.dimastr.com. Dmitri has done a lot of work with this, essentially providing a COM wrapper to the low-level MAPI functions that allow you to bypass the warning.
There are some lingering issues, mostly related to the fact that, no matter what you do, there are restrictions imposed by Outlook as to just how far you can get with any add-in.
You should also join the Outlook-Dev Yahoo Group (http://groups.yahoo.com/group/outlook-dev). There you'll find many Outlook developers in the same boat, and plenty of sympathy (if not actual assistance).
|
|
|
|
|
Hi,
i'm not an expert Windows programmer, so please be kind
to me if i ask a stupid question
What happend with COM/OLE in .NET?
I always found the OLE stuff the most valuable difference
between Windows and *nix. I liked the feature to include
e.g. a Visio drawing in a Word document.
So i ask myself: does this still work in .NET?
Is there a new component model? new API's?
Any hints are welcome!
Bye,
Jürgen
|
|
|
|
|
COM is about component based programming. So is DotNet entirely.
- A com factory is now an assembly
- IUnknown is now Object
- QueryInterface is now (simple casting)
- CoCreateInstance is now instantiation of objects who have been referenced at design-time (assembly reference for instance).
- the interface remains the interface :
public interface IDocHandler
{
...
}
- interop mechanisms in DotNet allow to continue to use CLSIDs, though it is now recommended to drop them.
- in optional attributes [...], brackets before class and method declarations, you'll find Marshall stuff, parameters types, and so on.
|
|
|
|
|
Hi Stephane,
i'm more interested in what happend to the
"visual editing" and things like that (e.g.
the menu bar changes when you activate a Visio
object in a Word document).
From your posting, it understand that the whole
component architecture switched from COM to
the CLR, but what happend to the copy/paste and
object containment stuff?
Bye,
Jürgen
|
|
|
|
|
There is no more real COM on native CLR apps.
Using System.Interop services, you have access to some form of lower plummering, even though most of it is totally hidden to the .Net developer. Simple COM structures such like CLSIDs and so on don't even exist, you'll have to recreate them from scratch, and then use interop marshalling (which is easy btw).
This article is an interesting implementation of some interop.
As for Visio menus, OLE, and so on, I am afraid all developers that have such needs will have to stick to mere VC++.
And I swallow a small raisin.
|
|
|
|
|
I often use the IObjectContext in my COM+ components for gaining access to the transaction context. This way, I can access, e.g., ASP's Response, Application and Session objects.
But, although IObjectContext has an Item and a Count methods, it misses an Add method.
Well, if IIS can do it, I can do it too, right ?
So, how can I add a simple string to the transaction context ? Is there a way of doing this ?
What I'm trying to achieve here is passing information between the most external layer of my application to the most internal without having to add an extra parameter to every single method in my interfaces.
Concussus surgo.
When struck I rise.
|
|
|
|
|
I dont know what could happen with my computer, I can not compile COM related projects.
I removed visual studio, deleted all the files from 'program files\microsoft visual studio', installed visual c++. But it happens the same thing.
Has somebody met this error or similar behavior before?
<br />
Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\oaidl.idl<br />
oaidl.idl<br />
Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\objidl.idl<br />
objidl.idl<br />
Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\unknwn.idl<br />
unknwn.idl<br />
Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\wtypes.idl<br />
wtypes.idl<br />
Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\ocidl.idl<br />
ocidl.idl<br />
Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\oleidl.idl<br />
oleidl.idl<br />
Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\servprov.idl<br />
servprov.idl<br />
Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\urlmon.idl<br />
urlmon.idl<br />
Processing C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\msxml.idl<br />
msxml.idl<br />
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\ocidl.idl(847) : error MIDL2025 : syntax error : expecting a type specification near "CY"<br />
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\ocidl.idl(848) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation <br />
Error executing midl.exe.
|
|
|
|
|
The 'cause' of the problem was that I switched the regional settings to another than US English.
I use win2k sp3, vs6.
|
|
|
|
|
Hello,
I have a web server (a service) that acts as a proxy to translate web pages from English to Swedish.
In order for this to work, I need to set the appropriate values of proxy server and port and activate "Use a proxy server" in IE->Internet Options->Connections->LAN Settings->Advanced.
Now, activating and deactivating frequently will become a pain in the ass jumping to the options dialog all the time, so I figured I could create an IE toolbar button that would do this programmatically.
This turned out to be more complicated than I thought... I can change the options programmatically (at IE runtime) but the changes don't seem to be reflected appropriately. I was trying to simulate the [de]activation behaviour of IE when doing it manually, but something seems to be missing.
Manually my proxy kicks in just fine, but not programmtically... all options are set and visually it all looks fine.
Has somebody dealt with this or does anyone know how to do this?
ANy pointers to material on this would be appreciated,
TIA,
/Tommy
|
|
|
|
|
I like the approach being used in Proxomitron (a popup/midi/ad remover). It is not intrusive, because you point your browser to it and Proxomitron allows you to redirect it to another proxy. This way, in Proxomitron you have a "ByPass" checkbox that disables its use, but still mantains the user's original proxy working.
Check it out, it may be simpler than what you're doing.
Concussus surgo.
When struck I rise.
|
|
|
|
|
Here's the answer... FINALLY!!!
http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/wininet/tutorials/options.asp
And now it all works! Thx to all who have helped out!
/Tommy
|
|
|
|
|
I have met a problem of passing a String from my ActiveX to a javascript. I have the following interface:
testFunction([in,out]BSTR* p1, [out,retval]VARIANT* p2)
and my javascript:
var p1 = "ABCDEFGH";
var p2 = "PPPPPPPP";
p2 = testFunction(p1);
alert(p1);
alert(p2);
I can get the value of p2 successfully, however, p1 cannot. How can I pass value of string by reference from my ActiveX to my javascript? Thanks.
|
|
|
|
|
Data are passed by value and not by reference. I was also looking for a way to pass data by reference to a script and so far, I was unsuccessful. But if you have more info, let me know!
VOTD:"5. The Lord loves righteousness and justice;
the Earth is full of his unfailing love. "-Psalm 33:5
|
|
|
|
|
I know Javascript can only use Object or Array to pass by reference between ActiveX and Javascript. However, I am looking for ways that use Javascript String Object to pass the parameter by reference. Do you have any ideas?? Thanks.
|
|
|
|
|