Hi, I am new to windows forms.
I used the 2 lines of code below to launch a c++ code from a windows forms GUI and it worked:
Dim lngReturn As Long
lngReturn = Shell("c:\MyProgams\cfile.exe", vbNormalFocus)

I hope someone can help with the issue below:
My interface includes some text boxes. The user enters some numbers in these text boxes and I want to pass and use these parameters in the c++ code
Any idea how to do it?

Thanks !!

Recommended Answers

All 3 Replies

You just need to build a string to enter in the first parametere of the Visual Basic Shell function.

If you have two text boxes, and the user has entered the appropriate numbers, just use the entered values to build your string for the first parameter of the Shell function.

lngReturn = Shell("c:\cfiles\cfile.exe " & txtNo1.text & " " & txtNo2.text, vbNormalFocus)

Your C++ program should be able to handle the arguments using GetCommandLine(), if using the GUI or argv[] if using a console application.

commented: Nice answer. +12

Thanks a lot hkdani for your prompt reply !!
It worked :)

Can you please mark this as solved, thanx Jean. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.