Important alert: (current site time 7/16/2013 3:22:58 AM EDT)
 

winzip icon

C2VB

Email
Submitted on: 11/2/2000 5:07:00 PM
By: Kimon Andreou 
Level: Intermediate
User Rating: By 38 Users
Compatibility: VB 5.0, VB 6.0
Views: 35639
 
     C2VB parses through C style declarations of functions, structures etc and creates the VB equivalent. I decided to create this little program to make my life easier when working with APIs. Instead of having to "translate" an API declaration from the Platform SDK help file, I wanted a way to do that automatically. This is the result. All you have to do, is copy paste the declaration from the help file. Apart from being a handy app. it demonstrates how to parse instructions, how to implement a rudimentary splitter and above all, it explains what do all those wierd things mean in C! It can process either user inputted instructions or it can read from a file. Optionally, a filename can be passed on the command line. If you have any comments or disagree with the way I converted the datatypes, let me know.

 

Windows API/Global Declarations:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'**************************************
'Windows API/Global Declarations for :C2VB
'**************************************
(none)
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

11/2/2000 8:03:48 PMAnonymous

Now all you need to do is make it convert .cpp files...
(If this comment was disrespectful, please report it.)

 
11/4/2000 12:12:10 AMJeff Cockayne

What an unbelieveably useful app! Thanks!!!!! I'm reasonably good at reading C, but what a time saver...
(If this comment was disrespectful, please report it.)

 
11/4/2000 9:42:03 AMDan Messenger

this code is the tops, i know nothing in C, so i also have problems - especially when looking through MSDN. Thanks!
(If this comment was disrespectful, please report it.)

 
11/4/2000 11:16:51 AMBenjo Bartolome

I really needed this!!!!!!!!

Thank you VERYYYYYY MUCCCHHHHHHHH!!!!!!1
(If this comment was disrespectful, please report it.)

 
11/18/2000 11:54:10 AMkle

Cool Code.
(If this comment was disrespectful, please report it.)

 
12/4/2000 5:32:20 PMDaniel Vandersluis

Of course, you could just use the API reference app included with VB, but...
Just Kidding! It's a great idea and a great app!
(If this comment was disrespectful, please report it.)

 
12/6/2000 10:43:06 AMCossak

Nice1 :-)
(If this comment was disrespectful, please report it.)

 
12/7/2000 1:26:25 PMDiB

Daniel, not every API is included with the API app that comes with VB. Also if you need to convert a custom struct this proves quite usefull. I think this program is great and because it's open source I can fix some of the bugs I've found without waiting for the author to update it him/herself. Good job Kimon, this is a great program and I thank you for it.
(If this comment was disrespectful, please report it.)

 
12/7/2000 3:04:45 PMKimon Andreou

Thanks everybody for your feedback!
It took me a while to develop this program.

DiB, you're right about Microsoft's API app that comes with VB. Not only it doesn't contain all the declarations, many of them are wrong. As for the bugs you mentioned, I'd appreciate it if you would send me any changes you make or a list of those bugs.
One bug I've discovered is when converting unions within structures, although it was initially working I guess by adding more functionality I broke that part.

Finally, my next project is to process C++ files, but don't expect it anytime soon. Handling all those objects & classes is a pain.

Thanks

Kimon
(If this comment was disrespectful, please report it.)

 
12/14/2000 7:53:43 AMLinguar

Wow,
Never thought about posting such a thing... Good job though. I've done something similar, however, I'm not sure how effective it is.
(If this comment was disrespectful, please report it.)

 
12/23/2000 11:31:47 PMGavin

Nice Very Nice.
Well done ive been waiting for something like this for ages.
keep up the good work !!
(If this comment was disrespectful, please report it.)

 
2/7/2001 5:51:38 AMRob Van Mieghem

It's a really nice tool and a time saver, I just want to warn beginner api programmers that there is no such thing as a standard way of passing byval or byref, it depends on what you're trying to do. You can for example just as well pass a stringvalue as a long(if you want to use a unicode version of an extern method and don't want VB to transform your string to ascii). Always be careful of what you're doing, especially when working with windows api. I don't want to discourage you all, just want to encourage you to go into detail in whatever you develop. Have fun
(If this comment was disrespectful, please report it.)

 
2/13/2001 3:55:21 PMmgigani

Does anyone know if there is program that will convert C sub/functions to VB sub/functions. I have some C routines that needs to be converted to VB. I am will to pay for such a thing. Thanks
If you know of such a tool please send me an email about it (mgigani@aol.com) Thanks a bunch
(If this comment was disrespectful, please report it.)

 
4/3/2001 6:55:52 PMBenj

I can't seem to get it to work I tried converting Winuser.h file from .Net ws up.... Any Ideas??? email me..
(If this comment was disrespectful, please report it.)

 
4/10/2002 2:47:16 AMUnruled Boy

this is fatastic!

could it convert vb to c?
(If this comment was disrespectful, please report it.)

 
7/8/2002 2:52:25 AMDaniel Pramel

nice tool which saves a lot of time.
Cool idea 5 from me
Daniel
(If this comment was disrespectful, please report it.)

 
8/13/2002 5:29:13 AMAny

Good! ÇÏÇÏ...
(If this comment was disrespectful, please report it.)

 
6/22/2003 6:27:06 AM

is there a way 2 transform vb code to C++
(If this comment was disrespectful, please report it.)

 
8/23/2003 7:40:39 PMVisualcode

Needs work, lots of it. I tried converting a struct, and well it didnt work. Most every line was converted wrong. like:
int a,Temp;
and it turns int temp; to temp as int
when vb needs Integer. just thought you would like to know.
(If this comment was disrespectful, please report it.)

 
1/1/2004 3:18:42 PM

thanx for this 5 stars
(If this comment was disrespectful, please report it.)

 
6/17/2004 1:57:33 PM

Killo, esto e de puta madre, saluts from Spain!
(If this comment was disrespectful, please report it.)

 
8/24/2004 6:40:49 AMLars Holm Jensen

It doesn't handle IN/OUT keywords..
..Process(..
..
strString = Replace(strString, "IN ", vbNullString)
strString = Replace(strString, "OUT ", vbNullString)
..

(If this comment was disrespectful, please report it.)

 
3/7/2007 6:52:08 AMRafia

excellent piece of work dude
(If this comment was disrespectful, please report it.)

 
5/28/2007 2:38:45 AMmalingxian

So COOOOOOOOOOOOOOOOOOOOOOOOOOOL.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.