Solved

API Question (Advice)

Posted on 2002-03-22
3
149 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
Comment Utility
If you use API you do not have to worry about distributing the ocx.
0
 
LVL 5

Expert Comment

by:RainUK
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

771 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

8 Experts available now in Live!

Get 1:1 Help Now