1

I need to convert C code to Visual Basic.

I have .c and .h files.

Are there some ways to use my .c file in Visual Basic Application? Application was created in Visual Basic 6.0.

Now I see only one way: convert the code manually. But it takes a lot of time because I never use VB before, so I need some time to learn the syntaxes. I read some info about using .dll in VB. Maybe there are some ways, for example, create a .dll from .c and then use it in my application?..

Mikhail_Sam
  • 10,602
  • 11
  • 66
  • 102
  • 3
    Your best bet would be to convert the code manually, as writing DLLs in C and calling it from VB would be more pain if don't have much experience with that. VB syntax is something you learn at the lunch break. – Eugene Sh. Feb 27 '17 at 14:54
  • 3
    How much C code do you have to work with? If it is short, then by all means convert it by hand. Good opportunity to learn VB if you will be working in that language anyway. If it is very large, compile to a standard DLL with exported functions, and just call it from VB. – StayOnTarget Feb 28 '17 at 12:23
  • 2
    DaveInCaz is right. Follow his advice. If you do decide that the best route is to compile the C code as a DLL and call it from VB6, you should [read this Microsoft document](http://vb.mvps.org/tips/vb5dll.asp) on how to do it. – MarkJ Feb 28 '17 at 16:53
  • @DaveInCaz if you write an answer Ill accept it! – Mikhail_Sam Mar 01 '17 at 15:07
  • @MarkJ if you write an answer Ill accept it! – Mikhail_Sam Mar 01 '17 at 15:08

1 Answers1

3

How much C code do you have to work with? If it is short, then by all means convert it by hand. Good opportunity to learn VB if you will be working in that language anyway. If it is very large, compile to a standard DLL with exported functions, and just call it from VB.

(Added as answer from comment above)


Good addition from another comment: If you do decide that the best route is to compile the C code as a DLL and call it from VB6, you should read this Microsoft document on how to do it.

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81