Solved

API Question (Advice)

Posted on 2002-03-22
3
155 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

724 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