Solved

API Question (Advice)

Posted on 2002-03-22
3
152 Views
Last Modified: 2010-05-02
Hello,

Is it best to use Windows APIs instead of OCX controls? I understatnd that controls use more resources and referencing them can be a headache. But, I also understatnd that APIs are a bit harder to code. If I used API would I be better off then using ocx controls.

ADawn

0
Comment
Question by:ADawn
3 Comments
 
LVL 28

Expert Comment

by:vinnyd79
ID: 6888724
If you use API you do not have to worry about distributing the ocx.
0
 
LVL 5

Expert Comment

by:RainUK
ID: 6889030
It depends on what sort of functionality you want to achieve. Using APIs will allow you more customised control as you are coding it, but if you are buying 3rd party OCXs then it is limited to what interfaces they have provided you.
0
 
LVL 18

Accepted Solution

by:
mdougan earned 10 total points
ID: 6900124
APIs can be more complicated to code, but since you have most of the Windows API available to you, plus APIs for other things like the Windows Internet API (WININET.DLL) it really opens up a lot of functionality for you.  Also, generally, you will get much faster performance from the API calls.

However, since most APIs are written in a language like C or C++ it can be difficult to figure out what to do if the function requires you to pass a Pointer to a String, or receive a parameter that is a Pointer to a string or a structure in memory.  Thankfully, there are lots of good samples on the net for calling most of the APIs through VB.

OCXs are good, if you find a commercial one that really suites your needs.  I use them for my grid control and for elastic sizing controls and print preview controls, because the API calls to do those things would be pretty difficult to manage.

Also, you can make your own OCXs if you find that you have a similar component to many of your forms, so, rather than copying several items from one form to another, maybe you can group them together into a component that you make into an OCX and then you can simply put one of these on your forms and then only have to maintain the code in one spot....
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MsgBox 2 57
passing a value with stream reader AFTER a ";" 3 68
Help with retrieving partial value from a column using VB.NET 4 48
Automatic Email Reminder 4 38
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

822 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