Solved

API Question (Advice)

Posted on 2002-03-22
3
154 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

742 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