Board index » Visual Studio » calling a C dll or executable from vb.net
|
slm2112
|
|
slm2112
|
calling a C dll or executable from vb.net
Visual Studio186
Hi I have a vb.net app and am trying to call a C program from it, perhaps a dll or executable. This is unmanaged code, just wondering if someone could provide a brief example? Thanks Paul. - |
| Tom
Registered User |
Tue Jan 27 00:10:41 CST 2004
Re:calling a C dll or executable from vb.net
On 2004-01-26, Paul <anonymous@discussions.microsoft.com>wrote:
QuoteHi I have a vb.net app and am trying to call a C program from it, perhaps a dll or executable. This is unmanaged code, just wondering if someone could provide a brief example? Thanks Paul. An executable can be run from VB's shell statement or you can use the System.Diagnostics.Process class if you need more control. If your trying to call exported functions, then you'll want to look into using P/Invoke... If you have the C definitions for the functions, we would be happy to help you translate some of them and give you pointers... -- Tom Shelton [MVP] - |
| hirf-spam-me-here
Registered User |
Tue Jan 27 08:57:38 CST 2004
Re:calling a C dll or executable from vb.net
* "=?Utf-8?B?UGF1bA==?=" <anonymous@discussions.microsoft.com>scripsit:
QuoteHi I have a vb.net app and am trying to call a C program from it, Imports System.Diagnostics . . . Process.Start("C:\Foo.exe") /// Or, in VB.NET: \\\ Shell("C:\Foo.exe") /// For calling exported functions of a native DLL, have a look at the 'Declare' statement and/or the 'DllImportAttribute' class. -- Herfried K. Wagner [MVP] <www.mvps.org/dotnet>">www.mvps.org/dotnet> - |
| anonymous
Registered User |
Tue Jan 27 10:16:07 CST 2004
Re:calling a C dll or executable from vb.net
thanks for the information. How would I call this simple c function from vb.net passing params to it and also receiving the return param.
vb.net want to pass in 3,4 and get the integer results results = sum_a_and_b(3,4) c function int sum_a_and_b (int a, int b) { int c; c = a + b; return (c); } - |
| anonymous
Registered User |
Tue Jan 27 10:31:05 CST 2004
Re:calling a C dll or executable from vb.net
thanks for the information. How would I call this simple c function from vb.net passing params to it and also receiving the return param.
vb.net want to pass in 3,4 and get the integer result results = sum_a_and_b(3,4 c functio int sum_a_and_b (int a, int b int c c = a + b return (c) - |
| hirf-spam-me-here
Registered User |
Tue Jan 27 10:38:23 CST 2004
Re:calling a C dll or executable from vb.net
* "=?Utf-8?B?UGF1bA==?=" <anonymous@discussions.microsoft.com>scripsit:
Quotethanks for the information. How would I call this simple c function from vb.net passing params to it and also receiving the return param. <datatype>_stdcall'. You will get more info on this topic in the C++ group. -- Herfried K. Wagner [MVP] <www.mvps.org/dotnet>">www.mvps.org/dotnet> - |
