|
i m using PWS on win98. i have made a COM object and then i used it in my ASP page. But when i used my COM object in ASP after that i can't build same COM object again without restarting my machine.it gives linkin error "Can't open .dll to change". Any one can help me so that i dont have to restart my machine.
and second question is how can i return multiple values by reference from COM object to ASP page when i use it in ASP.
any one has any idea?????
|
|
|
|
|
I have a vague memory that this does not work on Win98 but on other platforms it does:
1) Configure your ASP App as "Isolated Process" in the IIS settings.
2) Stop the Web Server
3) "Unload" the application in the IIS Application Properties
4) Compile
5) Start Web Server
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
|
Excellent post Mike!
psacake.com .... Great domain name
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Guyz,
I remember working with C++ COM, I could use QueryInterface to find whether an interface is supported in a component. Is there a similar mechanism in VB too? If not what would be a best way to do.
\Thnx!
|
|
|
|
|
LOL,
This comes along with a question of mine that probably can answer your question
If i'm not crazy, it should be possible to query for interfaces using CType(), and my question is related to CType.
Say i have a COM object with multiple inherited interfaces like:
interface IFoo : IDispach
{
.. blah ...
}
interface IOtherFoo : IFoo
{
.. blah ...
}
Now, in some way i have a method somewhere that returns an IFoo object:
[id(4), propget] Foo([out, retval] IFoo ** rvIFoo);
now, in VB i do Set MyObj = someobject.Foo . Then later i do Set MyObj2 = CType(MyObj, IOtherFoo) . Will MyObj2 be the IOtherFoo interface of the same instance as MyObj ?
PS: From searches i've done, CType() seems to be only valid in VB.NET.
Is there an equivalent to CType() in VB 6.0 ?
|
|
|
|
|
hi
QueryInterface is available in VB.
Consider the CoClass below with two interfaces
coclass Calc<br />
{<br />
[default] interface Scientific;<br />
interface General;<br />
};
Now in Vb
Dim objScientific as new Calc.Scientific<br />
Dim objGeneral as Calc.General<br />
<br />
set objGeneral = objScientific
Here the line set objGeneral = objScientific will Queryinterface objScientific for objGeneral and objGeneral will get a valid pointer if it is available in the CoClass.
Rgds...mil10
|
|
|
|
|
Whoah .. thx a lot for the information
But if i may, let me be more specific.
1) From your sample, what if i do:
Dim objGeneral as new Calc.General<br />
Dim objScientific as Calc.Scientific<br />
<br />
Set objScientific = objGeneral
Would it still be working ?
2) What if i dont have a CoClass for my object, but only an interface:
interface IScientific : IGeneral<br />
{<br />
... blah ...<br />
}<br />
<br />
interface ICalc : IDispatch<br />
{<br />
[id(1),propget] STDMETHOD(General)([out,retval] IGeneral **rvGeneral);<br />
}<br />
<br />
coclass Calc<br />
{<br />
[default] interface ICalc;<br />
}
,
now in my Calc coclass, i instantiate an IScientific object and i return an IGeneral pointer, which, if i understand well, return a shorter vTable. Then i run the Vb code in section 1. Will Vb do a QueryInterface on objGeneral to get an objScientific interface pointer ?
I guess i should explain what i want to do more specificly.
I would like to have 2 layers of information on a specific object, but i dont want someone getting access to an objGeneral to be able to cast it and make an objScientific with it. (hoping i am clear here).
Maybe what i need to use containment or aggregation.
I want simple users to be able to view certain object properties, while allowing admins to view more properties and have access to Modify() and Create() types of functions.
|
|
|
|
|
hi man..
1. Would it still be working ?
yes of course it will work.
if a coclass say x
coclass x<br />
{<br />
[default] interface interface1;<br />
interface interface2;<br />
}
contains more than one interface then through VB we can directly say "new" only to the default interface. then thru that interface we can queryinterface the remaining interfaces in that coclass. Also in a coclass there shud be only one IDispatch implimented interface. if there is more than one interface having IDispatch as base , then u shud use COM_INTERFACE_ENTRY2(IDispatch,IURInterface) macro to specify the default interface and the other interface can't be invoked thru dispid - i mean thru idispath->invoke.
2) What if i dont have a CoClass for my object, but only an interface:
interface IScientific : IGeneral
{
... blah ...
}
You can not have a com interface without a coclass. It is the basic COM rule.
Then about ur requirement, if i understud u in the right way,
It is not possible to make such a role based security over com interfaces. Once a client got an inteface, he can access all the remaining interfaces in that coclass. Otherwise if ur ok to go for com+ then u can set role based security.
An adjustment that we can do (not a concrete solution for the prblm) is use the hidden tag in IDL. Then vb's like com object browsers can not display it. so the user will not come to know abt such an interface. but if he take the IDL of the dll, then everything will be visible.
hope this will help.
rgds..mil10
|
|
|
|
|
Regarding the option of not having a coclass, i have to disagree with you.
You are right that i need a coclass to start with. Any com server will require at least 1 coclass. But the way i understand it the purpose of coclass is to allow instantiation of an object.
in my examples up there, with vb i could do 'Set myobj = new interface1' or 'Set myobj = new interface2'. But it would not be possible to do 'Set mycalc = new IScientific'
But, this doesnt prevent from having a method in interface1 that returns a reference to an IGeneral or IScientific instance.
Am i making sense ?
DarkByte
|
|
|
|
|
hi
I am sticking with my previous post.
Ur understanding of a coclass is correct. It is to allow instantiation of an object. But u can acces an interface only after instantiating an object. So without a coclass there is no existance for an interfce. An interface is below the coclass in the hierarchy. It is just like a member function comes under its class. Without a class there is no existance/meaning in a member function right?
hope this will make things more clear..
await ur opinion.
rgds..mil10
|
|
|
|
|
Yup, i think we both understand the same thing regarding coclass uses.
What i'm still not 100% convinced (althought i could do some test and make myself a possibly false opinion) is regarding QueryInterface and/or its use in VB.
Now, with your example for IGeneral and IScientific, if i understand correctly, it doesnt matter how we acquired and interface pointer, if the instance behind the pointer exposes more than 1 interface, it becomes possible to reference that instance under any of its exposed interfaces. Meaning that if i get an IGeneral interface pointer to an IScientific instance, its always possible from code to access its IScientific interface by using QueryInterface(), or using the method shown earlier in VB.
BTW: It's a pleasure talking with someone that has knowledge. I hope i can be of service some day.
DarkByte
|
|
|
|
|
Ok man, So the remaining doubt is regarding the queryinterface in vb. Just give me ur email id i will send you a sample with an ATL com and a vb client which queryinterfaces for remaining Interfaces in the CoClass. It will clear all ur doubts.
Yes. It doesn't matter how we aquired the interface pointer, it is possible to Queryintface for the remaining Interfaces in the same coclass. That is the way com impliment an interface. Did you forget the fact that, all com interface should be derived from IUnknown and IUnknown contains the QuryInterface() method to get the remaining interfaces of the same object.
Thanks for the compliments, it was nice to talk with you.
rgds..mil10
|
|
|
|
|
I have multiple instances of an application running, each using a different .ini file with a different caption. Each is connected to a different database. I need to connect to a specific instance from VBScript.
Using GetObject(, "MyProg.Document") I can connect to a running version - but can I connect to the Train version when one is Prodn and the other Train?
Using VC++ 6.0 and MFC
Sara
|
|
|
|
|
Hi Sara,
I've been trying to find a way to overcome your kind of problem but cannot think of any solutions. Wish someone can help you.
DarkByte.
|
|
|
|
|
I've been thinking again about your problem and i might have some pointers that could lead you to a solution, i'm not assuming my solution is right but could help get the right solution.
Instead of using GetObject(, "MyProg.Document") which will take the first (or last) active instance. Create a new CoClass that can return either an "MyProg.ProdDocument" or "MyProg.TrainDocument" .. then from any of these, get the pointer to the Document.
When you start the application as Prod, have it RegisterActiveObject(<classid of="" proddocument=""> ... etc) and if you start it as Train, have it RegisterActiveObject(<classid of="" traindocument=""> ... etc)
Then, have both ProdDocument and TrainDocument interfaces containing a method getter for the Active document that would be returned if you used "MyProg.Document"
Well, not sure if this is Clear .. but i hope it helps.
[edit]That is assuming that you have access to source, or at least can get source modified for "MyProg"[/edit]
|
|
|
|
|
Hello Friends !
I am developing a COM component which reads a structured storage file,which consists of no of sub-storages,
I want is to open the structured storage and get a count of
sub-storages in it.also i want to get the name of the first sub-storage...
Any one would please suggest how do i achieve this !
Thanks In Advance
|
|
|
|
|
From what i recall, the only way to do so is to actually open and parse the sub storage. But i might be wrong.
|
|
|
|
|
I have two programs that can be ran independently. However, when program A is running, it is possible to execute program B using COLEDispatchDriver. This causes the child program to load a particular CDocument object. I want the child program to inform the parent program whenever a new CDocuemnt object is created. Can IOleObject::Advise be used for this? It looks like the parent program would only be able to retrieve an IOleObject pointer for CDocument objects that already exist.
|
|
|
|
|
I am trying to make a plugin for windows media encoder using DMO. can any one tell me h0w to register it so that encoder recognize the plugin and what input and output type should i set. purpose of the plugin is editing like water mark.
Asim Saleh
Asim Saleh
|
|
|
|
|
What may be wrong when I got the dialogbox: “Type mismatch” when I try to run my Outlook 2000 Add-in at startup of Outlook.
Thanks
_____________________________
...and justice for all
APe
|
|
|
|
|
I’m about to create some kind of connection between one of my Applications to Outlook, to make the user of my app to use “stuff” in Outlook.
I think I’ve figured out that creating a add-in would bee one solution or… ?
I’m a C++ programmer and almost never programmed VB. Do I really have to learn it. (VB to me sounds so simple and boring…)
Anyway, if creating an add-in is the best solution – where do I start. I can’t really find any articles good for me.
All tips are welcomed – Thanks
_____________________________
...and justice for all
APe
|
|
|
|
|
Outlook supports automation (as most applications in the Office suite), if I'm not mistaken. Google for Office and OLE automation, and I bet you'll find a bunch of articles and howtos. You'll probably find stuff from CP
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
Hi all,
Currently I'm writing two plugins for Windows Media Player.
One plugin is DSP processor and the other - Visualisation.
I need my plugins can communicate with each other though COM interfaces.
So I create my own moniker class to register one of the objects in ROT.
When my DSP pluging object is constructed I create moniker in the FinalConstruct (constructor) and register my object in ROT with ROTFLAGS_REGISTRATIONKEEPSALIVE flag.
Later when my vis plugin needs to communicate with DSP plugin it also create moniker and binds it to DSP plugin - all works ok.
But I cannot understand WHY when Win MediaPlayer releases my DSP plugin the plugin is destructed ? I mean that ROT also releases the pointer to my DSP plugin.
Actually that is what I really need, but from docs I would expect different behavior - I suppose that ROT holds "strong" (I wonder where the explanation this term) reference to my DSP plugin so it will remain in memory until Revoke ?
Also when I remove ROTFLAGS_REGISTRATIONKEEPSALIVE flag in IRunningObjectTable::Register method call my moniker cannot bind to object.
Short description on the object which being registered in ROT:
HRESULT DSPPlug::FinalContruct()
{
CComPtr<IMoniker> p = CreateMoniker();
...
CComPtr<IRunningObjectTable> pIROT;
::GetRunningObjectTable(NULL,&pIROT);
...
pIROT->Register(ROTFLAGS_REGISTRATIONKEEPSALIVE,this,p,&this->ROTRegValue);
}
void DSPPlug::FinalRelease()
{
CComPtr<IRunningObjectTable> pIROT;
::GetRunningObjectTable(NULL,&pIROT);
...
pIROT->Revoke(this->ROTRegValue);
}
Can someone help with explanation of those ?
Best regards,
Valery
|
|
|
|
|
I am as clueless as you about your problem. Would RegisterActiveObject() work for you?
I don't think revoking the ROT entry to yourself i FinalRelease() is a good idea. There's a cyclic reference there. The ROT has a reference to you, and you have a reference to it. Surely, there must be a better time to release yourself...?
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|