请将以下vb代码如何写为C#代码 谢谢
VB code:
Dim lpszName As New VBFixedStringAttribute(100)
Dim i As Integer
Dim DriverName As String = Space(80)
Dim DriverVersion As String = Space(80)
Dim bmp As BITMAPINFO
With bmp.bmiHeader
.biSize = Len(bmp.bmiHeader)
.biWidth = 320
.biHeight = 240
.biPlanes = 1
.biBitCount = 24
End With
i=0 '摄像头所在的组号
capGetDriverDescriptionA(i, DriverName, 80, DriverVersion, 80)
lwndC1 = capCreateCaptureWindowA(DriverName, WS_VISIBLE Or WS_CHILD, 0, 0, PictureBox1.Width, PictureBox1.Height, PictureBox1.Handle.ToInt32, 0)
If capDriverConnect(lwndC1, 0) Then
capDlgVideoSource(lwndC1)
capPreviewRate(lwndC1, 66)
capPreview(lwndC1, True)
capSetVideoFormat(lwndC1, bmp, Len(bmp))
SetWindowPos(lwndC1, 0, 0, 0, bmp.bmiHeader.biWidth, bmp.bmiHeader.biHeight, SWP_NOMOVE Or SWP_NOZORDER)
ListBox1.Items.Add(DriverName.Trim)
End If
Function capDlgVideoSource(ByVal lwnd As Long) As Boolean
capDlgVideoSource = SendMessage(lwnd, WM_CAP_DLG_VIDEOSOURCE, 0, 0)
End Function
其中:
Public Const WM_CAP_START As Integer = WM_USER
Public Const WM_CAP_DLG_VIDEOSOURCE As Integer = WM_CAP_START + 42
http://www.developerfusion.com/tools/convert/vb-to-csharp/
在线转换
C# code
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlight