Solved

OLE Automation Server in VB6

Posted on 2001-06-03
21
636 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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 100 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now