Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

API Question (Advice)

Posted on 2002-03-22
3
Medium Priority
?
157 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 40 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…
Suggested Courses

636 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