Link to home
Start Free TrialLog in
Avatar of rng
rng

asked on

OLE Automation Server in VB6

Hi,

I want to create a Ole Automation Server( or called ActiveX now ? ) in VB6.0 .
I want to make my program as a Ole Automation Server, but it should also maintain the capability as a normal .exe program. So, the output should be a .EXE file.

Please give me ALL the processes to create a Ole Automation Server !! For example, when I create a new project, what project type I should choose ? Any other properies I have to change it ?
Please give me the complete coding including the server and client so that I can test it.

Thanx!


Raymond
Avatar of robbert
robbert

HOWTO: Create and Use a Minimal ActiveX Component in VB
http://support.microsoft.com/support/kb/articles/Q170/9/46.asp

There are some additional issues that we can discuss when you got this running.
Avatar of rng

ASKER

robbert:

According to the article, the first step is:

1. Start a new project in Visual Basic. Choose either ActiveX EXE or ActiveX DLL.

What is the difference between ActiveX EXE and ActiveX DLL ?
Also, "ActiveX EXE and/or ActiveX DLL" does equal to "OLE Automation Server" ? They do the same thing ?
Please help !


Raymond
The basic difference is that an ActiveX EXE runs in another process than the calling app; an ActiveX DLL runs in the same process.

Some effects:
+ ActiveX EXE throws error. Calling app doesn't receive the error.
While ActiveX DLL throws error; the calling app wouldn't receive it.

+ Calling app ends. Reference to the ActiveX DLL has gone, and the instance of the DLL *should* be destroyed, automatically.
On the other hand, an instance of the ActiveX EXE would still run when the calling app ends, as it runs in a seperate process.

You would choose an EXE.

Additional info:
ActiveX EXEs and DLLs
http://msdn.microsoft.com/library/default.asp?URL=/library/books/advnvb5/ch03_15.htm
What I wrote on errors isn't true.
Avatar of rng

ASKER

robbert:

According to the article, the first step is:

1. Start a new project in Visual Basic. Choose either ActiveX EXE or ActiveX DLL.

What is the difference between ActiveX EXE and ActiveX DLL ?
Also, "ActiveX EXE and/or ActiveX DLL" does equal to "OLE Automation Server" ? They do the same thing ?
Please help !


Raymond
Choosing a Project Type and Setting Project Properties
http://msdn.microsoft.com/library/devprods/vs6/vbasic/vbcon98/vbconsettingprojectoptions.htm

Choose an ActiveX EXE.
The following is what I would tell you if I was Microsoft:

Creating an ActiveX EXE Component
http://msdn.microsoft.com/library/default.asp?URL=/library/devprods/vs6/vbasic/vbcon98/vbconcreatingoleserver.htm
Avatar of rng

ASKER

robbert:

According to the article, the first step is:

1. Start a new project in Visual Basic. Choose either ActiveX EXE or ActiveX DLL.

What is the difference between ActiveX EXE and ActiveX DLL ?
Also, "ActiveX EXE and/or ActiveX DLL" does equal to "OLE Automation Server" ? They do the same thing ?
Please help !


Raymond
Avatar of rng

ASKER

robbert:

If I make my application as a ActiveX EXE, then does it maintain the capability as a NORMAL .EXE program ?


Raymond
Avatar of rng

ASKER

Actually, I am working on the Ole Automation in Nagivator now, however, I don't know how to implement the following in VB6 :

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
PROTOCOL.ODL

uuid(00000000-0000-0000-0000-000000000000), version(1.0) ]
library OleExampleProtocolHandler
 {
 //  For the Windows 16-bit version, the following line should be
 //  importlib("stdole.tlb");
 importlib("stdole32.tlb");

[ uuid(00000000-0000-0000-0000-000000000000) ]
dispinterface IExampleProtocolHandler1
{
        properties:

         methods:
                  [id(1)] short Initialize(BSTR pProtocol, BSTR pUrl);
                  [id(2)] void Open(BSTR pUrl);
};

[ uuid(00000000-0000-0000-0000-000000000000) ]
coclass ExampleProtocolHandler1
{
           [default] dispinterface IExampleProtocolHandler1;
};
};
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Do you know ???  Because I know very little about Ole Automation.
If I can implement the above thing in VB6, I think I can solve my problem !!
You can find more in:                    http://developer.netscape.com:80/docs/manuals/communicator/OLE/ole6obj.htm#protocolodl

Surely, If you can implement it, I will give you the points.
Thanx !!


Raymond
If you have gone through the step-by-step instructions on building an ActiveX EXE above, you're already at a point. - But I don't know where you currently are.

> If I make my application as a ActiveX EXE, then does it maintain the capability as a NORMAL .EXE program

No. Menu: Project, Properties. Tab: Component. - Start Mode: Standalone.

> Actually, I am working on the Ole Automation in Nagivator now, however, I don't know how to implement
the following in VB6

That's not developing an ActiveX app, it's calling one. - What's your goal with this question in non-technical terms?
Avatar of rng

ASKER

Robbert:

Actually, I want to implement a External Protocol Handler for Netscape Navigator. You can find more information here:
http://developer.netscape.com/docs/manuals/communicator/OLE/ole5pro.htm

As you can see in the above link, the External Protocol Handler should have these methods:

short Initialize(LPCTSTR pProtocol, LPCTSTR pUrl);
void Open(LPCTSTR pUrl);

However, I don't know how to do it in VB6.
Can you help me ??
Thanx!


Raymond
That's still technical terms. First, you wanted to build an ActiveX Server, now you want to implement a specific interface that was for NN v1.1. I can't follow you that way - loose focus and say what you really want - in non-technical terms.
Besides, I currently can't install NN.
Avatar of rng

ASKER

In non-technical terms, I want to make a program that can catch all mouse-clicks for downloading files from all the running instance of Netscape Navigator.


Raymond
With that, I can't help you at all.

Some notes, though:
+ Everything which you can program via OLE automation/COM/ActiveX, you'll find in VB under Project | References.

+ I never found NN there, and NN never made whole-heartedly efforts to be programmable. Well, the OLE thing you found, but it doesn't seem to have being extended. Then, there was an interface called DDE which was better evolved.

+ Capturing mouse-clicks, however, is advanced over just treating an instance of NN as object, and i.e., making it navigate to an URL. With IE, it's tricky but should work - if you created that instance, yourself.

+ Accessing programs, or windows, that you didn't create, again, is another pair of shoes. You can get the window handle (FindWindow() API I believe) and by that, some window properties, as the title. You can also terminate it. But beyond, it's getting very hard.

+ And it's not that window, you're interested in but an object it contains.

+ I don't believe that it's possible without rocket-science. If you want to leave this question open, you should edit your original question, and add the non-technical goal. ;-) Sorry.
Avatar of rng

ASKER

Robbert:

I want to delete this question now, but I want to give you 100 points.
How can I proceed ?


Raymond
ASKER CERTIFIED SOLUTION
Avatar of robbert
robbert

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rng

ASKER

Delete this question please !!
Avatar of rng

ASKER

Delete it please !!!
Points reduced from 200 to 100. Go ahead and accept robbert's comment as answer.

amp
Community Support Moderator
Experts Exchange
Avatar of rng

ASKER

Thanx Robbert.