You are currently offline, waiting for your internet to reconnect

FILE: B2CSE.exe Converts Visual Basic Automation Code to Visual C++

This article was previously published under Q216388
B2CSE.exe is a self-extracting executable file containing a stand-alone utility file (B2C.exe) that converts Microsoft Visual Basic Automation code into Microsoft Visual C++ code. You can paste the code generated from B2C.exe directly into your Visual C++ application to get the same functionality. Additionally, B2C.exe comes with some Visual Basic Automation examples you can use.
More information
The following file is available for download from the Microsoft Download Center:
Release Date: April 3, 2000

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

You have royalty-free right to use, modify, reproduce, and distribute any code generated by the B2C Converter, or any modified version of the B2C Converter, in any way you find useful provided that you agree that Microsoft has no warranty, obligations, or liability for the generated code.

B2CSE.exe contains the following files:
   FileName           Size   -------------------------   B2C.exe            220KB   Readme.txt           4KB				
B2C Limitations

B2C.exe was designed to convert simple Automation examples. It was not designed to be a generic conversion utility for all of Visual Basic. As such, you should be aware of the following limitations:
  • B2C does not support named-parameters. Do not use code that invokes a method by passing a named parameter:
       MyObj.MyMethod z:=5
  • B2C does support optional parameters, so you can use code like:
       MyObj.MyMethod a,b,c,,,,g
  • B2C currently does not calculate expressions. Do not use code like:
       MyObj.MyMethod (a+b)/2, a*b, a+1
Despite these limitations, B2C is a powerful tool. For example, you can use B2C.exe to generate the equivalent Visual C++ code with the following Visual Basic Automation code and then paste the generated code directly into your project:

' Start Excel.dim app as objectset app = createobject("Excel.Application")' Make it = true' Add a new' Declare an array.dim arr(1 to 15, 1 to 15) as long' Fill array with values.dim i as longdim j as longfor i = 1 to 15   for j = 1 to 15      arr(i,j) = i   next j   doeventsnext i' Set all values in one shot!app.activesheet.range("A1:O15").value = arrmsgbox "All done."				
The user interface for B2C.exe is very simple. It includes three edit boxes, three buttons, and a combo-box where you can select some examples. You type in or paste your Visual Basic code in the edit box on the left, and when you click Convert & Copy, B2C.exe populates the other two edit boxes with your generated Visual C++ code, as well as copying it to the clipboard for quick use.

The generated code uses a helper function called AutoWrap() that is generated in the edit box in the upper-right corner of the B2C.exe dialog box. You need to add this function to your project so that it is accessible from where you use B2C-generated code. Although this function is regenerated every time you convert new code, it is always the same so you only need to copy it once.

The best way to learn how it works, is to run B2C and experiment with the built-in examples.

converter conversion javafy coledispatchdriver import _com_ptr_t idispatch automate invoke getidsofnames

Article ID: 216388 - Last Review: 09/20/2012 08:35:00 - Revision: 6.0

  • Microsoft Office 2000 Developer Edition
  • Microsoft Visual Basic for Applications 6.0
  • Microsoft Visual C++ 5.0 Enterprise Edition
  • Microsoft Visual C++ 5.0 Professional Edition
  • kbdownload kbautomation kbfile kbinfo KB216388