how to include c header file in vb

Posted on 2001-06-12
Last Modified: 2013-11-18
How to include c header file in vb. normally in c written as follows:
#include "vbconst.h"

is there any way to write the above include statement in vb module.
Question by:azsoft
  • 2
  • 2
  • 2

Expert Comment

ID: 6180363
You cant do what youre asking for for two reasons:

1) There is no "include" capability in VB. you would have to cut and paste the text into the VB form.

2) The syntax of C header files is totally different to the syntax of VB, so even if you cut and paste the whole header file, it will cause compilation errors in VB. You need to edit the header file to turn it into VB syntax.

If you want to include common declarations in your VB program (API functions & constants) then I reccomend you get yourself a copy of the VB Type Library. To use this you include it as a Reference in the project, then all the declarations are available to you in your program.

you can get the VB Type Library from :

unfortunately you will still find there are some declarations not in this (though not that many). You will have to do these "by hand" still. But at least the majority are done for you.

Hope this helps.

LVL 15

Accepted Solution

ameba earned 50 total points
ID: 6180447
You can write this statement:
#Const include = "vbconst.h"
but it won't include a file. :-)
To include a file, press Ctrl+D, or use menu Project, Add Module, or drag file from Windows Explorer to VB Project Explorer.
LVL 38

Expert Comment

ID: 6181615
>How to include c header file in vb

If it is a c header, it will be meaningless in VB unless you rewrite it in VB syntax.
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

LVL 38

Expert Comment

ID: 6181625
But that has already been said (and I haven't had coffee yet this morning.  *yawn* scritch scritch.)
LVL 15

Expert Comment

ID: 6182094
Yes, that will teach me to choose where to put my comments.

Expert Comment

ID: 6182221
grief !

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Form submit issue 11 85
VB6 ListBox Question 4 42
Send outlook email from VBS Script 2 29
which modules are active in VB6 project? 6 10
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

776 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