vb.net代码转c vb6转vbnet

请教:我现在手里有原来别人写的.vb代码(vb.net写的),现在我想在C中调用这段代码编译生成dll?先把vb.netvb.net代码转c的编译成dllvb.net代码转c , 就可以在c中和java中直接掉
C# to vb.net 代码转换System.Runtime.InteropServices.DllImport("user32.dll") _
Public Shared Function SetWindowLong(hWnd As IntPtr, nIndex As Integer, wndproc As Integer) As Integer
End Function
System.Runtime.InteropServices.DllImport("user32.dll") _
Public Shared Function GetWindowLong(hWnd As IntPtr, nIndex As Integer) As Integer
End Function
Public Const GWL_STYLE As Integer = -16
Public Const WS_DISABLED As Integer = H8000000
Public Shared Sub SetControlEnabled(c As Control, enabled As Boolean)
If enabled Then
SetWindowLong(c.Handle, GWL_STYLE, (Not WS_DISABLED) And GetWindowLong(c.Handle, GWL_STYLE))
Else
SetWindowLong(c.Handle, GWL_STYLE, WS_DISABLED + GetWindowLong(c.Handle, GWL_STYLE))
End If
End Sub
授人以渔:
这个网站超牛逼
vb.net 调用C语言可执行程序并传值?在c语言中每一个变量都有两个属性一个是值,一个是址 。比如inta=2;变量a的值是2,变量a的地址,可以用取地址
操作符
获?。?即a 。因此以C语言的函数传递中具备两种方式传递参数 , 一种是传址,一种传值 。比如voidf1(intv){;}//函数f1v
怎样将VB代码换成C可以试试VBto Converter
VBto Converter是一款VB语言转换软件vb.net代码转c,它支持将MS Visual Basic资源文件(包括源代码)转换成MS VC++ MFC, VC++.NET (CLR), VBNET, C#, J#, Borland C++ Builder, Borland Delphi源文件 。
vb.net代码翻译成c#代码!public string GetAllData(bool Verbose = true)
{
ListViewItem lvi = default(ListViewItem);
try {
ports.Serial.settings.SetStandard(MyPort, 9600, 0);
ports.Serial.settings.useDTR = 1;
ports.Serial.settings.useRTS = 1;
if ((ports.Serial.Open() == false)) {
return "Failed To Open Port";
}
if (Verbose) {
lvi = status.setMessage("WeatherDuck", "Data Sample", "Begin", true);
lvi.ForeColor = System.Drawing.Color.Blue;
}
System.Threading.Thread.Sleep(por_delay);
ports.Serial.FlushRcv();
ports.Serial.SendString("T");
System.Threading.Thread.Sleep(read_delay);
【vb.net代码转c vb6转vbnet】string Temperature = ports.Serial.ReadString();
if ((Temperature.Length == 0))
return "Failed To Read Temperature";
char[] split = ",".ToCharArray();
string[] temp = Temperature.Split(split, 2);
_tempC = temp[0];
_tempF = temp[1];
if (Verbose)
lvi.SubItems(2).Text = "Done Temperature";
ports.Serial.SendString("H");
System.Threading.Thread.Sleep(read_delay);
_humidity = ports.Serial.ReadString();
if ((_humidity.Length == 0))
return "Failed To Read Humidity";
if (Verbose)
lvi.SubItems(2).Text = "Done Humidity";
ports.Serial.SendString("L");
System.Threading.Thread.Sleep(read_delay);
_lightlevel = ports.Serial.ReadString();
if ((_lightlevel.Length == 0))
return "Failed To Read LightLevel";
if (Verbose)
lvi.SubItems(2).Text = "Done Light Level";
ports.Serial.SendString("F");
System.Threading.Thread.Sleep(read_delay);
_airflow = ports.Serial.ReadString();
if ((_airflow.Length == 0))
return "Failed To Read Air Flow";
if (Verbose)
lvi.SubItems(2).Text = "Done Air Flow";
int i = 0;
while ((true)) {
i = i + 1;
if ((i = sound_delay))
break; // TODO: might not be correct. Was : Exit While
System.Threading.Thread.Sleep(500);
if (Verbose)
lvi.SubItems(2).Text = "Sampling Sound Level:" + i.ToString();
}
ports.Serial.SendString("S");
System.Threading.Thread.Sleep(read_delay);

推荐阅读