Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

OLE Automation Server in VB6

Posted on 2001-06-03
21
Medium Priority
?
680 Views
Last Modified: 2013-11-25
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
0
Comment
Question by:rng
  • 11
  • 9
21 Comments
 
LVL 15

Expert Comment

by:robbert
ID: 6150571
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.
0
 

Author Comment

by:rng
ID: 6150610
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
0
 
LVL 15

Expert Comment

by:robbert
ID: 6150631
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
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 15

Expert Comment

by:robbert
ID: 6150633
What I wrote on errors isn't true.
0
 

Author Comment

by:rng
ID: 6150636
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
0
 
LVL 15

Expert Comment

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

Choose an ActiveX EXE.
0
 
LVL 15

Expert Comment

by:robbert
ID: 6150649
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
0
 

Author Comment

by:rng
ID: 6150655
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
0
 

Author Comment

by:rng
ID: 6150656
robbert:

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


Raymond
0
 

Author Comment

by:rng
ID: 6151670
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
0
 
LVL 15

Expert Comment

by:robbert
ID: 6152261
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?
0
 

Author Comment

by:rng
ID: 6152544
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
0
 
LVL 15

Expert Comment

by:robbert
ID: 6152870
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.
0
 

Author Comment

by:rng
ID: 6152992
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
0
 
LVL 15

Expert Comment

by:robbert
ID: 6153301
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.
0
 

Author Comment

by:rng
ID: 6153381
Robbert:

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


Raymond
0
 
LVL 15

Accepted Solution

by:
robbert earned 400 total points
ID: 6153725
You can post a "Points for robbert" question in the VB TA, mentioning this question's number or URL.
Deleting this Q doesn't mean that your points are refunded, immediately - so, you can ask the Community Support to do so.
0
 

Author Comment

by:rng
ID: 6155018
Delete this question please !!
0
 

Author Comment

by:rng
ID: 6155019
Delete it please !!!
0
 

Expert Comment

by:amp072397
ID: 6155088
Points reduced from 200 to 100. Go ahead and accept robbert's comment as answer.

amp
Community Support Moderator
Experts Exchange
0
 

Author Comment

by:rng
ID: 6155168
Thanx Robbert.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question