Microsoft Visual Studio .NET移行ガイド

Size: px
Start display at page:

Download "Microsoft Visual Studio .NET移行ガイド"

Transcription

1 DLL TUT-0014 Ver

2 Ver Visual Basic.NET (GPC-2000) (GPC-3100) (GPC-3300) () hdevicehandle = DioOpen(lpszName, FBIDIO_FLAG_SHARE) () hdevicehandle = IFCDio.DioOpen(lpszName, FBIDIO_FLAG_SHARE) GPIB(GPC-4301)Visual Basic.NET Visual C#.NET (GPC-2000) (GPC-3100) (GPC-3300)G PIBGPC (,), Web site( ) Interface Corporation

3 / () Interface Corporation - 2 -

4 5 1 Visual Studio.NET 7 2 Visual Basic.NET GPC (GPC-3100) (GPC-3300) GPIB (GPC-4301 DLL) GPIB (GPC-4301 DLL) (1 ) (AD ) (DA ) GPIB ( DLL ) GPIB ( DLL ) Visual C#.NET GPC GPC GPC GPC-4301 DLL GPC-4301 DLL Interface Corporation

5 4.NET DLL DLL DLL DLL DLL DLL Declare As Any (GPC-3100 ) Visual C++.NET Interface Corporation - 4 -

6 はじめに Visual Studio 6.0Visual Studio.NET WindowsGPC Visual Studio.NETVisual Basic.NETVisual C#.NETVisual C++.NET Visual Studio.NETVisual Studio 6.0Visual Studio.NET Microsoft Visual Studio 6.0Microsoft Visual Studio.NET Visual Basic.NETVisual C#.NET Visual C++.NET MicrosoftMSDN PCI/CompactPCI/CardBusWindows GPC PCI/CompactPCI/CardBusWindows GPC Interface Corporation

7 Visual Studio Visual Studio.NET Visual Studio.NET Enterprise Architect Visual Studio.NET Enterprise Developer Visual Studio.NET Professional Visual Studio.NET Academic Visual Basic.NET Standard Visual C#.NET Standard Visual C++.NET Standard Windows XP ProfessionalVisual Studio.NET Professional PCI/CompactPCI/CardBusWindowsGPC (BPC-0818) Web sitewww.interface.co.jp PDF PDF Web sitewww.interface.co.jp Visual Basic, Visual C++ Visual Basic, Visual C++ Web site Interface Corporation - 6 -

8 第 1 章 Visual Studio.NET とは? Visual Studio.NETMicrosoftXML Web Visual Basic 6.0 Visual Basic 6.0Visual Basic.NETVisual C Visual C++.NETC++ C/C ++ Visual C#.NET WindowsGPC Visual Studio.NETVisual Basic.NETVisual C#.NET Visual C++.NET Visual Studio.NETMicrosoft MSDN Visual Studio 6.0Visual Studio.NET Interface Corporation

9 第 2 章 Visual Basic.NET への移行 Visual Basic.NET(GPC) Visual Basic.NET Visual Basic.NET Visual Basic 6.0Visual Basic.NET Visual Basic.NETMicrosoft MSDN Interface Corporation - 8 -

10 2.1 関数定義ファイルのインポート Visual Basic.NET 1. Visual Studio.NET Visual Basic OK Interface Corporation

11 4. BPC-0818Visual Basic.NET GPC-2000 GPC-3100 GPC-3300 GPC-4301 DLL GPC-4301 DLL 2-1 Visual Basic.NET Visual Basic.NET < > Interface BPC0818 GPC2000 include FbiDio.vb < > Interface BPC0818 GPC3100 include FbiAd.vb < > Interface BPC0818 GPC3300 include FbiDa.vb < > Interface BPC0818 GPC4301 include GPC4301Std.vb < > Interface BPC0818 GPC4301 include GPC4301Ex.vb 2-3 Visual Basic.NET Visual Basic 6.0 Visual Basic.NET Interface Corporation

12 2.1.1 デジタル入出力ボード (GPC-2000) Visual Basic.NETVisual Basic 6.0 Visual Basic 6.0 Visual Basic.NET GPC-2000 FbiDio.bas < > Interface GPC2000 include FbiDio.bas BPC-0818 FbiDio.vb < > Interface BPC0818 GPC2000 include FbiDio.vb Visual Basic 6.0Visual Basic.NET Visual Basic.NET 2-2 () FBIDIO_RSTIN_MASK DioInputHandShake Any Declare DioInputHandShakeEx Any As Any DioOutputHandShake Any DioOutputHandShakeEx Any Interface Corporation

13 List2-1,List2-2Visual Basic 6.0Visual Basic.NETFBIDIO_RSTIN_MASK Visual Basic.NET List2-1 Visual Basic 6.0FBIDIO_RSTIN_MASK Public Const FBIDIO_RSTIN_MASK = 1 List2-2Visual Basic.NETFBIDIO_RSTIN_MASK Public Const FBIDIO_RSTIN_MASK As Integer = 1 Visual Basic 6.0 Visual Basic.NET Any Visual Basic.NET 2-2Any DioInputHandShake Visual Basic.NET Interface Corporation

14 List2-3,List2-4Visual Basic 6.0Visual Basic.NETDioInputHandShake List2-3Visual Basic 6.0DioInputHandShake Declare Function DioInputHandShake Lib "FbiDio.DLL" (ByVal hdevicehandle As Long, ByRef lpbuffer As Any, ByVal nnumofbytestoread As Long, ByRef lpnumofbytesread As Long, ByRef lpoverlapped As OVERLAPPED) As Long List2-4Visual Basic.NETDioInputHandShake Declare Function DioInputHandShake Lib "FbiDio.DLL" (ByVal hdevicehandle As Integer, ByRef lpbuffer As Byte, ByVal nnumofbytestoread As Integer, ByRef lpnumofbytesread As Integer, ByRef lpoverlapped As OVERLAPPED) As Integer Declare Function DioInputHandShake Lib "FbiDio.DLL" (ByVal hdevicehandle As Integer, ByRef lpbuffer As Short, ByVal nnumofbytestoread As Integer, ByRef lpnumofbytesread As Integer, ByRef lpoverlapped As OVERLAPPED) As Integer Declare Function DioInputHandShake Lib "FbiDio.DLL" (ByVal hdevicehandle As Integer, ByRef lpbuffer As Integer, ByVal nnumofbytestoread As Integer, ByRef lpnumofbytesread As Integer, ByRef lpoverlapped As OVERLAPPED) As Integer Declare Function DioInputHandShake Lib "FbiDio.DLL" (ByVal hdevicehandle As Integer, ByVal lpbuffer() As Byte, ByVal nnumofbytestoread As Integer, ByRef lpnumofbytesread As Integer, ByRef lpoverlapped As OVERLAPPED) As Integer Declare Function DioInputHandShake Lib "FbiDio.DLL" (ByVal hdevicehandle As Integer, ByVal lpbuffer() As Short, ByVal nnumofbytestoread As Integer, ByRef lpnumofbytesread As Integer, ByRef lpoverlapped As OVERLAPPED) As Integer Declare Function DioInputHandShake Lib "FbiDio.DLL" (ByVal hdevicehandle As Integer, ByVal lpbuffer() As Integer, ByVal nnumofbytestoread As Integer, ByRef lpnumofbytesread As Integer, ByRef lpoverlapped As OVERLAPPED) As Integer AnyDeclare As Any APIVisual Basic 6.0 APIGPC-2000Help Interface Corporation

15 2.1.2 アナログ入力ボード (GPC-3100) Visual Basic.NETVisual Basic 6.0 Visual Basic 6.0 Visual Basic.NET GPC-3100 FbiAd.bas <> Interface GPC3100 include FbiAd.bas BPC-0818 FbiAd.vb <> Interface BPC0818 GPC3100 include FbiAd.vb Visual Basic 6.0Visual Basic.NET Visual Basic.NET 2-3 () FLAG_SYNC AdInputAD Any Declare AdGetSamplingData Any AdDataConv Any As Any AdReadFile Any AdBmGetSamplingData Any AdLvGetSamplingData Any AdReadSamplingBuffer Any AdFifoGetSamplingData Any Interface Corporation

16 ADSMPLCHREQ ADTRIGCHREQ ADSMPLREQ ADBMSMPLREQ ADBOARDSPEC Interface Corporation

17 2-3 List2-5, List2-6Visual Basic 6.0Visual Basic.NETFLAG_SYNC List2-5 Visual Basic 6.0FLAG_SYNC Public Const FLAG_SYNC = 1 List2-6 Visual Basic.NETFLAG_SYNC Public Const FLAG_SYNC As Integer = 1 Visual Basic 6.0Visual Basic.NET Any Visual Basic.NET 2-3Any AdInputAD Visual Basic.NET Interface Corporation

18 List2-7,2-8Visual Basic 6.0Visual Basic.NETAdInputAD List2-7 Visual Basic 6.0AdInputAD Declare Function AdInputAD Lib "fbiad.dll" (ByVal hdevicehandle As Long, ByVal ulch As Long, ByVal ulsinglediff As Long, ByRef lpadsmplchreq As ADSMPLCHREQ, ByRef lpdata As Any) As Long List2-8 Visual Basic.NETAdInputAD Declare Function AdInputAD Lib "fbiad.dll" (ByVal hdevicehandle As Integer, ByVal ulch As Integer, ByVal ulsinglediff As Integer, ByRef lpadsmplchreq As ADSMPLCHREQ, ByRef lpdata As Byte) As Integer Declare Function AdInputAD Lib "fbiad.dll" (ByVal hdevicehandle As Integer, ByVal ulch As Integer, ByVal ulsinglediff As Integer, ByRef lpadsmplchreq As ADSMPLCHREQ, ByRef lpdata As Short) As Integer Declare Function AdInputAD Lib "fbiad.dll" (ByVal hdevicehandle As Integer, ByVal ulch As Integer, ByVal ulsinglediff As Integer, ByRef lpadsmplchreq As ADSMPLCHREQ, ByRef lpdata As Integer) As Integer Declare Function AdInputAD Lib "fbiad.dll" (ByVal hdevicehandle As Integer, ByVal ulch As Integer, ByVal ulsinglediff As Integer, ByVal lpadsmplchreq() As ADSMPLCHREQ, ByVal lpdata() As Byte) As Integer Declare Function AdInputAD Lib "fbiad.dll" (ByVal hdevicehandle As Integer, ByVal ulch As Integer, ByVal ulsinglediff As Integer, ByVal lpadsmplchreq() As ADSMPLCHREQ, ByVal lpdata() As Short) As Integer Declare Function AdInputAD Lib "fbiad.dll" (ByVal hdevicehandle As Integer, ByVal ulch As Integer, ByVal ulsinglediff As Integer, ByVal lpadsmplchreq() As ADSMPLCHREQ, ByVal lpdata() As Integer) As Integer AnyDeclare As Any Interface Corporation

19 2-3 List2-1-9, Visual Basic 6.0Visual Basic.NETADSMPLCHREQ List 2-9 Visual Basic 6.0ADSMPLCHREQ Type ADSMPLCHREQ UlChNo As Long UlRange As Long End Type List 2-10 Visual Basic.NETADSMPLCHREQ Option Strict Off Option Explicit On Imports System.Runtime.InteropServices Module FbiAd <StructLayout(LayoutKind.Sequential)> _Structure ADSMPLCHREQ Dim ulchno As Integer Dim ulrange As Integer End Structure Interface Corporation

20 2-3 List2-11,2-12Visual Basic 6.0Visual Basic.NETADSMPLREQ List 2-11 Visual Basic 6.0ADSMPLREQ Type ADSMPLREQ UlChCount As Long SmplChReq(0 To 255) As ADSMPLCHREQ UlSamplingMode As Long UlSingleDiff As Long UlSmplNum As Long UlSmplEventNum As Long FSmplFreq As Single UlTrigPoint As Long UlTrigMode As Long LTrigDelay As Long UlTrigCh As Long FTrigLevel1 As Single FTrigLevel2 As Single UlEClkEdge As Long UlATrgPulse As Long UlTrigEdge As Long UlTrigDI As Long UlFastMode As Long End Type Interface Corporation

21 List 2-12 Visual Basic.NETADSMPLREQ <StructLayout(LayoutKind.Sequential)> _ Structure ADSMPLREQ Dim ulchcount As Integer <MarshalAs(UnmanagedType.ByValArray, SizeConst:=512)> _ Dim ulchnorange() As Integer Dim ulsamplingmode As Integer Dim ulsinglediff As Integer Dim ulsmplnum As Integer Dim ulsmpleventnum As Integer Dim fsmplfreq As Single Dim ultrigpoint As Integer Dim ultrigmode As Integer Dim ltrigdelay As Integer Dim ultrigch As Integer Dim ftriglevel1 As Single Dim ftriglevel2 As Single Dim uleclkedge As Integer Dim ulatrgpulse As Integer Dim ultrigedge As Integer Dim ultrigdi As Integer Dim ulfastmode As Integer Public Sub New(ByVal Dummy As Integer) ReDim ulchnorange(511) End Sub Public Sub SetChNo(ByVal ulindex As Integer, ByVal ulnumber As Integer) ulchnorange(ulindex * 2) = ulnumber End Sub Public Function GetChNo(ByVal ulindex As Integer) GetChNo = ulchnorange(ulindex * 2) End Function Public Sub SetChRange(ByVal ulindex As Integer, ByVal ulrange As Integer) ulchnorange((ulindex * 2) + 1) = ulrange End Sub Public Function GetChRange(ByVal ulindex As Integer) GetChRange = ulchnorange((ulindex * 2) + 1) End Function End Structure SetChNoGetChNoSetRangeNoGetRangeNo Interface Corporation

22 GPC-3100 APIVisual Basic 6.0 APIGPC-3100Help アナログ出力ボード (GPC-3300) Visual Basic.NETVisual Basic 6.0 Visual Basic 6.0 Visual Basic.NET GPC-3300 FbiDa.bas <> Interface GPC3300 include FbiDa.bas BPC-0818 FbiDa.vb < > Interface BPC0818 GPC3300 include FbiDa.vb Visual Basic 6.0Visual Basic.NET Visual Basic.NET Interface Corporation

23 2-4 () FLAG_SYNC DaSetSamplingData Any Declare DaOutputDA Any DaDataConv Any As Any DaWriteFile Any DASMPLCHREQ DASMPLREQ DABOARDSPEC DAMODECHREQ DAMODEREQ DAFIFOREQ Interface Corporation

24 2-4 List 2-13, List2-14Visual Basic 6.0Visual Basic.NETFLAG_SYNC List 2-13 Visual Basic 6.0FLAG_SYNC Public Const FLAG_SYNC = 1 List 2-14 Visual Basic.NETFLAG_SYNC Public Const FLAG_SYNC As Integer = 1 Visual Basic 6.0Visual Basic.NET Any Visual Basic.NET 2-4Any DaSetSamplingData Visual Basic.NET Interface Corporation

25 List2-15,List2-16Visual Basic 6.0Visual Basic.NETDaSetSamplingData List 2-15 Visual Basic 6.0DaSetSamplingData Declare Function DaSetSamplingData Lib "FbiDa.DLL" (ByVal hdevicehandle As Long, ByRef psmpldata As Any, ByVal ulsmpldatanum As Long) As Long List 2-16 Visual Basic.NETDaSetSamplingData Declare Function DaSetSamplingData Lib "FbiDa.DLL" (ByVal hdevicehandle As Integer, ByRef psmpldata As Byte, ByVal ulsmpldatanum As Integer) As Integer Declare Function DaSetSamplingData Lib "FbiDa.DLL" (ByVal hdevicehandle As Integer, ByRef psmpldata As Short, ByVal ulsmpldatanum As Integer) As Integer Declare Function DaSetSamplingData Lib "FbiDa.DLL" (ByVal hdevicehandle As Integer, ByRef psmpldata As Integer, ByVal ulsmpldatanum As Integer) As Integer Declare Function DaSetSamplingData Lib "FbiDa.DLL" (ByVal hdevicehandle As Integer, ByVal psmpldata() As Byte, ByVal ulsmpldatanum As Integer) As Integer Declare Function DaSetSamplingData Lib "FbiDa.DLL" (ByVal hdevicehandle As Integer, ByVal psmpldata() As Short, ByVal ulsmpldatanum As Integer) As Integer Declare Function DaSetSamplingData Lib "FbiDa.DLL" (ByVal hdevicehandle As Integer, ByVal psmpldata() As Integer, ByVal ulsmpldatanum As Integer) As Integer AnyDeclare As Any 2-4 List2-17,List2-18Visual Basic 6.0Visual Basic.NETADSMPLCHREQ List 2-17 Visual Basic 6.0DASMPLCHREQ Type DASMPLCHREQ ulchno As Long ulrange As Long End Type Interface Corporation

26 List 2-18 Visual Basic.NETDASMPLCHREQ Option Strict Off Option Explicit On Imports System.Runtime.InteropServices Module FbiDa <StructLayout(LayoutKind.Sequential)> _ Structure DASMPLCHREQ Dim ulchno As Integer Dim ulrange As Integer End Structure 2-4 List2-19,List2-20Visual Basic 6.0Visual Basic.NETADSMPLREQ List 2-19 Visual Basic 6.0DASMPLREQ Type DASMPLREQ ulchcount As Long SmplChReq(0 To 255) As DASMPLCHREQ ulsamplingmode As Long fsmplfreq As Single ulsmplrepeat As Long ultrigmode As Long ultrigpoint As Long ultrigdelay As Long uleclkedge As Long ultrigedge As Long ultrigdi As Long End Type Interface Corporation

27 List 2-20 Visual Basic.NETDASMPLREQ <StructLayout(LayoutKind.Sequential)> _ Structure DASMPLREQ Dim ulchcount As Integer <MarshalAs(UnmanagedType.ByValArray, SizeConst:=512)> _ Dim ulchnorange() As Integer Dim ulsamplingmode As Integer Dim fsmplfreq As Single Dim ulsmplrepeat As Integer Dim ultrigmode As Integer Dim ultrigpoint As Integer Dim ultrigdelay As Integer Dim uleclkedge As Integer Dim ultrigedge As Integer Dim ultrigdi As Integer Public Sub New(ByVal Dummy As Integer) ReDim ulchnorange(511) End Sub Public Sub SetChNo(ByVal ulindex As Integer, ByVal ulnumber As Integer) ulchnorange(ulindex * 2) = ulnumber End Sub Public Function GetChNo(ByVal ulindex As Integer) GetChNo = ulchnorange(ulindex * 2) End Function Public Sub SetChRange(ByVal ulindex As Integer, ByVal ulrange As Integer) ulchnorange((ulindex * 2) + 1) = ulrange End Sub Public Function GetChRange(ByVal ulindex As Integer) GetChRange = ulchnorange((ulindex * 2) + 1) End Function End Structure SetChNoGetChNoSetRangeNoGetRangeNo GPC-3100 APIVisual Basic 6.0API GPC-3100Help Interface Corporation

28 2.1.4 GPIB ボード (GPC-4301 標準版 DLL) GPIB GPC-4301DLL Visual Basic.NETVisual Basic 6.0 Visual Basic 6.0 Visual Basic.NET GPC-4301 GPC43042.bas <> Interface GPC4301 include GPC43042.bas BPC-0818 GPC4301std.vb <> Interface BPC0818 GPC4301 include GPC4301std.vb Visual Basic 6.0Visual Basic.NET 2-5 (GPIB GPC-4301) GPIB_SUCCESS_NOT_ACTI VE_SRQ Interface Corporation

29 GpibReceive GpibSend GpibSetSrqEvent Any Declare As Any delegate PLPSRQCALLBACK delegate GpibSetSrqEvent Interface Corporation

30 2- List2-21, List2-22 Visual Basic 6.0Visual Basic.NET GPIB_SUCCESS_NOT_ACTIVE_SRQ List 2-21 Visual Basic 6.0GPIB_SUCCESS_NOT_ACTIVE_SRQ Public Const GPIB_SUCCESS_NOT_ACTIVE_SRQ = 5 List 2-22 Visual Basic.NETGPIB_SUCCESS_NOT_ACTIVE_SRQ Public Const GPIB_SUCCESS_NOT_ACTIVE_SRQ As Integer = 5 Visual Basic 6.0Visual Basic.NET Any Visual Basic.NET GpibSend GpibSetnd IntPtr [] 4 GpibSend Visual Basic.NET Interface Corporation

31 Byte Byte String IntPtr 2-6 GpibSend 1 List 2-23 Visual Basic 6.0GpibSend Declare Function GpibSend Lib "GPC43042.DLL" (ByVal ulboardno As Long, ByRef lpadrstbl As Long, ByVal ulplength As Long, ByVal vpbuffer As String) As Long List 2-24 Visual Basic.NETGpibSendByte Declare Function GpibSend Lib "GPC43042.DLL" (ByVal ulboardno As Integer, ByVal lpadrstbl() As Integer, ByVal ulplength As Integer, ByRef vpbuffer As Byte) As Integer List 2-25 Visual Basic.NETGpibSendByte Declare Function GpibSend Lib "GPC43042.DLL" (ByVal ulboardno As Integer, ByVal lpadrstbl() As Integer, ByVal ulplength As Integer, ByVal vpbuffer() As Byte) As Integer List 2-26 Visual Basic.NETGpibSendString Declare Function GpibSend Lib "GPC43042.DLL" (ByVal ulboardno As Integer, ByVal lpadrstbl() As Integer, ByVal ulplength As Integer, ByVal vpbuffer As String) As Integer List 2-27 Visual Basic.NETGpibSendIntPtr Declare Function GpibSend Lib "GPC43042.DLL" (ByVal ulboardno As Integer, ByVal lpadrstbl() As Integer, ByVal ulplength As Integer, ByVal vpbuffer As IntPtr) As Integer GpibReceive GpibReceive IntPtr [] 4 GpibReceive Visual Basic.NET Interface Corporation

32 2-7 GpibReceive Byte Byte String IntPtr 1 List 2-28 Visual Basic 6.0GpibReceive Declare Function GpibReceive Lib "GPC43042.DLL" (ByVal ulboardno As Long, ByRef lpadrstbl As Long, ByRef ulplength As Long, ByVal vpbuffer As String) As Long List 2-29 Visual Basic.NETGpibReceiveByte Declare Function GpibReceive Lib "GPC43042.DLL" (ByVal ulboardno As Integer, ByVal lpadrstbl() As Integer, ByRef ulplength As Integer, ByRef vpbuffer As Byte) As Integer List 2-30 Visual Basic.NETGpibReceiveByte Declare Function GpibReceive Lib "GPC43042.DLL" (ByVal ulboardno As Integer, ByVal lpadrstbl() As Integer, ByRef ulplength As Integer, ByVal vpbuffer() As Byte) As Integer List 2-31 Visual Basic.NETGpibReceiveString Function GpibReceive(ByVal ulboardno As Integer, ByVal lpadrstbl() As Integer, ByRef ulplength As Integer, ByRef vpbuffer As String) As Integer Dim nlength As Integer Dim nret As Integer Dim e As ASCIIEncoding = New ASCIIEncoding() Dim szdata(ulplength - 1) As Byte vpbuffer = "" nlength = ulplength nret = GpibReceive(ulBoardNo, lpadrstbl, nlength, szdata) If (nret = 0) Then vpbuffer = e.getstring(szdata, 0, nlength) ulplength = vpbuffer.length End If GpibReceive = nret End Function Interface Corporation

33 StringGpibReceiveByte StringFunctionGpibReceive NULLByte List 2-32 Visual Basic.NETGpibReceiveIntPtr Declare Function GpibReceive Lib "GPC43042.DLL" (ByVal ulboardno As Integer, ByVal lpadrstbl() As Integer, ByRef ulplength As Integer, ByVal vpbuffer As IntPtr) As Integer GpibSetSrqEvent 2-5Any List2-33,2-34Visual Basic 6.0Visual Basic.NETGpibSetSrqEvent List 2-33 Visual Basic 6.0GpibSetSrqEvent Declare Function GpibSetSrqEvent Lib "GPC43042.DLL" (ByVal ulboardno As Long, ByVal lponsrqproc As Any, ByVal dwuser As Long) As Long List 2-34 Visual Basic.NETGpibSetSrqEvent Declare Function GpibSetSrqEvent Lib "GPC43042.DLL" (ByVal ulboardno As Integer, ByVal lponsrqproc As PLPSRQCALLBACK, ByVal dwuser As Integer) As Integer PLPSRQCALLBACK GpibSetSrqEventlpOnSrqProcSRQ Visual Basic.NETDLL PLPSRQCALLBACK Interface Corporation

34 List 2-35 Visual Basic.NETPLPSRQCALLBACK Delegate Sub PLPSRQCALLBACK(ByVal nboardno As Integer, ByVal dwuser As Integer) PLPSRQCALLBACK List 2-36 Visual Basic.NET PLPSRQCALLBACK Public osp As PLPSRQCALLBACK PLPSRQCALLBACK New AddressOf List 2-37 Visual Basic.NET PLPSRQCALLBACK osp = New PLPSRQCALLBACK(AddressOf lponsrqproc) nret = GpibSetSrqEvent(nBoardNo, osp, UserData) List 2-38 Visual Basic.NET lponsrqproc Sub lponsrqproc(byval dwboardno As Integer, ByVal dwuser As Integer) End Sub ' SRQ ' AnyDeclare As Any APIVisual Basic 6.0 APIGPC-4301Help DLL Interface Corporation

35 2.1.5 GPIB ボード (GPC-4301 高機能版 DLL) GPIBGPC-4301DLL Visual Basic.NETVisual Basic 6.0 Visual Basic 6.0 Visual Basic.NET GPC-4301 GPC4304.bas <> Interface GPC4301 include GPC4304.bas BPC-0818 GPC4301Ex.bas <> Interface BPC0818 GPC4301 include GPC4301Ex.vb Visual Basic 6.0Visual Basic.NET 2-8 (GPC4301 DLL) GPIB_SUCCESS_NOT_FOU ND_LISTENER Interface Corporation

36 PciGpibExMastSendData PciGpibExMastRecvData PciGpibExSlavSendData PciGpibExSlavRecvData PciGpibExSetSrqEvent Any Declare As Any delegate PLPSRQCALLBACK delegate PciGpibExSetSrqEvent Interface Corporation

37 2-8 List2-39,2-40Visual Basic 6.0Visual Basic.NET GPIB_SUCCESS_NOT_FOUND_LISTENER List 2-39 Visual Basic 6.0GPIB_SUCCESS_NOT_FOUND_LISTENER Public Const GPIB_SUCCESS_NOT_FOUND_LISTENER = 11 List 2-40 Visual Basic.NETGPIB_SUCCESS_NOT_FOUND_LISTENER Public Const GPIB_SUCCESS_NOT_FOUND_LISTENER As Integer = 11 Visual Basic 6.0 Visual Basic.NET Any Visual Basic.NET PciGpibExMastSendData PciGpibExMastSendData IntPtr Interface Corporation

38 [] 4 PciGpibExMastSendData Visual Basic.NET 2-9 PciGpibExMastSendData Byte Byte String IntPtr 1 List 2-41 Visual Basic 6.0PciGpibExMastSendData Declare Function PciGpibExMastSendData Lib "GPC4304.DLL" (ByVal nboardno As Long, ByRef npadrstbl As Long, ByVal dwlength As Long, ByVal pvbuffer As String, ByVal umsg As Long) As Long List 2-42 Visual Basic.NETPciGpibExMastSendDataByte Declare Function PciGpibExMastSendData Lib "GPC4304.DLL" (ByVal nboardno As Integer, ByVal npadrstbl() As Integer, ByVal dwlength As Integer, ByRef pvbuffer As Byte, ByVal umsg As Integer) As Integer List 2-43 Visual Basic.NETPciGpibExMastSendDataByte Declare Function PciGpibExMastSendData Lib "GPC4304.DLL" (ByVal nboardno As Integer, ByVal npadrstbl() As Integer, ByVal dwlength As Integer, ByVal pvbuffer() As Byte, ByVal umsg As Integer) As Integer List 2-44 Visual Basic.NETPciGpibExMastSendDataString Declare Function PciGpibExMastSendData Lib "GPC4304.DLL" (ByVal nboardno As Integer, ByVal npadrstbl() As Integer, ByVal dwlength As Integer, ByVal pvbuffer As String, ByVal umsg As Integer) As Integer List 2-45 Visual Basic.NETPciGpibExMastSendDataIntPtr Declare Function PciGpibExMastSendData Lib "GPC4304.DLL" (ByVal nboardno As Integer, ByVal npadrstbl() As Integer, ByVal dwlength As Integer, ByVal pvbuffer As IntPtr, ByVal umsg As Integer) As Integer Interface Corporation

39 PciGpibExMastRecvData PciGpibExMastRecvData IntPtr [] 4 PciGpibExMastRecvData Visual Basic.NET 2-10 PciGpibExMastRecvData Byte Byte String IntPtr 1 List 2-46 Visual Basic 6.0PciGpibExMastRecvData Declare Function PciGpibExMastRecvData Lib "GPC4304.DLL" (ByVal nboardno As Long, ByRef npadrstbl As Long, ByRef dwplength As Long, ByVal pvbuffer As String, ByVal umsg As Long) As Long List 2-47 Visual Basic.NETPciGpibExMastRecvData Byte Declare Function PciGpibExMastRecvData Lib "GPC4304.DLL" (ByVal nboardno As Integer, ByVal npadrstbl() As Integer, ByRef dwplength As Integer, ByRef pvbuffer As Byte, ByVal umsg As Integer) As Integer List 2-48 Visual Basic.NETPciGpibExMastRecvDataByte Declare Function PciGpibExMastRecvData Lib "GPC4304.DLL" (ByVal nboardno As Integer, ByVal npadrstbl() As Integer, ByRef dwplength As Integer, ByVal pvbuffer() As Byte, ByVal umsg As Integer) As Integer Interface Corporation

40 List 2-49 Visual Basic.NETPciGpibExMastRecvDataString Function PciGpibExMastRecvData(ByVal nboardno As Integer, ByVal npadrstbl() As Integer, ByRef dwplength As Integer, ByRef pvbuffer As String, ByVal umsg As Integer) As Integer Dim nlength As Integer Dim nret As Integer Dim e As ASCIIEncoding = New ASCIIEncoding() Dim szdata(dwplength - 1) As Byte pvbuffer = "" nlength = dwplength nret = PciGpibExMastRecvData(nBoardNo, npadrstbl, nlength, szdata, umsg) If (nret = 0) Then pvbuffer = e.getstring(szdata, 0, nlength) dwplength = pvbuffer.length End If PciGpibExMastRecvData = nret End Function StringPciGpibExMastRecvDataByte StringFunction PciGpibExMastRecvDataNULL Byte List 2-50 Visual Basic.NETPciGpibExMastRecvDataIntPtr Declare Function PciGpibExMastRecvData Lib "GPC4304.DLL" (ByVal nboardno As Integer, ByVal npadrstbl() As Integer, ByRef dwplength As Integer, ByVal pvbuffer As IntPtr, ByVal umsg As Integer) As Integer PciGpibExSlavSendDataPciGpibExSlavRecvData PciGpibExSlavSendDataPciGpibExSlavRecvData PciGpibExMastSendDataPciGpibExMastRecvData List 2-51 Visual Basic 6.0PciGpibExSlavSendData Declare Function PciGpibExSlavSendData Lib "GPC4304.DLL" (ByVal nboardno As Long, ByVal dwlength As Long, ByVal pvbuffer As String, ByVal umsg As Long) As Long List 2-52 Visual Basic.NETPciGpibExSlavSendData Byte Declare Function PciGpibExSlavSendData Lib "GPC4304.DLL" (ByVal nboardno As Integer, ByVal dwlength As Integer, ByRef pvbuffer As Byte, ByVal umsg As Integer) As Integer Interface Corporation

41 List 2-53 Visual Basic.NETPciGpibExSlavSendData Byte Declare Function PciGpibExSlavSendData Lib "GPC4304.DLL" (ByVal nboardno As Integer, ByVal dwlength As Integer, ByVal pvbuffer() As Byte, ByVal umsg As Integer) As Integer List 2-54 Visual Basic.NETPciGpibExSlavSendData String Declare Function PciGpibExSlavSendData Lib "GPC4304.DLL" (ByVal nboardno As Integer, ByVal dwlength As Integer, ByVal pvbuffer As String, ByVal umsg As Integer) As Integer List 2-55 Visual Basic.NETPciGpibExSlavSendData IntPtr Declare Function PciGpibExSlavSendData Lib "GPC4304.DLL" (ByVal nboardno As Integer, ByVal dwlength As Integer, ByVal pvbuffer As IntPtr, ByVal umsg As Integer) As Integer List 2-56 Visual Basic 6.0PciGpibExSlavRecvData Declare Function PciGpibExSlavRecvData Lib "GPC4304.DLL" (ByVal nboardno As Long, ByRef dwplength As Long, ByVal pvbuffer As String, ByVal umsg As Long) As Long List 2-57 Visual Basic.NETPciGpibExSlavRecvData Byte Declare Function PciGpibExSlavRecvData Lib "GPC4304.DLL" (ByVal nboardno As Integer, ByRef dwplength As Integer, ByRef pvbuffer As Byte, ByVal umsg As Integer) As Integer List 2-58 Visual Basic.NETPciGpibExSlavRecvData Byte Declare Function PciGpibExSlavRecvData Lib "GPC4304.DLL" (ByVal nboardno As Integer, ByRef dwplength As Integer, ByVal pvbuffer() As Byte, ByVal umsg As Integer) As Integer Interface Corporation

42 List 2-59 Visual Basic.NETPciGpibExSlavRecvData String Function PciGpibExSlavRecvData(ByVal nboardno As Integer, ByRef dwplength As Integer, ByRef pvbuffer As String, ByVal umsg As Integer) As Integer Dim nlength As Integer Dim nret As Integer Dim e As ASCIIEncoding = New ASCIIEncoding() Dim szdata(dwplength - 1) As Byte pvbuffer = "" nlength = dwplength nret = PciGpibExSlavRecvData(nBoardNo, nlength, szdata, umsg) If (nret = 0) Then pvbuffer = e.getstring(szdata, 0, nlength) dwplength = pvbuffer.length End If PciGpibExSlavRecvData = nret End Function List 2-60 Visual Basic.NETPciGpibExSlavRecvData IntPtr Declare Function PciGpibExSlavRecvData Lib "GPC4304.DLL" (ByVal nboardno As Integer, ByRef dwplength As Integer, ByVal pvbuffer As IntPtr, ByVal umsg As Integer) As Integer PciGpibExSetSrqEvent 2-8Any List2-61,2-62Visual Basic 6.0Visual Basic.NETPciGpibExSetSrqEvent List 2-61 Visual Basic 6.0PciGpibExSetSrqEvent Declare Function PciGpibExSetSrqEvent Lib "GPC4304.DLL" (ByVal nboardno As Long, ByVal lponsrqproc As Long, ByVal dwuser As Long) As Long List 2-62 Visual Basic.NETPciGpibExSetSrqEvent Declare Function PciGpibExSetSrqEvent Lib "GPC4304.DLL" (ByVal ulboardno As Integer, ByVal lponsrqproc As PLPSRQCALLBACK, ByVal dwuser As Integer) As Integer PLPSRQCALLBACK PciGpibExSetSrqEventlpOnSrqProcSRQ Visual Basic.NET Interface Corporation

43 PLPSRQCALLBACK PLPSRQCALLBACK List 2-63 Visual Basic.NETPLPSRQCALLBACK Public Delegate Sub PLPSRQCALLBACK(ByVal nboardno As Integer, ByVal dwuser As Integer) PLPSRQCALLBACK List 2-64 Visual Basic.NET PLPSRQCALLBACK Public osp As PLPSRQCALLBACK List 2-65 Visual Basic.NET PLPSRQCALLBACK osp = New PLPSRQCALLBACK(AddressOf lponsrqproc) nret = PciGpibExSetSrqEvent(nBoardNo, osp, &H55) List 2-66 Visual Basic.NET lponsrqproc Sub lponsrqproc(byval dwboardno As Integer, ByVal dwuser As Integer) ' SRQ ' End Sub AnyDeclare As Any APIVisual Basic 6.0 APIGPC-4301Help DLL Interface Corporation

44 2.2 サンプルプログラム デジタル入出力 (1 点入力 1 点出力 ) (PCI-2994CV) GPC-2000 (Visual Basic 6.0) Visual Basic.NET Visual BasicDIO PCI-2994CV Visual Basic GPC-2000 Inpoint.vbp <> Interface GPC2000 samples vb Inpoint Visual Basic.NET 1 BPC-0818 Inpoint.vbproj <> Interface BPC0818 GPC2000 samples vb Inpoint Visual Basic GPC-2000 Outpoint.vbp <> Interface GPC2000 samples vb Outpoint Visual Basic.NET 1 BPC-0818 Outpoint.vbproj <> Interface BPC0818 GPC2000 samples vb Outpoint Visual Basic 6.0Visual Basic.NET Interface Corporation

45 2-11 Visual Basic 6.0Visual Basic.NET Visual Basic 6.0 Visual Basic.NET OVERLAPPED Module1.frm Module1.vb List2-67 List Visual Studio.NET Visual Basic 6.0Visual Basic.NET List 2-67 Visual Basic 6.0Module.frm Type OVERLAPPED Internal As Long InternalHigh As Long offset As Long OffsetHigh As Long hevent As Long End Type Type SECURITY_ATTRIBUTES nlength As Long lpsecuritydescriptor As Long binherithandle As Long End Type Interface Corporation

46 List 2-68 Visual Basic.NETModule.vb Option Strict Off Option Explicit On Imports System.Runtime.InteropServices Module Module1 <StructLayOut(LayoutKind.Sequential)> Structure OVERLAPPED Dim Internal As Integer Dim InternalHigh As Integer Dim offset As Integer Dim OffsetHigh As Integer Dim hevent As Integer End Structure <StructLayout(LayoutKind.Sequential)> Structure SECURITY_ATTRIBUTES Dim nlength As Integer Dim lpsecuritydescriptor As Integer Dim binherithandle As Integer End Structure Visual Basic 6.0Visual Basic.NET Interface Corporation

47 2.2.2 アナログ入力 (AD ボードによるサンプリング ) AD (PCI-3133) GPC-3100 (Visual Basic 6.0 ) Visual Basic.NET Visual BasicAD PCI-3133 Visual Basic 6.0 AD GPC-3100 AdSmpl_B.vbp <> Interface GPC3100 samples vb Ad_Smpl_B Visual Basic.NET AD BPC-0818 AdSmpl_B.vbproj <> Interface BPC0818 GPC3100 samples vb Ad_Smpl_B Visual Basic 6.0Visual Basic.NET Interface Corporation

48 2-12 Visual Basic 6.0Visual Basic.NET Visual Basic 6.0 Visual Basic.NET gconfig Module1.frm Module1.vb List2-69,2-71 List2-70, Visual Studio.NET Visual Basic 6.0Visual Basic.NET List 2-69 Visual Basic 6.0Module1.bas Public gconfig As ADSMPLREQ List 2-70 Visual Basic.NETModule1.vb Public gconfig As ADSMPLREQ = New ADSMPLREQ(0) (Nothing) List 2-71 Visual Basic 6.0ADSMPLREQ Public gconfig As ADSMPLREQ gconfig.smplchreq(0).ulchno =... gconfig.smplchreq(0).ulrange = = gconfig.smplchreq(0).ulchno... = gconfig.smplchreq(0).ulrange Interface Corporation

49 List 2-72 Visual Basic.NETADSMPLREQ Public gconfig As New ADSMPLREQ(0) gconfig.setchno(0,...) gconfig.setchrange(0,...)... = gconfig.getchno(0)... = gconfig.getchrange(0) Visual Basic 6.0Visual Basic.NET アナログ出力 (DA ボードによる出力更新 ) DA (PCI-3329) DA GPC-3300 (Visual Basic 6.0) Visual Basic.NET Visual BasicDA PCI-3329 Visual Basic 6.0 DA GPC-3300 DaSmpl_B.vbp <> Interface GPC3300 samples vb Da_Smpl_B Visual Basic.NET DA BPC-0818 DaSmpl_B.vbproj <> Interface BPC0818 GPC3300 samples vb Da_Smpl_B Interface Corporation

50 Visual Basic 6.0Visual Basic.NET 2-13 Visual Basic 6.0Visual Basic.NET Visual Basic 6.0 Visual Basic.NET gconfig Module1.frm Module1.vb List2-73,2-75 List2-74, Visual Studio.NET Visual Basic 6.0Visual Basic.NET List 2-73 Visual Basic 6.0Module1.bas Public gconfig As DASMPLREQ List 2-74 Visual Basic.NETModule1.vb Public gconfig As DASMPLREQ = New DASMPLREQ(0) (Nothing) Interface Corporation

51 List 2-75 Visual Basic 6.0DASMPLREQ Public gconfig As DASMPLREQ gconfig.smplchreq(0).ulchno =... gconfig.smplchreq(0).ulrange = = gconfig.smplchreq(0).ulchno... = gconfig.smplchreq(0).ulrange List 2-76 Visual Basic.NETDASMPLREQ Public gconfig As New DASMPLREQ(0) gconfig.setchno(0,...) gconfig.setchrange(0,...)... = gconfig.getchno(0)... = gconfig.getchrange(0) Visual Basic 6.0Visual Basic.NET GPIB 機器制御 ( 標準版 DLL を使用した制御 ) GPIB (PCI-4302) GPIBGPC-4301 (Visual Basic 6.0) Visual Basic.NET GPIB Interface Corporation

52 PCI-4302 GPIB CAB-2220 GPIB Agilent Technologies HP 34401A Visual Basic 6.0 GPIB GPC-4301 Ctrl_B2.vbp <> Interface GPC4301 Smpl_DllStandard vb Ctrl_B2 Visual Basic.NET GPIB BPC-0818 Ctrl_B2.vbproj <> Interface BPC0818 GPC4301 samples_std vb Ctrl_B2 Visual Basic 6.0Visual Basic.NET 2-14 Visual Basic 6.0Visual Basic.NET Visual Basic 6.0 Visual Basic.NET SetPrmRecvBufferGpibSend GpibReceive Ctrl_B2.bas CtrlSendForm.frm CtrlRecvForm.frm Ctrl_B2.vb CtrlSendForm.vb CtrlRecvForm.vb List2-77,2-78,2-79 List2-78,2-80, Visual Studio.NET Visual Basic 6.0Visual Basic.NET Interface Corporation

53 StringVisual Basic.NET List 2-77 Visual Basic 6.0Ctrl_B2.bas Public SetPrm As String * 128 Public RecvBuffer As String * 32 ' ' List 2-78 Visual Basic.NETCtrl_B2.vb Public SetPrm As String ' Public RecvBuffer As String ' StringGpibSend Visual Basic.NET TextBoxTextBoxTblTextBox For List 2-79 Visual Basic 6.0CtrlSendForm.frm Private Sub CmdSend_Click() Dim nret As Long Dim szdata As String Dim nlen As Long Dim i As Long ' DevAdrsTbl(0) = DevAdrs DevAdrsTbl(1) = -1 ' For i = 1 To 5 szdata = TxtSendData(i).Text szdata = StrConv(szData, vbfromunicode) nlen = LenB(szData) If nlen = 0 Then Exit For szdata = StrConv(szData, vbunicode) nret = GpibSend(nBoardNo, DevAdrsTbl(0), nlen, szdata) If nret Then Exit For Next Call DsplyErrMessage(nRet) End Sub Interface Corporation

54 List 2-80 Visual Basic.NETCtrlSendForm.vb Private Sub CmdSend_Click(ByVal eventsender As System.Object, ByVal eventargs As System.EventArgs) Handles CmdSend.Click Dim nret As Integer Dim szdata As String Dim nlen As Integer Dim i As Integer Dim TextBoxTbl() As TextBox = New TextBox() {TextBox1, TextBox2, TextBox3, TextBox4, TextBox5} ' DevAdrsTbl(0) = DevAdrs DevAdrsTbl(1) = -1 ' For i = 0 To (TextBoxTbl.Length - 1) szdata = TextBoxTbl(i).Text nlen = szdata.length If nlen <> 0 Then nret = GpibSend(nBoardNo, DevAdrsTbl, nlen, szdata) If nret Then Exit For End If End If Next Call DsplyErrMessage(nRet) End Sub StringGpibReceive GpibReceive2 GpibReceive4String 2Byte StringGPC4301Std.vb GpibReceive Interface Corporation

55 List 2-81 Visual Basic 6.0CtrlRecvForm.frm Private Sub CmdRecv_Click() Dim nret As Long Dim nlen As Long ' DevAdrsTbl(0) = DevAdrs DevAdrsTbl(1) = -1 ' Dim RecvLen As Long RecvLen = 64 nret = GpibReceive(nBoardNo, DevAdrsTbl, RecvLen, RecvBuffer) If nret Then Call DsplyErrMessage(nRet) Unload CtrlRecvForm End If Call DsplyErrMessage(nRet) LblRecvData.Caption = Left(RecvBuffer, RecvLen) End Sub List 2-82 Visual Basic.NETCtrlRecvForm.vb Private Sub CmdRecv_Click(ByVal eventsender As System.Object, ByVal eventargs As System.EventArgs) Handles CmdRecv.Click Dim nret As Integer Dim nlen As Integer ' DevAdrsTbl(0) = DevAdrs DevAdrsTbl(1) = -1 ' Dim RecvLen As Integer RecvLen = 64 nret = GpibReceive(nBoardNo, DevAdrsTbl, RecvLen, RecvBuffer) If nret Then Call DsplyErrMessage(nRet) CtrlRecvForm.DefInstance.Close() End If Call DsplyErrMessage(nRet) LblRecvData.Text = RecvBuffer End Sub Visual Basic 6.0Visual Basic.NET Interface Corporation

56 2.2.5 GPIB 機器制御 ( 高機能版 DLL を使用した制御 ) GPIB (PCI-4302) GPIBGPC-4301 (Visual Basic 6.0) Visual Basic.NET GPIB PCI-4302 GPIB CAB-2220 GPIB Agilent Technologies HP 34401A Visual Basic 6.0 GPC-4301 Ctrl_B.vbp <> Interface GPC4301 samples vb Ctrl_B Visual Basic.NET BPC-0818 Ctrl_B.vbproj <> Interface BPC0818 GPC4301 samples_adv Ctrl_B Interface Corporation

57 Visual Basic 6.0Visual Basic.NET 2-15 Visual Basic 6.0Visual Basic.NET Visual Basic 6.0 Visual Basic.NET SetPrmRecvBufferPciGpibExMastSendData PciGpibExMastRecvData Ctrl_B.bas CtrlSendForm.frm CtrlRecvForm.frm Ctrl_B.vb CtrlSendForm.vb CtrlRecvForm.vb List2-83,2-85,2-87 List2-84,2-86, Visual Studio.NET Visual Basic 6.0Visual Basic.NET StringVisual Basic.NET List 2-83 Visual Basic 6.0Ctrl_B.bas Public SetPrm As String * 128 ' Parameter Public RecvBuffer As String * 32 ' Receive buffer List 2-84 Visual Basic.NETCtrl_B.vb Public SetPrm As String ' Parameter Public RecvBuffer As String ' Receive buffer Interface Corporation

58 StringPciGpibExMastSendData Visual Basic.NET TextBoxTextBoxTblTextBox For List 2-85 Visual Basic 6.0CtrlSendForm.frm Private Sub CmdSend_Click() Dim nret As Long Dim szdata As String Dim nlen As Long Dim i As Long ' Configures the device address table. DevAdrsTbl(0) = DevAdrs DevAdrsTbl(1) = -1 ' Sends data to specified device. For i = 1 To 5 szdata = TxtSendData(i).Text szdata = StrConv(szData, vbfromunicode) nlen = LenB(szData) If nlen = 0 Then Exit For szdata = StrConv(szData, vbunicode) nret = PciGpibExMastSendData(nBoardNo, DevAdrsTbl(0), nlen, szdata, 0) If nret Then Exit For Next Call DsplyErrMessage(nRet) End Sub Interface Corporation

59 List 2-86 Visual Basic.NETCtrlSendForm.vb Private Sub CmdSend_Click(ByVal eventsender As System.Object, ByVal eventargs As System.EventArgs) Handles CmdSend.Click Dim nret As Integer Dim szdata As String Dim nlen As Integer Dim i As Integer Dim TextBoxTbl() As TextBox = New TextBox() {TextBox1, TextBox2, TextBox3, TextBox4, TextBox5} ' Configures the device address table. DevAdrsTbl(0) = DevAdrs DevAdrsTbl(1) = -1 ' Sends data to specified device. For i = 0 To (TextBoxTbl.Length - 1) szdata = TextBoxTbl(i).Text nlen = szdata.length If nlen <> 0 Then nret = PciGpibExMastSendData(nBoardNo, DevAdrsTbl, nlen, szdata, 0) If nret Then Exit For End If End If Next Call DsplyErrMessage(nRet) End Sub StringPciGpibExMastRecvData PciGpibExMastRecvData2 PciGpibExMastRecvData4String 2Byte StringGPC4301Ex.vb PciGpibExMastRecvData Interface Corporation

60 List 2-87 Visual Basic 6.0CtrlRecvForm.frm Private Sub CmdRecv_Click() Dim nret As Long Dim nlen As Long ' Configures the device address table. DevAdrsTbl(0) = DevAdrs DevAdrsTbl(1) = -1 ' Sends data to specified device. Dim RecvLen As Long RecvLen = 64 nret = PciGpibExMastRecvData(nBoardNo, DevAdrsTbl(0), RecvLen, RecvBuffer, 0) If nret Then Call DsplyErrMessage(nRet) Unload CtrlRecvForm End If Call DsplyErrMessage(nRet) LblRecvData.Caption = Left(RecvBuffer, RecvLen) End Sub List 2-88 Visual Basic.NETCtrlRecvForm.vb Private Sub CmdRecv_Click(ByVal eventsender As System.Object, ByVal eventargs As System.EventArgs) Handles CmdRecv.Click Dim nret As Integer Dim nlen As Integer ' Configures the device address table. DevAdrsTbl(0) = DevAdrs DevAdrsTbl(1) = -1 ' Sends data to specified device. Dim RecvLen As Integer RecvLen = 64 nret = PciGpibExMastRecvData(nBoardNo, DevAdrsTbl, RecvLen, RecvBuffer, 0) If nret Then Call DsplyErrMessage(nRet) CtrlRecvForm.DefInstance.Close() End If Call DsplyErrMessage(nRet) LblRecvData.Text = RecvBuffer End Sub Visual Basic 6.0Visual Basic.NET Ctrl_BGPIBGPC-4301 BPC Interface Corporation

61 Visual Basic 6.0Visual Basic.NET Visual Basic 6.0 YOKOGAWA7561, HP3458A GPC-4301 Device_B.vbp <> Interface GPC4301 samples vb Device_B Visual Basic.NET YOKOGAWA7561, HP3458A BPC-0818 Device_B.vbproj <> Interface BPC0818 GPC4301 samples_adv vb Device_B Visual Basic 6.0 GPC-4301 Binary_B.vbp <> Interface GPC4301 samples vb Binary_B Visual Basic.NET BPC-0818 Binary_B.vbproj <> Interface BPC0818 GPC4301 samples_adv vb Binary_B Visual Basic 6.0 GPC-4301 Async_B.vbp <> Interface GPC4301 samples vb Async_B Visual Basic.NET BPC-0818 Async_B.vbproj <> Interface BPC0818 GPC4301 samples_adv vb Async_B Interface Corporation

62 2.3 アップグレードウィザード Visual Studio.NETVisual Basic 6.0Visual Basic.NET Visual Basic.NET Visual Basic.NET Visual Basic 6.0Visual Basic.NET アップグレード手順 1.Visual Studio.NET 2.--(.vbp) Interface Corporation

63 Visual Basic 6.0 Visual Basic 6.0Visual Basic _UpgradeReport.htm Interface Corporation

64 2-7 Visual Basic Visual Basic 4.0Visual Studio.NET Visual Basic Visual BasicVisual C#.NETStandard Edition DLL.NET Framework Visual Basic Interface Corporation

65 Visual Basic 6.0 MicrosoftMSDN アップグレードウィザードのエラー Visual Basic 6.0 Visual Basic Visual Basic Interface Corporation

66 COMCTRL32.OCXDBCRID32.OCX Microsoft Windows Common Controls 5.0(SP2) Microsoft Data Bound Grid Control 5.0(SP3) 3.OK Visual Basic 6.0 Visual Studio.NET Interface Corporation

67 第 3 章 Visual C#.NET への移行 BPC-0818C# Visual C#.NET Visual Basic.NET Visual Basic.NET MSDN C#DLL C# BPC-0818 BPC クラスライブラリ BPC DLL GPC-2000 IFCDIOIFCDIO.DLL GPC-3100 IFCADIFCAD.DLL GPC-3300 IFCDAIFCDA.DLL GPIBGPC-4301 DLL IFCGPIBIFCGPIB.DLL GPIBGPC-4301 DLL IFCGPIBEXIFCGPIBEX.DLL Interface Corporation

68 3.2 クラスライブラリの参照設定 C# 1.Visual Studio.NET Visual C# Windows OK Interface Corporation

69 DLL BPC-0818DLL DLL 3-2 GPC-2000 GPC-3100 GPC-3300 GPIB GPC-4301 GPIB GPC-4301 DLL Interface BPC0818 GPC2000 CLASS DLL IFCDIO.DLL Interface BPC0818 GPC3100 CLASS DLL IFCAD.DLL Interface BPC0818 GPC3300 CLASS DLL IFCDA.DLL Interface BPC0818 GPC4301 CLASS DLL IFCGPIB.DLL Interface BPC0818 GPC4301 CLASS DLL IFCGPIBEX.DLL DLL OK Interface Corporation

70 3-3 DLL 6. DLL 3-4 C# Interface Corporation

71 3.3 クラスライブラリの関数を呼び出す BPC namespace GPC-2000 InterfaceCorpDllWrap IFCDIO GPC-3100 InterfaceCorpDllWrap IFCAD GPC-3300 InterfaceCorpDllWrap IFCDA GPC-4301DLL InterfaceCorpDllWrap IFCGPIB GPC-4301DLL InterfaceCorpDllWrap IFCGPIBEX using BPC-0818InterfaceCorpDllWrap List 3-1 using InterfaceCorpDllWrap;. List 3-2 GPC-2000 InputPoint IFCDIO.DioInputPoint(hSavedDevice,out nbuffer,dwstartnum,1); List 3-3 GPC-3100 AdInputAD IFCAD.AdInputAD(ghDeviceHandle,ulCh, gconfig.ulsinglediff, SmplChInf, wsmpdata); List 3-4 GPC-3300 DaOutputDA IFCDA.DaOutputDA(ghDeviceHandle, ulch, SmplChInf, wdata); List 3-5 GPC-4301 DLL GpibReceive IFCGPIB.GpibReceive(nBoardNo, DevAdrsTbl, ref RecvLen, out RecvBuffer); List 3-6 GPC-4301 DLL PciGpibExMastRecvData IFCGPIBEX.PciGpibExMastRecvData(nBoardNo, DevAdrsTbl, ref RecvLen, out RecvBuffer, 0); GPC GPC Interface Corporation

72 . List 3-7 GPC-2000 IFCDIO.FBIDIO_ERROR_SUCCESS List 3-8 GPC-3100 IFCAD.ADSMPLCHREQ[ ] SmplChInf = new IFCAD.ADSMPLCHREQ[2]; List 3-9 GPC-3100 IFCAD.AD_ERROR_SUCCESS List 3-10 GPC-3300 IFCDA.DASMPLCHREQ[ ] SmplChInf = new IFCDA.DASMPLCHREQ[2]; List 3-11 GPC-3300 IFCDA.DA_ERROR_SUCCESS List 3-12 GPC-4301DLL IFCGPIB.GPIB_SUCCESS List 3-13 GPC-4301DLL IFCGPIBEX.GPIB_SUCCESS Interface Corporation

73 1 List 3-14 GPC-2000DioInputPoint InpointInBox.cs using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using InterfaceCorpDllWrap; namespace InPoint { public class InBox : System.Windows.Forms.Form { private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private void button1_click(object sender, System.EventArgs e) { int nret; int nbuffer; uint dwstartnum; } nret = IFCDIO.DioInputPoint(hSavedDevice,out nbuffer,dwstartnum,1); if (nret!= IFCDIO.FBIDIO_ERROR_SUCCESS) { MessageBox.Show("Failed to input the data.", "InPoint_Cs",MessageBoxButtons.OK,MessageBoxIcon.Error); } } } Interface Corporation

74 List 3-15 GPC-3100AdInputAD AdSmpl_CsSamplingForm.cs using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using InterfaceCorpDllWrap; namespace AdSmpl_Cs { public class SamplingForm : System.Windows.Forms.Form { private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private void button1_click(object sender, System.EventArgs e) { uint[ ] ghchannel = new uint[2]; IFCAD.ADSMPLCHREQ[ ] SmplChInf = new IFCAD.ADSMPLCHREQ[2]; byte[ ] bsmpdata = new byte[2]; ushort[ ] wsmpdata = new ushort[2]; gnerrcode = IFCAD.AdInputAD(ghDeviceHandle, ulch, gconfig.ulsinglediff, SmplChInf, wsmpdata); if (gnerrcode == IFCAD.AD_ERROR_SUCCESS) { } } } } Interface Corporation

75 List 3-16 GPC-3300DAOutputDA DaSmpl_CsSamplingForm.cs using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using InterfaceCorpDllWrap; namespace DaSmpl_Cs { public class SamplingForm : System.Windows.Forms.Form { private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private void buttonstart_click(object sender, System.EventArgs e) { uint[ ] ghchannel = new uint[2]; IFCDA.DASMPLCHREQ[ ] SmplChInf = new IFCDA.DASMPLCHREQ[2]; ushort[ ] wdata = new ushort[2]; uint ulch; } // Output one analog data on the board. gnerrcode = IFCDA.DaOutputDA(ghDeviceHandle, ulch, SmplChInf, wdata); if (gnerrcode!= IFCDA.DA_ERROR_SUCCESS) { } } } Interface Corporation

76 List 3-17 GPC-4301 DLLGpibReceive Ctrl_Cs2ReceiveForm.cs using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using InterfaceCorpDllWrap; namespace Ctrl_Cs2 { public class ReceiveForm : System.Windows.Forms.Form { private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox textboxdata; private void buttonreceive_click(object sender, System.EventArgs e) { int nret; string RecvBuffer = ""; int[ ] DevAdrsTbl = new int [2]; uint RecvLen; // DevAdrsTbl[0] = DevAdrs; DevAdrsTbl[1] = -1; // RecvLen = 64; nret = IFCGPIB.GpibReceive(nBoardNo, DevAdrsTbl, ref RecvLen, out RecvBuffer); if(nret!= 0) { CtrlCs2Form.DsplyErrMessage(nRet); return; } } CtrlCs2Form.DsplyErrMessage(nRet); textboxdata.text = RecvBuffer; } } Interface Corporation

77 List 3-18 GPC-4301 DLLPciGpibExMastRecvData Ctrl_CsReceiveForm.cs using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using InterfaceCorpDllWrap; namespace Ctrl_Cs { public class ReceiveForm : System.Windows.Forms.Form { private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox textboxdata; private void buttonreceive_click(object sender, System.EventArgs e) { int nret; string RecvBuffer = ""; uint RecvLen; int[ ] DevAdrsTbl = new int[2]; // Configures the device address table. DevAdrsTbl[0] = DevAdrs; DevAdrsTbl[1] = -1; } // Sends data to specified device. RecvLen = 64; nret = IFCGPIBEX.PciGpibExMastRecvData(nBoardNo, DevAdrsTbl, ref RecvLen, out RecvBuffer, 0); CtrlCsForm.DsplyErrMessage(nRet); if(nret!= 0) { return; } textboxdata.text = RecvBuffer; } } Interface Corporation

78 3.4 クラスライブラリのソースファイル BPC GPC-2000 GPC-3100 GPC-3300 GPIB GPC-4301 DLL GPIB GPC-4301 DLL Interface BPC0818 GPC2000 CLASS IFCDIO Interface BPC0818 GPC3100 CLASS IFCAD Interface BPC0818 GPC3300 CLASS IFCDA Interface BPC0818 GPC4301 CLASS IFCGPIB Interface BPC0818 GPC4301 CLASS IFCGPIBEX Visual Studio.NET-- C#.csproj 3.5 カテゴリ別プログラム作成方法 BPC-0818 using Interface Corporation

79 3.5.1 GPC-2000 List 3-19 DioOpen [DllImport("fbidio.dll")] public static extern uint DioOpen( string lpszname, uint fdwflags ); List 3-20 DioOpen uint hdevice; hdevice = IFCDIO.DioOpen( FBIDIO1,IFCDIO.FBIDIO_FLAG_SHARE); 1 DioInputPointint int2 intint List 3-21 DioInputPoint [DllImport("fbidio.dll")] public static extern int DioInputPoint( uint hdevice, out int pbuffer, uint dwstartnum, uint dwnum ); [DllImport("fbidio.dll")] public static extern int DioInputPoint( uint hdevice, int[ ] pbuffer, uint dwstartnum, uint dwnum ); List 3-22 DioInputPoint1 int nret; int nbuffer; nret = IFCDIO.DioInputPoint(hDevice,out nbuffer,1,1); List 3-23 DioInputPoint int nret; int[ ] nbuffer = new int[64]; nret = IFCDIO.DioInputPoint(hDevice,nBuffer,1,64); List 3-24 DioClose [DllImport("fbidio.dll")] public static extern int DioClose( uint hdevice ); Interface Corporation

80 List 3-25 DioClose int nret; nret = IFCDIO.DioClose(hDevice); GPC-3100 ADSMPLREQ ADSMPLREQ SetChNo GetChNoSetRangeNoGetRangeNo InitializeArray List 3-26 ADSMPLREQ [StructLayout(LayoutKind.Sequential)] public struct ADSMPLREQ { public uint ulchcount; [MarshalAs(UnmanagedType.ByValArray, SizeConst=512)] public uint[ ] ulchnorange; public uint ulsamplingmode; public uint ulsinglediff; public uint ulsmplnum; public uint ulsmpleventnum; public float fsmplfreq; public uint ultrigpoint; public uint ultrigmode; public int ltrigdelay; public uint ultrigch; public float ftriglevel1; public float ftriglevel2; public uint uleclkedge; public uint ulatrgpulse; public uint ultrigedge; public uint ultrigdi; public uint ulfastmode; public void InitializeArray() Interface Corporation

81 { } ulchnorange = new uint [512]; public void SetChNo(uint ulindex, uint ulnumber) { ulchnorange[ulindex * 2] = ulnumber; } public uint GetChNo(uint ulindex) { return(ulchnorange[ulindex * 2]); } public void SetChRange(uint ulindex, uint ulrange) { ulchnorange[(ulindex * 2) + 1] = ulrange; } public uint GetChRange(uint ulindex) { return(ulchnorange[(ulindex * 2) + 1]); } } ADSMPLREQInitializeArray List 3-27 ADSMPLREQ ADSMPLREQ gconfig; gconfig.initializearray(); List 3-28 AdOpen [DllImport("fbiad.dll")] public static extern uint AdOpen(string szname); List 3-29 AdOpen uint hdevice; hdevice = IFCAD.AdOpen( FBIAD1 ); 1 AdInputADByte ushortuint Interface Corporation

82 Visual C#.NET List 3-30 AdInputAD [DllImport("fbiad.dll")] public static extern int AdInputAD(uint hdevice, uint ulch, uint ulsinglediff, ref ADSMPLCHREQ AdSmplChReq, out byte lpdata); [DllImport("fbiad.dll")] public static extern int AdInputAD(uint hdevice, uint ulch, uint ulsinglediff, ref ADSMPLCHREQ AdSmplChReq, out ushort lpdata); [DllImport("fbiad.dll")] public static extern int AdInputAD(uint hdevice, uint ulch, uint ulsinglediff, ref ADSMPLCHREQ AdSmplChReq, out uint lpdata); [DllImport("fbiad.dll")] public static extern int AdInputAD(uint hdevice, uint ulch, uint ulsinglediff, ADSMPLCHREQ[ ] AdSmplChReq, byte[ ] lpdata); [DllImport("fbiad.dll")] public static extern int AdInputAD(uint hdevice, uint ulch, uint ulsinglediff, ADSMPLCHREQ[ ] AdSmplChReq, ushort[ ] lpdata); [DllImport("fbiad.dll")] public static extern int AdInputAD(uint hdevice, uint ulch, uint ulsinglediff, ADSMPLCHREQ[ ] AdSmplChReq, uint[ ] lpdata); List 3-31 AdInputAD uint[ ] ghchannel = new uint[2]; IFCAD.ADSMPLCHREQ[ ] SmplChInf = new IFCAD.ADSMPLCHREQ[2]; ushort[ ] wsmpdata = new ushort[2]; uint ulch; int nerrcode = -1; nerrcode = IFCAD.AdInputAD(hDevice, ulch, gconfig.ulsinglediff, SmplChInf, wsmpdata); List 3-32AdClose [DllImport("fbiad.dll")] public static extern int AdClose(uint hdevice); List 3-33 AdClose uint nret; nret = IFCAD.AdClose(hDevice); Interface Corporation

83 3.5.3 GPC-3300 DASMPLREQ DASMPLREQ SetChNo GetChNoSetRangeNoGetRangeNo InitializeArray List 3-34 DASMPLREQ [StructLayout(LayoutKind.Sequential)] public struct DASMPLREQ { public uint ulchcount; [MarshalAs(UnmanagedType.ByValArray, SizeConst=512)] public uint[ ] ulchnorange; public uint ulsamplingmode; public float fsmplfreq; public uint ulsmplrepeat; public uint ultrigmode; public uint ultrigpoint; public uint ultrigdelay; public uint uleclkedge; public uint ultrigedge; public uint ultrigdi; public void InitializeArray() { ulchnorange = new uint [512]; } public void SetChNo(uint ulindex, uint ulnumber) { ulchnorange[ulindex * 2] = ulnumber; } public uint GetChNo(uint ulindex) { return(ulchnorange[ulindex * 2]); Interface Corporation

84 } } public void SetChRange(uint ulindex, uint ulrange) { ulchnorange[(ulindex * 2) + 1] = ulrange; } public uint GetChRange(uint ulindex) { return(ulchnorange[(ulindex * 2) + 1]); } DASMPLREQInitializeArray List 3-35 DASMPLREQ DASMPLREQ gconfig; gconfig.initializearray(); List 3-36 DaOpen [DllImport("fbida.dll")] public static extern uint DaOpen(string szdevice); List 3-37 DaOpen uint hdevice; hdevice = IFCDA.DaOpen( FBIDA1 ); 1 DaOutputDA Byteushortuint Visual C#.NET Interface Corporation

85 List 3-38 DaOutputDA [DllImport("fbida.dll")] public static extern int DaOutputDA(uint hdevice, uint nch, ref DASMPLCHREQ DaSmplChReq, ref byte pdata); [DllImport("fbida.dll")] public static extern int DaOutputDA(uint hdevice, uint nch, ref DASMPLCHREQ DaSmplChReq, ref ushort pdata); [DllImport("fbida.dll")] public static extern int DaOutputDA(uint hdevice, uint nch, ref DASMPLCHREQ DaSmplChReq, ref uint pdata); [DllImport("fbida.dll")] public static extern int DaOutputDA(uint hdevice, uint nch, DASMPLCHREQ[ ] DaSmplChReq, byte[ ] pdata); [DllImport("fbida.dll")] public static extern int DaOutputDA(uint hdevice, uint nch, DASMPLCHREQ[ ] DaSmplChReq, ushort[ ] pdata); [DllImport("fbida.dll")] public static extern int DaOutputDA(uint hdevice, uint nch, DASMPLCHREQ[ ] DaSmplChReq, uint[ ] pdata); List 3-39 DaOutputDA uint[ ] ghchannel = new uint[2]; IFCDA.DASMPLCHREQ[ ] SmplChInf = new IFCDA.DASMPLCHREQ[2]; ushort[ ] wdata = new ushort[2]; uint ulch; int nerrcode = -1; nerrcode = IFCDA.DaOutputDA(hDevice, ulch, SmplChInf, wdata); List 3-40 DaClose [DllImport("fbida.dll")] public static extern int DaClose(uint hdevice); List 3-41 DaClose int nret; nret = IFCDA.DaClose(hDevice); Interface Corporation

86 3.5.4 GPC-4301 標準版 DLL List 3-42 GpibOpen [DllImport("gpc43042.dll")] public static extern int GpibOpen(uint ulboardno); List 3-43 GpibOpen int nret; nret = IFCGPIB.GpibOpen(1); GpibSetConfigGpibSetIfcGpibSetRen List 3-44 GpibSetConfigGpibSetIfcGpibSetRen [DllImport("gpc43042.dll")] public static extern int GpibSetConfig(uint ulboardno, string pparam); [DllImport("gpc43042.dll")] public static extern int GpibSetIfc(uint ulboardno); [DllImport("gpc43042.dll")] public static extern int GpibSetRen(uint ulboardno); List 3-45 GpibSetConfigGpibSetIfcGpibSetRen int nret; string szsetprm; // szsetprm = "/SRT=600 /TMO=600 /SDELIM=CRLF+EOI /RDELIM= CRLF+EOI ; nret = IFCGPIB.GpibSetConfig(1, szsetprm); if (nret!= 0) { return; } // IFC nret = IFCGPIB.GpibSetIfc(1); if (nret!= 0) { return; } // REN nret = IFCGPIB.GpibSetRen(1); if(nret!= 0) { Interface Corporation

87 } return; GpibSendByteByte StringIntPtr List 3-46 GpibSend [DllImport("gpc43042.dll")] public static extern int GpibSend(uint ulboardno, int[ ] lpadrstbl, uint dwlength, pvbuffer); ref byte [DllImport("gpc43042.dll")] public static extern int GpibSend(uint ulboardno, int[ ] lpadrstbl, uint dwlength, byte[ ] pvbuffer); [DllImport("gpc43042.dll")] public static extern int GpibSend(uint ulboardno, int[ ] lpadrstbl, uint dwlength, string pvbuffer); [DllImport("gpc43042.dll")] public static extern int GpibSend(uint ulboardno, int[ ] lpadrstbl, uint dwlength, IntPtr pvbuffer); List 3-47 GpibSendString int nret = 0; string szdata = "*RST"; uint ulen; int[ ] DevAdrsTbl = new int [2]; // DevAdrsTbl[0] = 22; DevAdrsTbl[1] = -1; // ulen = (uint)szdata.length; nret = IFCGPIB.GpibSend(1, DevAdrsTbl,uLen, szdata); GpibReceiveByteByte StringIntPtr StringGpibReceiveByteString Interface Corporation

88 List 3-48 GpibReceive [DllImport("gpc43042.dll")] public static extern int GpibReceive(uint ulboardno, int[ ] lpadrstbl, ref uint dwplength, ref byte pvbuffer); [DllImport("gpc43042.dll")] public static extern int GpibReceive(uint ulboardno, int[ ] lpadrstbl, ref uint dwplength, byte[ ] pvbuffer); public static int GpibReceive(uint ulboardno, int[ ] lpadrstbl, ref uint dwplength, ref string pvbuffer) { uint nlength = dwplength; int nret; ASCIIEncoding e = new ASCIIEncoding(); byte[ ] szdata= new byte [dwplength]; } pvbuffer = ""; nret = GpibReceive(ulBoardNo, lpadrstbl, ref nlength, szdata); if(nret == 0) { pvbuffer = e.getstring(szdata,0,(int)nlength); dwplength = (uint)pvbuffer.length; } return nret; [DllImport("gpc43042.dll")] public static extern int GpibReceive(uint ulboardno, int[ ] lpadrstbl, ref uint dwplength, IntPtr pvbuffer); List 3-49 GpibReceiveString int nret = 0; string RecvBuffer = ""; int[ ] DevAdrsTbl = new int [2]; uint RecvLen; // DevAdrsTbl[0] = 22; DevAdrsTbl[1] = -1; // RecvLen = 64; nret = IFCGPIB.GpibReceive(1, DevAdrsTbl, ref RecvLen, out RecvBuffer); if(nret!= 0) { return; } Interface Corporation

89 List 3-50 GpibClose [DllImport("gpc43042.dll")] public static extern int GpibClose(uint ulboardno); List 3-51 GpibClose int nret; nret = IFCGPIB.GpibClose(1); GPC-4301 高機能版 DLL List 3-52 PciGpibExInitBoard [DllImport("gpc4304.dll")] public static extern int PciGpibExInitBoard(int nboardno, uint hwnd); List 3-53 PciGpibExInitBoard int nret; nret = IFCGPIBEX.PciGpibExInitBoard(1, 0); PciGpibExSetConfigPciGpibExSetIfcPciGpibExSetRen List 3-54 PciGpibExSetConfigPciGpibExSetIfcPciGpibExSetRen [DllImport("gpc4304.dll")] public static extern int PciGpibExSetConfig(int nboardno, string szprm); [DllImport("gpc4304.dll")] public static extern int PciGpibExSetIfc(int nboardno, int ntime); [DllImport("gpc4304.dll")] public static extern int PciGpibExSetRen(int nboardno); Interface Corporation

90 List 3-55 PciGpibExSetConfigPciGpibExSetIfcPciGpibExSetRen int nret; string szsetprm; // szsetprm = "/STM=600 /SRT=600 /TMO=600 /SDELIM=CRLF+EOI /RDELIM=CRLF+EOI ; nret = IFCGPIBEX.PciGpibExSetConfig(1, szsetprm); if( nret!= 0) { return; } // IFC nret = IFCGPIBEX.PciGpibExSetIfc(1, 1); if( nret!= 0) { return; } // REN nret = IFCGPIBEX.PciGpibExSetRen(1); if( nret!= 0) { return; } PciGpibExMastSendData ByteByteStringIntPtr List 3-56 PciGpibExMastSendData [DllImport("gpc4304.dll")] public static extern int PciGpibExMastSendData(int nboardno, int[ ] npadrstbl, uint dwlength, ref byte pvbuffer, uint umsg); [DllImport("gpc4304.dll")] public static extern int PciGpibExMastSendData(int nboardno, int[ ] npadrstbl, uint dwlength, byte[ ] pvbuffer, uint umsg); [DllImport("gpc4304.dll")] public static extern int PciGpibExMastSendData(int nboardno, int[ ] npadrstbl, uint dwlength, string pvbuffer, uint umsg); [DllImport("gpc4304.dll")] public static extern int PciGpibExMastSendData(int nboardno, int[ ] npadrstbl, uint dwlength, IntPtr pvbuffer, uint umsg); Interface Corporation

91 List 3-57 PciGpibExMastSendDataString int nret = 0; string szdata = *RST ; uint ulen; int[ ] DevAdrsTbl = new int [2]; // Configures the device address table. DevAdrsTbl[0] = 22; DevAdrsTbl[1] = -1; // Sends data to specified device. ulen = (uint)szdata.length; nret = IFCGPIBEX.PciGpibExMastSendData(1, DevAdrsTbl, ulen, szdata, 0); PciGpibExMastRecvData ByteByteStringIntPtr StringGpibReceiveByteString List 3-58 PciGpibExMastRecvData [DllImport("gpc4304.dll")] public static extern int PciGpibExMastRecvData(int nboardno, int[ ] npadrstbl, ref uint dwplength, ref byte pvbuffer, uint umsg); [DllImport("gpc4304.dll")] public static extern int PciGpibExMastRecvData(int nboardno, int[ ] npadrstbl, ref uint dwplength, byte[ ] pvbuffer, uint umsg); public static int PciGpibExMastRecvData(int nboardno, int[ ] npadrstbl, ref uint dwplength, out string pvbuffer, uint umsg) { uint nlength = dwplength; int nret; ASCIIEncoding e = new ASCIIEncoding(); byte[ ] szdata= new byte [dwplength]; pvbuffer = ""; nret = PciGpibExMastRecvData(nBoardNo, npadrstbl, ref nlength, szdata, umsg); Interface Corporation

92 } if(nret == 0) { pvbuffer = e.getstring(szdata,0,(int)nlength); dwplength = (uint)pvbuffer.length; } return nret; [DllImport("gpc4304.dll")] public static extern int PciGpibExMastRecvData(int nboardno, int[ ] npadrstbl, ref uint dwplength, IntPtr pvbuffer, uint umsg); List 3-59 PciGpibExMastRecvDataString int nret = 0; string RecvBuffer = ""; uint RecvLen; int[ ] DevAdrsTbl = new int[2]; // DevAdrsTbl[0] = 22; DevAdrsTbl[1] = -1; // RecvLen = 64; nret = IFCGPIBEX.PciGpibExMastRecvData(1, DevAdrsTbl, ref RecvLen, out RecvBuffer, 0); CtrlCsForm.DsplyErrMessage(nRet); if(nret!= 0) { return; } List 3-60 PciGpibExFinishBoard [DllImport("gpc4304.dll")] public static extern int PciGpibExFinishBoard(int nboardno); List 3-61 PciGpibExFinishBoard int nret; nret = IFCGPIBEX.PciGpibExFinishBoard(nBoardNo); Interface Corporation

93 3.6 サンプルプログラム一覧 BPC-0818C# 3-5 GPC-2000 Inpoint 1 Outpoint 1 GPC-3100 AdSmpl_Cs GPC-3300 DaSmpl_Cs GPC-4301 Ctrl_Cs2 DLL GPC-4301 Ctrl_Cs DLL Device_Cs YOKOGAWA7561, HP3458A Manualop MultiDevice Visual Studio.NET-- C#.csproj Interface Corporation

94 第 4 章.NET 技術情報 4.1 DLL 呼び出しの概要 DLLVisual Studio.NET Visual Studio.NETDLL マネージコードとアンマネージコード Microsoft.NET Framework Visual Basic.NETVisual C#.NET.NET Framework COM ActiveX Win32 API DLL Visual Basic.NET Visual C#.NET Visual Basic 6.0.NET Framework DLL ActiveX Interface Corporation

95 4.1.2 プラットフォーム呼び出し DLLVisual Basic.NETVisual C#.NET Win32APIDLL DLL DLL DLL 4-2 Interface Corporation

96 4.2 DLL 関数呼び出し方法 DLL [Step1] DLLDLL [Step2] DLL [Step3] DLL DLL DLL [Step4]DLL DLL およびその DLL が提供する関数を識別するための情報 DLL DLL PCI/CompactPCI/CardBusWindowsGPC DLL Visual BasicVisual Basic DLL List 4-1 Visual Basic 6.0 GPC-2000 Declare Function DioInputPoint Lib "FbiDio.DLL" (ByVal hdevicehandle As Long, _ ByRef pbuffer As Long, ByVal dwstartnum As Long, ByVal dwnum As Long) As Long 1) DLL Visual Basic.NET DLL Visual Basic Interface Corporation

97 4.2.2 DLL 関数を保持するクラスを作成します C# Visual Basic DLL Visual Basic DLLDLL DLL List 4-2 Visual Basic.NET Imports System.Runtime.InteropServices Public Class IFCDio Declare Function DioOpen Lib "FbiDio.DLL" (ByVal lpszname As String,_ End Class ByVal fdwattrs As Integer) As Integer DLL DLL DLL マネージコードでのプロトタイプ宣言の記述 DLL.NET Framework Visual Basic.NETVisual Basic 6.0 Interface Corporation

98 4-1 Visual Basic 6.0 Visual Basic.NET C# C++ 16 Integer Short short short 32 Long Integer int int 64 (none) Long Long _int64 [Visual Basic] Declare Function Lib GPC-2000 GPC-2000FbiDio.DLL List 4-3 Visual Basic.NET Imports System.Runtime.InteropServices Declare Function DioOpen Lib "FbiDio.DLL" (ByVal lpszname As String,_ ByVal fdwattrs As Integer) As Integer Declare Function DioClose Lib "FbiDio.DLL" (ByVal hdevicehandle As Integer)_ As Integer Declare Function DioInputPoint Lib "FbiDio.DLL" (ByVal hdevicehandle As Integer,_ ByRef pbuffer As Integer, ByVal dwstartnum As Integer,_ ByVal dwnum As Integer) As Integer DllImportAttribute Shared Function Visual Basic.NETDllImportAttributeMicrosoft Interface Corporation

99 [C#] DllImportAttribute DLL static extern List 4-4 Visual C#.NET using System.Runtime.InteropServices; [DllImport("fbidio.dll")] public static extern int DioOpen( string lpszname, uint fdwflags ); [C++] DllImportAttribute DLL extern "C" List 4-5 Visual C++.NET using namespace System::Runtime::InteropServices; [DllImport("fbidio.dll")] extern "C" HANDLE DioOpen( LPCTSTR lpszname, DWORD fdwflags ); Visual C++.NET DllImportAttributeVisual C DLL Interface Corporation

100 4.2.4 DLL 関数の呼び出し DLL [Visual Basic] List 4-6 DLL Imports System.Runtime.InteropServices Public Const FBIDIO_FLAG_SHARE As Integer = &H2 Imports System.Runtime.InteropServices Public Class IFCDio Declare Function DioOpen Lib "FbiDio.DLL" (ByVal lpszname As String,_ ByVal fdwattrs As Integer) As Integer Declare Function DioClose Lib "FbiDio.DLL" (ByVal hdevicehandle As Integer)_ As Integer Declare Function DioInputPoint Lib "FbiDio.DLL" (ByVal hdevicehandle As Integer,_ ByRef pbuffer As Integer, ByVal dwstartnum As Integer,_ ByVal dwnum As Integer) As Integer End Class Public Class DigitalInput Public Shared Sub Main() Dim nret As Integer Dim hdevicehandle As Integer Dim lpszname As String hdevicehandle = IFCDio.DioOpen(lpszName, FBIDIO_FLAG_SHARE) If hdevicehandle = -1 Then nret = MessageBox.Show ("Failed to open the device.", _ "DioOpen",MessageBoxButtons.OK,MessageBoxIcon.Error) EndIf End Sub End Class Interface Corporation

101 4.3 その他の注意事項と追加情報 Visual Basic.NET Declare ステートメントは As Any 型のパラメータをサポートしない Visual Basic 6.0 Declare As Any As Any Visual Basic.NET As Any Visual Basic 6.0 As Any As Any Visual Basic.NET MSDN 明示的なマーシャリングが必要となる場合 MSDN Interface Corporation

102 構造体を使用する場合の注意点 DLL StructLayoutAttribute StructLayoutAttribute AutomaticSequential Explicit 4-2 LayoutKind.Automatic LayoutKind.Explicit LayoutKind.Sequential FieldOffset MSDN StructLayoutAttribute FieldOffsetAttribute Interface Corporation

103 StructLayoutAttribute MYSTRUC MyLib.dll MyFunc typedef struct _mystruc { int a; int b; }MYSTRUC; BOOL MyFunc(MYSTRUC *lpmystc); MYSTRUC [Visual Basic] List 4-7 Visual Basic.NET Imports System.Runtime.InteropServices <StructLayout(LayoutKind.Sequential)> Public Structure MyStruc Public a As Integer Public b As Integer End Structure Class MyAPI Declare Auto Function MyFunc Lib " MyLib.dll" _ (ByRef lpmystc As MYSTRUC) As Boolean End Class MyStrucLayoutKind.Explicit List 4-8 Explicit Visual Basic.NET <StructLayout(LayoutKind.Explicit)> Public Structure MyStruc <FieldOffset(0)> Public a As Integer <FieldOffset(4)> Public b As Integer End Structure Interface Corporation

104 [C#] List 4-9 Visual C#.NET using System.Runtime.InteropServices; [StructLayout(LayoutKind.Sequential)] public struct MYSTRUC { public int a; public int b; } class MyAPI { [DllImport("MyLib.dll")] public static extern Bool PtInRect(ref MYSTRUC lpmystc); } MyStrucLayoutKind.Explicit List 4-10 Explicit Visual C#.NET [StructLayout(LayoutKind. Explicit)] public struct MYSTRUC { } [FieldOffset(0)] public int a; [FieldOffset(4)] public int b; Interface Corporation

105 4.3.4 構造体の中の構造体配列 (GPC-3100 の例 ) GPC-3100ADSMPLREQ ADSMPLREQADSMPLCHREQ GPC-3100ADSMPLREQADSMPLCHREQ256 2 ADSMPLCHREQ32bit List 4-11 ADSMPLCHREQ <StructLayout(LayoutKind.Sequential)> Structure ADSMPLCHREQ Dim ulchno As Integer Dim ulrange As Integer End Structure Interface Corporation

106 ADSMPLCHREQ2ADSMPLREQ List 4-12 ADSMPLREQ <StructLayout(LayoutKind.Sequential)> Structure ADSMPLREQ Dim ulchcount As Integer Dim ulchno1 As Integer Dim ulrange1 As Integer Dim ulchno2 As Integer Dim ulrange2 As Integer <MarshalAs(UnmanagedType.ByValArray, SizeConst:=508)> _ Dim dummy() As Integer Dim ulsamplingmode As Integer Dim ulsinglediff As Integer Dim ulsmplnum As Integer Dim ulsmpleventnum As Integer Dim fsmplfreq As Single Dim ultrigpoint As Integer Dim ultrigmode As Integer Dim ltrigdelay As Integer Dim ultrigch As Integer Dim ftriglevel1 As Single Dim ftriglevel2 As Single Dim uleclkedge As Integer Dim ulatrgpulse As Integer Dim ultrigedge As Integer Dim ultrigdi As Integer Dim ulfastmode As Integer End Structure List 4-13 ADSMPLREQ gconfig.ulchno1 = 1 gconfig.ulrange1 = AD_1V gconfig.ulchno2 = 2 gconfig.ulrange2 = AD_1V nret = AdSetSamplingConfig(ghDeviceHandle, gconfig) Interface Corporation

107 2 Visual Basic.NET ADSMPLREQ List 4-14 ADSMPLREQ <StructLayout(LayoutKind.Sequential)> Structure ADSMPLREQ Dim ulchcount As Integer <MarshalAs(UnmanagedType.ByValArray, SizeConst:=512)> _ Dim ulchnorange() As Integer Dim ulsamplingmode As Integer Dim ulsinglediff As Integer Dim ulsmplnum As Integer Dim ulsmpleventnum As Integer Dim fsmplfreq As Single Dim ultrigpoint As Integer Dim ultrigmode As Integer Dim ltrigdelay As Integer Dim ultrigch As Integer Dim ftriglevel1 As Single Dim ftriglevel2 As Single Dim uleclkedge As Integer Dim ulatrgpulse As Integer Dim ultrigedge As Integer Dim ultrigdi As Integer Dim ulfastmode As Integer Public Sub New(ByVal Dummy As Integer) ReDim ulchnorange(511) End Sub Public Sub SetChNo(ByVal ulindex As Integer, ByVal ulnumber As Integer) End Sub ulchnorange(ulindex * 2) = ulnumber Public Function GetChNo(ByVal ulindex As Integer) As Integer GetChNo = ulchnorange(ulindex * 2) End Function Public Sub SetRange(ByVal ulindex As Integer, ByVal ulrange As Integer) Interface Corporation

108 End Sub ulchnorange((ulindex * 2) + 1) = ulrange Public Function GetRange(ByVal ulindex As Integer) As Integer GetRange = ulchnorange((ulindex * 2) + 1) End Function End Structure List 4-15ADSMPLREQ gconfig.setchno(0, 1) gconfig.setchno(1, 2) gconfig.setrange(0, AD_1V) gconfig.setrange(1, AD_1V) nret = AdSetSamplingConfig(ghDeviceHandle, gconfig) 固定長文字列 Visual Basic.NET DLL StringBuilder DLLNULLStringBuilder StringBuilderMicrosoft GPIBGPC-4301GpibReceive PciGpibExMastRecvDataPciGpibExSlavRecvData NULL StringBuilder Byte Interface Corporation

109 4.3.6 文字エンコード.NET FrameworkUnicode Unicode1216.NET Framework Unicode Unicode ASCIIEncoding CodePageEncoding UnicodeEncoding UTF7Encoding UTF8Encoding DLLByteASCII Unicode Visual Basic.NETVisual C#.NETASCIIEncoding ASCIIUnicode GPC-4301 DLL GpibReceive GpibReceiveGPIB ByteASCII.NET FrameworkUnicode ASCIIEncoding Interface Corporation

110 [Visual Basic] List 4-16 GpibReceiveByte Declare Function GpibReceive Lib "GPC43042.DLL" (ByVal ulboardno As Integer, ByVal lpadrstbl() As Integer, ByRef ulplength As Integer, ByVal vpbuffer() As Byte) As Integer ASCIIUnicodeString List 4-17 Visual Basic Dim nlength As Integer Dim nret As Integer Dim szbuffer As String Dim e As ASCIIEncoding = New ASCIIEncoding() Dim bdata(63) As Byte int[ ] DevAdrsTbl = new int [2]; szbuffer = "" DevAdrsTbl(0) = 22 DevAdrsTbl(1) = -1 nlength = 64 nret = GpibReceive(1, DevAdrsTbl, nlength, bdata) If (nret = 0) Then szbuffer = e.getstring(bdata, 0, nlength) End If [C#] List 4-18 GpibReceiveByte [DllImport("gpc43042.dll")] public static extern int GpibReceive(uint ulboardno, int[ ] lpadrstbl, ref uint dwplength, byte[ ] pvbuffer); ASCIIUnicodeString List 4-19 C# uint ulength = 64; int nret; string szbuffer = ; ASCIIEncoding e = new ASCIIEncoding(); byte[ ] bdata= new byte [64]; int[ ] DevAdrsTbl = new int [2]; DevAdrsTbl[0] = 22; DevAdrsTbl[1] = -1; nret = GpibReceive(1, DevAdrsTbl, ref ulength, bdata); if(nret == 0) { szbuffer = e.getstring(bdata,0,(int)ulength); } Interface Corporation

111 4.3.7 デリゲートオブジェクトを使用したコールバック処理 DLL DLL DLL Visual Basic.NETC#.NET DLL.NET Framework DLL Step1DLL DLL Step2 Step3DLL DLL DLL DLL Interface Corporation

112 [Visual Basic] GPC-4301 DLLGpibSetSrqEvent Step1DLL CGpibSetSrqEvent List 4-20 #define LPSRQCALLBACK VOID WINAPI typedef void (WINAPI *PLPSRQCALLBACK)(int nboardno, DWORD dwuser); List 4-21 GpibSetSrqEvent int GpibSetSrqEvent(ULONG ulboardno, PLPSRQCALLBACK lponsrqproc, DWORD dwuser); Visual Basic.NET PLPSRQCALLBACK List 4-22 Delegate Sub PLPSRQCALLBACK(ByVal nboardno As Integer, ByVal dwuser As Integer) List 4-23 GpibSetSrqEvent Declare Function GpibSetSrqEvent Lib "GPC43042.DLL" (ByVal ulboardno As Integer, ByVal lponsrqproc As PLPSRQCALLBACK, ByVal dwuser As Integer) As Integer Step2 lpsrqproc PLPSRQCALLBACK PLPSRQCALLBACK List 4-24 Module Module1 Public osp As PLPSRQCALLBACK Sub lponsrqproc(byval dwboardno As Integer, ByVal dwuser As Integer) End Sub End Module Interface Corporation

113 Step3DLL lponsrqprocplpsrqcallback GpibSetSrqEvent2 List 4-25 GpibSetSrqEvent osp = New PLPSRQCALLBACK(AddressOf lponsrqproc) nret = GpibSetSrqEvent(1, osp, 0x55) [C#] GPC-4301 DLLGpibSetSrqEvent Step1DLL CGpibSetSrqEvent List 4-26 #define LPSRQCALLBACK VOID WINAPI typedef void (WINAPI *PLPSRQCALLBACK)(int nboardno, DWORD dwuser); List 4-27 GpibSetSrqEvent int GpibSetSrqEvent(ULONG ulboardno, PLPSRQCALLBACK lponsrqproc, DWORD dwuser); C# PLPSRQCALLBACK List 4-28 public delegate void PLPSRQCALLBACK(int nboardno, uint dwuser); List 4-29 GpibSetSrqEvent [DllImport("gpc43042.dll")] public static extern int GpibSetSrqEvent(uint ulboardno, PLPSRQCALLBACK lponsrqproc, uint dwuser); Step2 lpsrqproc PLPSRQCALLBACK List 4-30 void lponsrqproc(int dwboardno, uint dwuser) { } Interface Corporation

114 Step3DLL PLPSRQCALLBACK List 4-31 IFCGPIB.PLPSRQCALLBACK osp; lponsrqprocplpsrqcallback GpibSetSrqEvent2 List 4-32 GpibSetSrqEvent osp = new IFCGPIB.PLPSRQCALLBACK (lponsrqproc); nret = IFCGPIB.GpibSetSrqEvent(1, osp, 0x55); イベントオブジェクト DLL.NET Framework Win32APICreateEvent Win32APIKernel32.dllDLL Win32APIDLL.NET Framework [Visual Basic] List 4-33 CreateEventWaitForSingleObjectCloseHandleResetEvent Declare Function CreateEvent Lib "kernel32" Alias "CreateEventA" (ByVal lpeventattributes As Integer, ByVal ManualReset As Integer, ByVal binitialstate As Integer, ByVal lpname As String) As Integer Declare Function WaitForSingleObject Lib "kernel32" (ByVal hhandle As Integer, ByVal dwmilliseconds As Integer) As Integer Declare Function CloseHandle Lib "kernel32" (ByVal hobject As Integer) As Integer Declare Function ResetEvent Lib "kernel32" (ByVal hevent As Integer) As Integer Interface Corporation

115 List 4-34 GPC-3100 GPC-3100AdSmpl_BForm5.vb Dim hevent As Integer hevent = CreateEvent(0, True, False, CStr(0)) nret = AdSetBoardConfig(ghDeviceHandle, hevent, 0, 0) nret = AdSetSamplingConfig(ghDeviceHandle, gconfig) nret = AdStartSampling(ghDeviceHandle, FLAG_ASYNC) nret = WaitForSingleObject(hEvent, 5000) nret = ResetEvent(hEvent) nret = CloseHandle(hEvent) [C#] List 4-35 CreateEventWaitForSingleObjectCloseHandleResetEvent [DllImport("kernel32.dll",EntryPoint="CreateEventA")] public static extern uint CreateEvent(uint lpeventattributes, bool ManualReset, bool binitialstate, string lpname); [DllImport("kernel32.dll")] public static extern uint WaitForSingleObject(uint hhandle, uint dwmilliseconds); [DllImport("kernel32.dll")] public static extern bool CloseHandle(uint hobject); [DllImport("kernel32.dll")] public static extern bool ResetEvent(uint hevent); Interface Corporation

116 List 4-36 GPC-3100 GPC-3100 AdSmpl_Cs ESamplingForm.cs uint hevent; hevent =CreateEvent(0, true, false, null); gnerrcode = IFCAD.AdSetBoardConfig( ghdevicehandle, hevent, null, 0 ); gnerrcode = IFCAD.AdSetSamplingConfig(ghDeviceHandle, ref gconfig); gnerrcode = IFCAD.AdStartSampling(ghDeviceHandle, IFCAD.FLAG_ASYNC); WaitForSingleObject(hEvent, 5000); ResetEvent(hEvent); CloseHandle(hEvent); Interface Corporation

117 4.3.9 関数のオーバーロード GPC-4301GpibSend GpibSendIntPtrByteByteString BPC-08018C# [Visual Basic] List 4-37 Visual Basic Declare Function GpibSend Lib "GPC43042.DLL" (ByVal ulboardno As Integer, ByVal lpadrstbl() As Integer, ByVal ulplength As Integer, ByRef vpbuffer As Byte) As Integer Declare Function GpibSend Lib "GPC43042.DLL" (ByVal ulboardno As Integer, ByVal lpadrstbl() As Integer, ByVal ulplength As Integer, ByVal vpbuffer() As Byte) As Integer Declare Function GpibSend Lib "GPC43042.DLL" (ByVal ulboardno As Integer, ByVal lpadrstbl() As Integer, ByVal ulplength As Integer, ByVal vpbuffer As String) As Integer Declare Function GpibSend Lib "GPC43042.DLL" (ByVal ulboardno As Integer, ByVal lpadrstbl() As Integer, ByVal ulplength As Integer, ByVal vpbuffer As IntPtr) As Integer [C#] List 4-38 C# [DllImport("gpc43042.dll")] public static extern int GpibSend(uint ulboardno, int[ ] lpadrstbl, uint dwlength, ref byte pvbuffer); [DllImport("gpc43042.dll")] public static extern int GpibSend(uint ulboardno, int[ ] lpadrstbl, uint dwlength, byte[ ] pvbuffer); [DllImport("gpc43042.dll")] public static extern int GpibSend(uint ulboardno, int[ ] lpadrstbl, uint dwlength, string pvbuffer); [DllImport("gpc43042.dll")] public static extern int GpibSend(uint ulboardno, int[ ] lpadrstbl, uint dwlength, IntPtr pvbuffer); Interface Corporation

118 クラスライブラリの参照先が未解決になった場合 DLL Windows Apprication 1- Windows Apprication Interface Corporation

119 2. DLL OK Interface Corporation

120 Visual C++.NET の補足情報 Visual C++.NET DllImportAttributeVisual C DLL Visual C++MFC Win Visual C++Windows DLL 1. C/C Interface Corporation

121 H: work interface GPC2000 include H: work Interface GPC2000 lib 4-7 Interface Corporation

122 3. - fbidio.lib DLL DLL Interface Corporation

Microsoft Word - DT-5100Lib_Manual_DotNet.doc

Microsoft Word - DT-5100Lib_Manual_DotNet.doc CASSIOPEIA DT-5100 シリーズ.NET ライブラリマニュアル 概要編 Ver 3.00 変更履歴 No Revision 更新日項改訂内容 1 1.00 03/1/20 初版初版発行 2 3.00 05/03/15 3 カシオライブラリマニュアル (.NET) 開発マニュアルの 1~4 をひとまとめ にしました 4 5 6 7 8 9 10 11 12 13 14 15 16 17

More information

ウィンドウ操作 応用

ウィンドウ操作 応用 Win32API 関数 ウィンドウ操作 ウィンドウ名でトップレベルウィンドウ ( 親を持たないウィンドウ ) のハンドルを取得 メモ帳や電卓等のウィンドウ名でトップレベルウィンドウ ( 親を持たないウィンドウ ) のハンドルを取得する方法を 下記に示す Visual Basic Imports System.Runtime.InteropServices Public Class WindowFromWindowName

More information

プロセス間通信

プロセス間通信 プロセス間通信 プロセス間通信 (SendMessage) プロセス間通信とは 同一コンピューター上で起動して居るアプリケーション間でデータを受け渡し度い事は時々有る Framework には リモート処理 と謂う方法でデータの受け渡しを行なう方法が有る 此処では 此の方法では無く 従来の方法の API を使用したプロセス間通信を紹介する 此の方法は 送信側は API の SendMessage で送り

More information

DPC-0244

DPC-0244 DIO(PCI/C-PCI) DPC-0224 汎用入出力モジュール用 Windows ライブラリ Help for Windows www.interface.co.jp 目次 第 1 章はじめに 3 1.1 概要...3 第 2 章導入方法 4 2.1 インストール手順...4 2.2 使用方法...4 2.3 実行手順...7 第 3 章リファレンス 9 3.1 関数一覧...9 3.2 未サポート関数...10

More information

LogisticaTRUCKServer-Ⅱ距離計算サーバ/Active-Xコントロール/クライアント 概略   

LogisticaTRUCKServer-Ⅱ距離計算サーバ/Active-Xコントロール/クライアント 概略       - LogisticaTRUCKServer-Ⅱ(SQLServer 版 ) 距離計算サーハ API.NET DLL WindowsForm サンフ ルフ ロク ラム - 1 - LogisticaTRUCKServer-Ⅱ 距離計算サーハ.NET DLL WindowsForm VisualBasic での利用方法 LogisticaTRUCKServer-Ⅱ 距離計算.NET DLLのサンプルプログラムの参照サンフ

More information

DPC-0401

DPC-0401 Interface USB Driver (I/O-CD) DPC-0401 USB 拡張 I/O 用 Windows ドライバ Help for Windows www.interface.co.jp 目次 第 1 章はじめに...3 1.1 概要...3 1.2 各 I/O に対応したドライバ...3 第 2 章製品仕様...4 2.1 基本仕様...4 2.2 製品構成...4 2.3 クラスライブラリの参照方法...5

More information

API 連携方式 外部 DLL の呼び出し宣言 外部 DLL の呼び出し宣言のサンプルコード (Microsoft Visual C#.NET の場合 ) プログラムコードの先頭で using System.Runtime.InteropServices; が必要 クラスの内部に以下のような外部 D

API 連携方式 外部 DLL の呼び出し宣言 外部 DLL の呼び出し宣言のサンプルコード (Microsoft Visual C#.NET の場合 ) プログラムコードの先頭で using System.Runtime.InteropServices; が必要 クラスの内部に以下のような外部 D GS1-128 の描画 DLL について (ver. 2.2) 動作環境など動作環境 WindowsXP Windows Vista Windows7 Windows8/8.1 Windows10 上記 OS について すべて日本語版を対象としております 32bit アプリケーションから呼び出される必要があります 使用条件 プリンタの解像度 300dpi 以上 機能 バーコードの基本幅を 1 ドット単位で指定できる

More information

untitled

untitled Visual Basic.NET 1 ... P.3 Visual Studio.NET... P.4 2-1 Visual Studio.NET... P.4 2-2... P.5 2-3... P.6 2-4 VS.NET(VB.NET)... P.9 2-5.NET... P.9 2-6 MSDN... P.11 Visual Basic.NET... P.12 3-1 Visual Basic.NET...

More information

Visual BasicによるDIO入門書

Visual BasicによるDIO入門書 チュートリアル Visual Basic による DIO 入門書 (Digital Input Output) www.interface.co.jp /, (), (), (),,, (),,,, 2000, 2006 Interface Corporation. All rights reserved. www.interface.co.jp Ver. 1.9 20066 XP Embedded

More information

VB 資料 電脳梁山泊烏賊塾 音声認識 System.Speech の利用 System.Speech に依るディクテーション ( 音声を文字列化 ).NetFramework3.0 以上 (Visual Studio 2010 以降 ) では 標準で System.Speech が用意されて居るの

VB 資料 電脳梁山泊烏賊塾 音声認識 System.Speech の利用 System.Speech に依るディクテーション ( 音声を文字列化 ).NetFramework3.0 以上 (Visual Studio 2010 以降 ) では 標準で System.Speech が用意されて居るの 音声認識 System.Speech の利用 System.Speech に依るディクテーション ( 音声を文字列化 ).NetFramework3.0 以上 (Visual Studio 2010 以降 ) では 標準で System.Speech が用意されて居るので 此れを利用して音声認識を行うサンプルを紹介する 下記の様な Windows フォームアプリケーションを作成する エディタを起動すると

More information

GS1-128 の描画 DLL について (ver. 2.3) 動作環境など動作環境 WindowsXP Windows Vista Windows7 Windows8/8.1 Windows10 上記 OS について すべて日本語版を対象としております 32bit アプリケーションから呼び出される

GS1-128 の描画 DLL について (ver. 2.3) 動作環境など動作環境 WindowsXP Windows Vista Windows7 Windows8/8.1 Windows10 上記 OS について すべて日本語版を対象としております 32bit アプリケーションから呼び出される GS1-128 の描画 DLL について (ver. 2.3) 動作環境など動作環境 WindowsXP Windows Vista Windows7 Windows8/8.1 Windows10 上記 OS について すべて日本語版を対象としております 32bit アプリケーションから呼び出される必要があります 使用条件 プリンタの解像度 300dpi 以上 機能 バーコードの基本幅を 1 ドット単位で指定できる

More information

LogisticaTRUCKServer-Ⅱ距離計算サーバ/Active-Xコントロール/クライアント 概略   

LogisticaTRUCKServer-Ⅱ距離計算サーバ/Active-Xコントロール/クライアント 概略       - LogisticaTRUCKServer-Ⅱ(SQLServer 版 ) 距離計算サーハ API.NET DLL WebForms ASP.NET サンフ ルフ ロク ラム - 1 - LogisticaTRUCKServer-Ⅱ 距離計算サーハ.NET DLL WebForm ASP.NET VisualBasic での利用方法 LogisticaTRUCKServer-Ⅱ 距離計算.NET

More information

ICONファイルフォーマット

ICONファイルフォーマット グラフィックス 画像フォーマットエンコーダパラメータ 様々なフォーマットで画像を保存 Bitmap クラスを用いる事でビットマップ JPEG GIF PNG 等様々なフォーマットの画像を読み込み操作する事が出来る 更に Bitmap クラスや Graphics コンテナを用いて描画処理等を施したイメージをファイルに保存する事も出来る 此の時 読み込めるフォーマット同様に保存するフォーマットを選択する事が出来る

More information

スレッド操作 タイマー

スレッド操作 タイマー スレッド操作 タイマー System.Windows.Forms.Timer Windows フォームの Timer は 一定の間隔でイベントを発生させるコンポーネントで有る 此のコンポーネントは Windows フォーム環境で使用する サーバー環境に適したタイマが必要な場合は 後述の System.Timers.Timer を使用する イベントの発生する間隔は ミリ秒単位で Interval プロパティで設定しする

More information

構造体

構造体 構造体 Byte 配列 構造体とコピーする方法 構造体とバイト配列の変換を行うには System.Runtime.InteropServices 名前空間をインポートして置くと便利で有る Imports System.Runtime.InteropServices using System.Runtime.InteropServices; 下記の 3 種類の構造体にバイト配列の値を格納した場合に付いて検証する

More information

Oracle Lite Tutorial

Oracle Lite Tutorial GrapeCity -.NET with GrapeCity - SPREAD Creation Date: Nov. 30, 2005 Last Update: Nov. 30, 2005 Version: 1.0 Document Control Internal Use Only Author Hiroshi Ota Change Logs Date Author Version Change

More information

FBWFMemoryWatcher

FBWFMemoryWatcher IFFBWFMEMORYWATCHER.WIN FBWF Memory Watcher Classembly Devices 用 Windows ドライバソフトウェア Help for Windows www.interface.co.jp 目次 第 1 章はじめに 3 1.1 概要...3 1.2 特長...3 第 2 章製品仕様 4 2.1 基本仕様...4 2.2 製品構成...4 第 3 章導入方法

More information

CashDrawer ライブラリ API 仕様書 2014/07/09 CashDrawer ライブラリ API 仕様書 Rev / 10

CashDrawer ライブラリ API 仕様書 2014/07/09 CashDrawer ライブラリ API 仕様書 Rev / 10 2014/07/09 CashDrawer ライブラリ API 仕様書 Rev. 00.0.04 1 / 10 目次 1. ファイル構成... 3 2. 環境 3 2.1. 動作環境 OS... 3 2.2. コンパイル時の注意点... 3 2.3. USB ドライバ... 3 3. 関数一覧... 4 3.1. USB 接続確認処理 (CD_checkConnect CD_checkConnect)

More information

ファイル操作-インターネットキャッシュ

ファイル操作-インターネットキャッシュ ファイル操作 インターネット一時ファイルの保存場所 インターネットキャッシュ インターネット一時ファイルの保存場所は Internet Explorer の場合 下記の手順で確認する事が出来る 1.[ ツール ] [ インターネットオプション ] でインターネットオプション画面のダイアログを表示させる 2.[ 全般 ] タブで [ インターネット一時ファイル ] グループの [ 設定 ] をクリックすると

More information

@(h) Select.vb ver 1.1 ( 07.09.15 ) @(h) Select.vb ver 1.0 ( 07.09.13 ) @(s) Option Explicit Private Structure SYMBOLINFO Dim SyDataType As String Dim

@(h) Select.vb ver 1.1 ( 07.09.15 ) @(h) Select.vb ver 1.0 ( 07.09.13 ) @(s) Option Explicit Private Structure SYMBOLINFO Dim SyDataType As String Dim A HotDocument A HotDocument A HotDocument A HotDocument A HotDocument A HotDocument A HotDocument A HotDocument @(h) Select.vb ver 1.1 ( 07.09.15 ) @(h) Select.vb ver 1.0 ( 07.09.13 ) @(s) Option Explicit

More information

1.dll の配置場所配布時はプログラムの実行フォルダーへ配置 2. 開発環境での使用 プロジェクトのプロパティーで [USBPIO.dll] を参照追加してください 開発環境 dll ファイルの場所 VB.Net Express Edition 境プロジェクトのフォルダ \bin\release VB.Netebugビルドの場合プロジェクトのフォルダ \bin\debug VB.Net Releaseビルドの場合プロジェクトのフォルダ

More information

Visual BasicによるAD入門書

Visual BasicによるAD入門書 チュートリアル Visual Basic による AD 入門書 AD www.interface.co.jp /, (), (), (),,, (),,,, 2000, 2007 Interface Corporation. All rights reserved. www.interface.co.jp Ver. 2.0 200712 5 FbiAd.DLL 1.9 20056 CompactPCI

More information

Oracle Lite Tutorial

Oracle Lite Tutorial GrapeCity -.NET with GrapeCity - FlexGrid Creation Date: Nov. 30, 2005 Last Update: Nov. 30, 2005 Version: 1.0 Document Control Internal Use Only Author Hiroshi Ota Change Logs Date Author Version Change

More information

TUT-0023

TUT-0023 チュートリアル Visual Basic による DA 入門書 (Digital To Analog) DA www.interface.co.jp /, (), (), (),,, (),,,, 2000, 2006 Interface Corporation. All rights reserved. www.interface.co.jp Ver. 1.5 20066 XP Embedded

More information

Public Class Class4SingleCall Inherits MarshalByRefObject Public Sub New() End Sub Public Function OneProc(ByVal The As A SC) As A SC Dim The As New A SC The.answer = The.index * 2 + 1000 Return The End

More information

GPC-6105

GPC-6105 PULSE4(PCI)GEN GPC-6105 パルス出力製品 Windows 対応ドライバソフトウェア Help for Windows www.interface.co.jp 目次 第 1 章はじめに 2 1.1 概要...2 1.2 特長...2 第 2 章製品仕様 3 2.1 基本仕様...3 第 3 章導入方法 4 3.1 インストール手順...4 3.2 実行手順...4 3.3 クラスライブラリの参照方法...7

More information

TOEIC

TOEIC TOEIC 1 1 3 1.1.............................................. 3 1.2 C#........................................... 3 2 Visual Studio.NET Windows 5 2.1....................................... 5 2.2..........................................

More information

VB

VB .NET.NET Rev.2004.9.1 Session1...1 Session2...23 Session3 Windows...38 Session4 Web...56 1 NUnit...67 Session1 Visual Studio.NET VS.NET.NET Windows Web XML Web VS.NET NUnit Session VS.NET.NET Session Session

More information

Visual C++によるAD入門書

Visual C++によるAD入門書 チュートリアル Visual C++ による AD 入門書 www.interface.co.jp /, (), (), (),,, (),,,, 2000, 2007 Interface Corporation. All rights reserved. www.interface.co.jp Ver. 1.8 200712 5 DLL 1.7 20074 Windows Vista 5 5.1

More information

JAJP.qxd

JAJP.qxd Agilent E6601A Application Note ...2 E6601A...3...4...5...8 E6601A PC...17...17 GSM...18 1Windows XP Agilent E6601A E6601A E6601A Visual Studio.NET 2 E6601A Agilent E6601A 1Windows XP Professional Windows

More information

ファイル操作

ファイル操作 ファイル操作 TextFieldParser オブジェクト ストリームの読込と書込 Microsoft.VisualBasic.FileIO 名前空間の TextFieldParser オブジェクトは 構造化テキストファイルの解析に使用するメソッドとプロパティを備えたオブジェクトで有る テキストファイルを TextFieldParser で解析するのは テキストファイルを反復処理するのと同じで有り

More information

Step 1. Step 2. Step 3. Step 1. Step 2. Step 3. 1 2 3 ' Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset 'Connection 'Recordset ' cn.open "Driver={Microsoft Access Driver (*.mdb)};dbq=" &

More information

構造体

構造体 構造体 構造体を取り扱うには System.Runtime.InteropServices 名前空間をインポートして置くと便利で有る Imports System.Runtime.InteropServices using System.Runtime.InteropServices; C# ユーザー定義型 (Type) と構造体 (Structure) 6.0 のユーザー定義型 (Type) を.NET

More information

Windows Web Windows Windows WinSock

Windows Web Windows Windows WinSock Windows kaneko@ipl.t.u-tokyo.ac.jp tutimura@mist.t.u-tokyo.ac.jp 2002 12 4 8 Windows Web Windows Windows WinSock UNIX Microsoft Windows Windows Windows Windows Windows.NET Windows 95 DOS Win3.1(Win16API)

More information

ファイル監視

ファイル監視 ファイル操作 ファイルやディレクトリの監視 FileSystemWatcher クラス.NET Framework のクラスライブラリには ファイルやディレクトリの作成 変更 削除を監視する為の FileSystemWatcher クラスが System.IO 名前空間に用意されて居る ( 但し Windows 98/Me では利用出来ない ) 此れを利用すると 特定のディレクトリにファイルが作成された

More information

VFD256 サンプルプログラム

VFD256 サンプルプログラム VFD256 サンプルプログラム 目次 1 制御プログラム... 1 2.Net 用コントロール Vfd256 の使い方... 11 2.1 表示文字列の設定... 11 2.2 VFD256 書込み前のクリア処理... 11 2.3 書き出しモード... 11 2.4 表示モード... 12 2.5 表示... 13 2.6 クリア... 13 2.7 接続方法 ボーレートの設定... 13 2.8

More information

3軸加速度センサーモジュール MM-2860 書込み済みマイコンプログラム通信コマンド概要

3軸加速度センサーモジュール MM-2860 書込み済みマイコンプログラム通信コマンド概要 アプリケーションノートミニマイコン評価カード CT-298 3 軸加速度センサーモジュール MM-2860 書込み済みマイコンプログラム通信コマンド概要 1. 概要 CT-298 DIP SF9S08C 3 MM-2860 HC9S08QG8-XYZ2_v1.1 PC PC PC HC9S08QG8-XYZ2_v1.1 CodeWorrior http://www.freescale.co.jp/products/8bit/9s08qg.html

More information

C#の基本2 ~プログラムの制御構造~

C#の基本2 ~プログラムの制御構造~ C# の基本 2 ~ プログラムの制御構造 ~ 今回学ぶ事 プログラムの制御構造としての単岐選択処理 (If 文 ) 前判定繰り返し処理(for 文 ) について説明を行う また 整数型 (int 型 ) 等の組み込み型や配列型についても解説を行う 今回作るプログラム 入れた文字の平均 分散 標準偏差を表示するプログラム このプログラムでは calc ボタンを押すと計算を行う (value は整数に限る

More information

GPC-4851

GPC-4851 CAN(PCI/C-PCI) GPC-4851 CAN インタフェースモジュール用 Windows ドライバ Help for Windows www.interface.co.jp 目次 第 1 章はじめに 3 1.1 概要...3 1.2 特長...3 第 2 章製品仕様 4 2.1 基本仕様...4 2.2 対応型式...5 2.3 製品構成...8 2.4 注意事項...11 第 3 章導入方法

More information

ORiN CAO USB (3) CAO CAO USB ORiN CAO USB 1 2 (4) CAO 3 CAO USB 4 PC OS 1 CPU:Pentium IV 2. 8GHz :512MByte Windows XP SP2 Professional ORiN2 SDK USB D

ORiN CAO USB (3) CAO CAO USB ORiN CAO USB 1 2 (4) CAO 3 CAO USB 4 PC OS 1 CPU:Pentium IV 2. 8GHz :512MByte Windows XP SP2 Professional ORiN2 SDK USB D ORiN FA ORiN USB ORiN 1 1 ORiN CAO 1 1 USB USB ORiN 2 3 2 ( ) 3 1 Web ORiN USB ( ) ( ) ( ) ORiN CAO USB (3) CAO CAO USB ORiN CAO USB 1 2 (4) CAO 3 CAO USB 4 PC OS 1 CPU:Pentium IV 2. 8GHz :512MByte Windows

More information

NetCOBOL for .NET 応用編

NetCOBOL for .NET 応用編 4.1 Windows 4.2 NetCOBOL for.netwindows 4.3 Windows 4.4 Windows 4.5 Windows 91 WindowsWindows.NET Framework Windows.NET Framework Windows Windows WindowsWindows Web Windows () Windows 92 .Net Framework

More information

Case 0 sqlcmdi.parameters("?tencode").value = Iidata(0) sqlcmdi.parameters("?tenname").value = Iidata(1) 内容を追加します sqlcmdi.executenonquery() Case Else

Case 0 sqlcmdi.parameters(?tencode).value = Iidata(0) sqlcmdi.parameters(?tenname).value = Iidata(1) 内容を追加します sqlcmdi.executenonquery() Case Else Imports MySql.Data.MySqlClient Imports System.IO Public Class Form1 中間省略 Private Sub コマンドテストCToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles コマンドテストCToolStripMenuItem.Click

More information

プラグイン

プラグイン プラグイン プラグイン詳細 2 ~ プラグイン機能を持つテキストエディタの作成 ~ はじめに Adobe Photoshop や Becky! Internet Mail 等のアプリケーションでは プラグイン ( 又は アドイン エクステンション 等 ) と呼ばれるプログラムをインストールする事に依り 機能を拡張する事が出来る 此の記事では此の様なプラグイン機能を持ったアプリケーションの作り方を プラグイン対応のテキストエディタを作成する事に依り

More information

グラフィックス

グラフィックス グラフィックス PictureBox の Image プロパティに関する良く有る勘違い PictureBox に画像を表示する方法と仕て PictureBox の Image プロパティを使う方法と Graphics の DrawImage メソッドを使う方法が有るが 此の 2 つの方法を混同し 正しく理解して居ない事が多い様で有る 例えば 下記に列挙する様な状況が 此れに該当する 1.PictureBox

More information

1. 入力画面

1. 入力画面 指定した時刻に指定したマクロ (VBA) を実行するプログラム (VBA) 益永八尋 様々な業務を行っている場合には 指定した時刻に指定したマクロ (Macro VBA) を実行したくなる場合がある たとえば 9:00 17: 00 や 1 時間 6 時間間隔に指定したマクロ (Macro VBA) を実行する この様な場合に対応できるように汎用性の高いプログラムを作成した この場合に注意する必要があるのは

More information

LogisticaTRUCKServer-Ⅱ距離計算サーバ/Active-Xコントロール/クライアント 概略   

LogisticaTRUCKServer-Ⅱ距離計算サーバ/Active-Xコントロール/クライアント 概略       - LogisticaTRUCKServer-Ⅱ(SQLServer 版 ) 距離計算サーハ API ソケット通信サンフ ルフ ロク ラム -1- LogisticaTRUCKServer-Ⅱ 距離計算サーハ API ソケット通信 Java でのソケット通信 Javaでのソケット通信の実行サンフ ルフ ロク ラムポート番号は 44963 条件値, 起点, 終点 を送信して 条件値, 起点, 終点,

More information

(OnePoint) ( URL Web Copyright 2005 Microsoft Corporation. All rights reserved. Microsoft Windows Visual Basic Visual Studio Microsoft Corporation

(OnePoint) ( URL Web Copyright 2005 Microsoft Corporation. All rights reserved. Microsoft Windows Visual Basic Visual Studio Microsoft Corporation Microsoft Microsoft Visual Basic.NET (OnePoint) ( URL Web Copyright 2005 Microsoft Corporation. All rights reserved. Microsoft Windows Visual Basic Visual Studio Microsoft Corporation Microsoft Microsoft

More information

BPC-0821 Help for Windows

BPC-0821 Help for Windows IFMEM4G.WIN BPC-0821 Windows 用メモリアクセスツール Help for Windows www.interface.co.jp 目次 第 1 章はじめに 2 1.1 概要...2 1.2 特長...2 第 2 章製品仕様 3 2.1 基本仕様...3 2.2 製品構成...3 第 3 章導入方法 4 3.1 インストール手順...4 3.2 実行手順...4 第 4 章リファレンス

More information

システム監視ライブラリ

システム監視ライブラリ IFCPMGR.WIN システム監視ライブラリ ATX マザーボード用 Windows ドライバソフトウェア www.interface.co.jp 目次 第 1 章はじめに 3 1.1 概要...3 1.2 特長...3 第 2 章製品仕様 4 2.1 基本仕様...4 2.2 製品構成...4 第 3 章導入方法 5 3.1 インストール手順...5 3.2 クラスライブラリの参照方法...5

More information

JavaとVisual Basicを使ったWebサービスの実装

JavaとVisual Basicを使ったWebサービスの実装 JavaVisual Basic Web moto@sag.hitachi-sk.co.jp http://www.hitachi-sk.co.jp/ Web? Web Web Web Web Web Web SOAP Web Web Web SOAP MicrosoftIBM Web Web SOAP, UDDI, WSDL EJB Java Java Java Assam Commerce Server

More information

TUT-0022

TUT-0022 チュートリアル Visual C++によるDA 入 門 書 (Digital To Analog) www.interface.co.jp /, (), (), (),,, (),,,, 2000, 2006 Interface Corporation. All rights reserved. www.interface.co.jp Ver. 1.3 20066 XP Embedded DLL 1.2

More information

ルーレットプログラム

ルーレットプログラム ルーレットプログラム VB 2005 4 プログラムの概要 カジノの代表的なゲーム ルーレット を作成する 先ず GO! ボタンをクリックすると ルーレット盤上をボールが回転し 一定時間経過すると ボールが止まり 出目を表示するプログラムを作成する 出目を 1~16 大小 偶数奇数の内から予想して 予め設定した持ち点の範囲内で賭け点を決め 賭け点と出目に依り 1 点賭けの場合は 16 倍 其他は 2

More information

グラフィックトレーニング 概要.NET のグラフィック描画は どんなことができるのでしょうか? グラフィックオブジェクトやグラフィック環境 概念を理解するためには クラスを使って馴れることが近道です 本 書に記載されているコードをカットアンドペーストして 一つ一つの機能を体験してください 前提 グラ

グラフィックトレーニング 概要.NET のグラフィック描画は どんなことができるのでしょうか? グラフィックオブジェクトやグラフィック環境 概念を理解するためには クラスを使って馴れることが近道です 本 書に記載されているコードをカットアンドペーストして 一つ一つの機能を体験してください 前提 グラ C# & VB 1 グラフィックトレーニング 概要.NET のグラフィック描画は どんなことができるのでしょうか? グラフィックオブジェクトやグラフィック環境 概念を理解するためには クラスを使って馴れることが近道です 本 書に記載されているコードをカットアンドペーストして 一つ一つの機能を体験してください 前提 グラフィックを行うためには Visual Studio の基本操作や C# または VB

More information

MISAO with WPF

MISAO with WPF System.AddIn を利用した アプリケーション拡張 - アドインの開発 - JZ5( 松江祐輔 )@ わんくま http://katamari.jp http://katamari.wankuma.com 2008/9/13 What s System.AddIn System.AddIn 名前空間 Visual Studio Orcus から利用可能 アプリケーションに拡張機能を提 供 なんかいろいろ特長が?

More information

Microsoft Excel操作

Microsoft Excel操作 Microsoft Excel 操作 Excel ファイルにアクセス リフレクションを利用したレイトバインディングで Excel ファイルを操作 Visual Basic なら CreatObject 関数を使用して 暗黙の遅延バインディングを利用する事に依り 簡単にに実現出来る Excel の操作も C# で実現するには 少し面倒臭い事に成る 事前バインディングでも実装する事も出来るが 事前バインディングだと

More information

Visual C++によるDA入門書

Visual C++によるDA入門書 www.interface.co.jp TUT-0022 Ver 1.0 Ver 1.0 2000 11 MicrosoftWindowsWindows NTMSVisual C++Excel Microsoft Corporation,, (,), Web( ) ...1...1...1 1....2 1.1. D/A...2 1.2...3 1.3....3 2. DA...4 2.1...4

More information

Components for RS-232c

Components for RS-232c VBMan Components for RS-232C Programming Manual Version 5.00 VBMan Components for RS-232C... 6...6...7...8...8...8...11...11...11... 13...13...13...13... 15 IDE...15 Visual Basic.NET...15 Visual C#...17

More information

A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3,

A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 40 2 1. 2 2. 52 3. A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2 4. 13 5. 6. 7. 8. 9. 13 10. 11. 12. 1 VC++ VC++ Visual C++ Professional 2010 Visual C++ 2010 express Windows whist 2 OK] 3 Form1 size 800, 500

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション 配列とコレクション 配列の使い方 固定配列 動的配列 コレクションの使い方 今日の目的 固定配列の宣言例 プロシージャレベル Dim arybuf(0 To 5) As Long モジュールレベル Private arybuf(0 To 5) As Long Public arybuf(0 To 5) As Long 固定配列の宣言例 プロシージャレベル Dim arybuf(0 To 5) As

More information

2 WAGO JAPAN DLL FOR MODBUS Copyright 2011 by WAGO COMPANY OF JAPAN, LTD. All rights reserved 東京都江東区亀戸 日鐵 ND タワーワゴジャパン株式会社オートメーション TEL

2 WAGO JAPAN DLL FOR MODBUS Copyright 2011 by WAGO COMPANY OF JAPAN, LTD. All rights reserved 東京都江東区亀戸 日鐵 ND タワーワゴジャパン株式会社オートメーション TEL 1 WAGO JAPAN DLL FOR MODBUS 取扱説明書 WAGO Software WAGO JAPAN DLL FOR MODBUS WAGO_IO.dll バージョン 1.0.0( 日本語版 2011.09.26) 2 WAGO JAPAN DLL FOR MODBUS Copyright 2011 by WAGO COMPANY OF JAPAN, LTD. All rights

More information

スライド 1

スライド 1 C# の基本 ~ ファイル読み込み ~ 今回学ぶ事 今回はファイル読み書きに必要 BinaryReader クラスについて記載する ファイル参照ダイアログである OpenFileDialog クラスについても理解を深める また Bitmap クラスを用いた Bitmap ファイルの読み込み方法についても学ぶ フォーム作り まず label picturebox を配置する ツールボックスより左クリックで選択する

More information

C#の基本

C#の基本 C# の基本 ~ 開発環境の使い方 ~ C# とは プログラミング言語のひとつであり C C++ Java 等に並ぶ代表的な言語の一つである 容易に GUI( グラフィックやボタンとの連携ができる ) プログラミングが可能である メモリ管理等の煩雑な操作が必要なく 比較的初心者向きの言語である C# の利点 C C++ に比べて メモリ管理が必要ない GUIが作りやすい Javaに比べて コードの制限が少ない

More information

ASP.NET 2.0 Provider Model 概要

ASP.NET 2.0 Provider Model 概要 ASP.NET 2.0 Provider Model 概要 Agenda ASP.NET 2.0 Provider Model とは カスタムプロバイダの実装 まとめ ASP.NET 2.0 Provider Model とは ASP.NET 2.0 のインフラストラクチャ データストアへのアクセスをアプリケーションロジックから分離 データストアの変更に柔軟に対応 Strategy パターン デザインパターンによる意識の共通化

More information

プリンタ印字用 DLL 取扱説明書

プリンタ印字用 DLL 取扱説明書 プリンタ印字用 DLL 取扱説明書 目次 1 はじめに... 1 2 制御プログラム... 2 2.1 制御プログラムの作成方法... 2 3 easyprn.dll の使い方... 11 3.1 easyprn.dll で使用できるコマンド... 11 3.2 バーコード印字方法... 13 3.3 ロゴの印字... 15 1 はじめに プリンタ印字用 DLL ファイル easyprn.dll

More information

Msako技術資料 

Msako技術資料  2015/06/29 MsakoAPI プログラミングガイド ( 改訂第 5 版 ) この資料は Msako 4.1.1 MsakoAPI 1.8 以降に適応する Visual Studio のツールボックスに MsakoAPI を加える プログラムに MsakoTranceiver を組み込む Msako と接続する Msako の基本情報を取得する Msako のパラメータを取得 設定する 動体検知のイベントを処理する

More information

CANチュートリアル

CANチュートリアル TUT-0054 Ver. 1.1 www.interface.co.jp Ver 1.0 2004 7 1.1 2005 6 CPZ BPC-08xx BPC-0820 2-4 (, ), Web site () / ( ) ...1...1...1...2 1. CAN...3 2. CAN...4 2.1. CAN...4 2.2. CAN...4 2.3....5 2.3.1....6 2.3.2.

More information

<リスト1> AD コンバータへのデータの出力例 NEC PC98 用 mov al,22h // CLK -> 1, CS -> 0, DI -> 0 out 32h,al // シリアル ポートにデータ出力 PC/AT 互換機用 mov al,00h // CLK -> 1 mov dx,3fb

<リスト1> AD コンバータへのデータの出力例 NEC PC98 用 mov al,22h // CLK -> 1, CS -> 0, DI -> 0 out 32h,al // シリアル ポートにデータ出力 PC/AT 互換機用 mov al,00h // CLK -> 1 mov dx,3fb AD コンバータへのデータの出力例 NEC PC98 用 mov al,22h // CLK -> 1, CS -> 0, DI -> 0 out 32h,al // シリアル ポートにデータ出力 PC/AT 互換機用 mov al,00h // CLK -> 1 mov dx,3fbh out dx al // シリアル ポートにデータ出力 mov al,03h // CS -> 0,

More information

Microsoft Word 練習問題の解答.doc

Microsoft Word 練習問題の解答.doc 演習問題解答 練習 1.1 Label1.Text = Val(Label1.Text) + 2 練習 1.2 コントロールの追加 Private Sub Button2_Click( 省略 ) Handles Button2.Click Label1.Text = Val(Label1.Text) - 2 練習 2.1 TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)

More information

GPC-8826

GPC-8826 IFHNL(PCI/C-PCI) GPC-8826 光メモリンクインタフェースモジュール用 Windows ドライバ Ver. 1.70 Help for Windows www.interface.co.jp 目次 第 1 章はじめに 4 1.1 概要...4 1.2 特長...4 1.3 用語解説...5 1.4 共有メモリとは...5 1.5 ウィンドウとは...9 第 2 章製品仕様 11

More information

Oracle Lite Tutorial

Oracle Lite Tutorial GrapeCity -.NET with GrapeCity - InputMan Creation Date: Nov. 30, 2005 Last Update: Nov. 30, 2005 Version: 1.0 GrapeCity Microsoft Visual Studio.NET VB.NET Oracle Tips InputMan InputMan Oracle.NET Oracle

More information

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV tutimura@mist.i.u-tokyo.ac.jp kaneko@ipl.t.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/sem3/ 2002 12 11 p.1/33 10/16 1. 10/23 2. 10/30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20

More information

NotifyIconコントロール

NotifyIconコントロール NotifyIcon コントロール システムトレイ ( タスクトレイ ) にアイコンを表示する.NET Framework 2.0 以降の場合は 後述の 2 を観て欲しい Outlook や MSN Messenger 等の様に Windows アプリケーションではシステムトレイ ( タスクトレイ ステータス領域等とも呼ばれる ) にアイコンを表示して アプリケーションの状態を示したり アプリケーションのフォームを表示したりする為のショートカットとして利用する事が出来る.NET

More information

(Microsoft Word \203v\203\215\203O\203\211\203~\203\223\203O)

(Microsoft Word \203v\203\215\203O\203\211\203~\203\223\203O) 21113 Visual Basic を利用したフリーソフト開発 要旨 各自でフリーソフトを作成 インターネット上に公開することを目的とし Visual Basic2008 2010 を使い簡単なアプリの作成に成功した 1. 目的情報化が進んだ現代において 社会に出ていくためにはパソコンの一つや二つ 軽く扱えなければならない さらに 資源の乏しい日本においては今後 情報技術の発展することが望ましいと考える

More information

csv csv

csv csv 2009 1 9 2 1. 1 2. 2 2.1......................................... 2 2.2 csv.................................... 3 2.3 csv.................................. 3 3. 4 3.1.........................................

More information

adr(Byte)

adr(Byte) CUnet の使い方 June 25,2009 CUnetとは... 2 MPC-CUnet USB-CUnetの概要... 2 デモ機の構成とCUnetグローバルメモリのイメージ... 4 制御イメージ... 4 usbcunetライブラリコマンド 関数 (VB6 標準モジュール宣言例 )... 5 デモ機 CUnet I/O MAP... 6 2 バイト長以上のデータの読み書き... 8 VB2008

More information

印刷

印刷 印刷 Windows フォームに於ける印刷のサポート Windows フォームに於ける印刷では 主に ユーザーに依る印刷を可能にする為の PrintDocument コンポーネントと Windows オペレーティングシステムを常用して居るユーザーに見慣れたグラフィカルインターフェイスを提供する為の PrintPreviewDialog コントロール PrintDialog コンポーネント 及び PageSetupDialog

More information

WinHPC ppt

WinHPC ppt MPI.NET C# 2 2009 1 20 MPI.NET MPI.NET C# MPI.NET C# MPI MPI.NET 1 1 MPI.NET C# Hello World MPI.NET.NET Framework.NET C# API C# Microsoft.NET java.net (Visual Basic.NET Visual C++) C# class Helloworld

More information

GPC-4116

GPC-4116 HDLC(PCI/C-PCI) GPC-4116 HDLC 通信インタフェースモジュール用 Windows ドライバ Help for Windows www.interface.co.jp 目次 第 1 章はじめに 3 1.1 概要... 3 1.2 特長... 3 第 2 章製品仕様 4 2.1 基本仕様... 4 2.2 製品構成... 6 第 3 章導入方法 8 3.1 インストール手順...

More information

C++ ++ Wago_io.dll DLLDynamicLinkLibrary Microsoft VisualBasic Visual C Wago_io.dll Wago_io.dll Wago_io.dll WAGO_OpenCommPort WAGO_CloseCommPort WAGO_

C++ ++ Wago_io.dll DLLDynamicLinkLibrary Microsoft VisualBasic Visual C Wago_io.dll Wago_io.dll Wago_io.dll WAGO_OpenCommPort WAGO_CloseCommPort WAGO_ Ethernet, CDROM DLL Setupexe Setup.exe WAGOIO Wago_io wago2002 WAGO_IO DLL WAGO_IO.DLL Windows Windows System32 Wago_io.dll Program Files Wago_io Wago_io Readme.txt C Sample.exe Wago_dll.h C Config.def

More information

Prog2_12th

Prog2_12th 2018 年 12 月 13 日 ( 木 ) 実施クラスの継承オブジェクト指向プログラミングの基本的な属性として, 親クラスのメンバを再利用, 拡張, または変更する子クラスを定義することが出来る メンバの再利用を継承と呼び, 継承元となるクラスを基底クラスと呼ぶ また, 基底クラスのメンバを継承するクラスを, 派生クラスと呼ぶ なお, メンバの中でコンストラクタは継承されない C# 言語では,Java

More information

Visual Studio と.NET Framework 概要 Runtime Libraries Languag es Tool.NET Visual Studio 概要 http://download.microsoft.com/download/c/7/1/c710b336-1979-4522-921b-590edf63426b/vs2010_guidebook_pdf.zip 1.

More information

GPC-4161

GPC-4161 COM-EX(PCI/C-PCI) GPC-4161 調歩同期シリアル通信インタフェースモジュール用 Windows ドライバ Help for Windows www.interface.co.jp COM-EX(PCI/C-PCI) 2002 Interface Corporation. All rights reserved. 2 目次 第 1 章はじめに...5 1.1 概要...5 1.2

More information

ListViewコントロール

ListViewコントロール ListView コントロール ListView コントロールへ項目を追加 本稿では.NET Framework の標準コントロールで有る ListView コントロール (System.Windows.Forms 名前空間 ) を活用する為に ListView コントロールにデータを追加する方法を紹介する ListView コントロールは データ項目をアイコン表示や詳細表示等に依り一覧表示する為の物で

More information

バスケットボール

バスケットボール バスケットボール きょうつうへんすうせんげん 共通の変数を宣言する ひょうじ 1. ソリューションエクスプローラで コードの表示をクリックする つぎひょうじところしたかこにゅうりょく 2. 次のコードが表示されるので 1の所に 下の囲いのコードを入力する Imports System.Runtime.InteropServices Public Class Basketball にゅうりょく 1 ここに入力する!

More information

平成 30 年度 プログラミング研修講座 岩手県立総合教育センター

平成 30 年度 プログラミング研修講座 岩手県立総合教育センター 平成 30 年度 プログラミング研修講座 岩手県立総合教育センター 目次第 1 章プログラミングについて 1 ソフトウェアの働き 1 2 プログラミング言語 1 3 主なプログラミング言語の歴史 2 第 2 章 Visual Basic について 1 Visual Basic とは 3 2.NET Framework の環境 3 3 Visual Basic と.NET Framework の関係

More information

卒業論文.PDF

卒業論文.PDF 234 1 1 1.1 1 1.2 4 1.3 4 2 5 2.1 5 2.2 6 2.3 7 2.3.1 7 2.3.2 8 2.3.3 9 2.3.4 9 2.3.5 9 2.3.6 9 3 1 3.1 3.2 3.3 11 3.4 14 3.4.1 14 3.4.2 15 3.5 16 3.6 17 i 4 2 18 4.1 18 4.2 19 4.2.1 2m/sec 2 4.2.2 3m/sec

More information

ホームページ (URL) を開く 閉じる 益永八尋 VBA からホームページを開いたり 閉じたりします ホームページを開くはシート名 HP_Open で操作し ホームページを閉じるはシート名 "HP_Close" で操作します ホームページを開く方法はいくつかありますがここでは 1 例のみを表示します なお これは Web から入手したサンプルプログラムから使い勝手が良いように修正 追加したものです

More information

CommandMatrix_8230E

CommandMatrix_8230E 4. USB 4. USB 4.1 USB2.0 Full Speed USB (Universal Serial Bus) USB 4.2 USB : USB2.0 Full Speed : USB B : A112010 USB(A) -USB B 1 m ID: MYID 1 127 : : ASCII : ASCII : ADC USB 4.3 USB 4.3.1 ADC USB ADC USB

More information

ドライブは安全運転で in 滋賀♪

ドライブは安全運転で in 滋賀♪ 烏賊セーバー VB 2005 71 プログラムの概要 可愛い烏賊が 画面を泳ぐスクリーンセーバーで有る 烏賊の数 背景 ( 黒一色かデスクトップ画面 ) を設定する事が出来る 背景が 黒一色の場合は 単に烏賊が 左右から現れては 反対側に泳いで行く丈だが デスクトップ画面の場合は 徐々に背景が烏賊の形に塗り潰されて行く スクリーンセーバーの本来の目的は ディスプレイの焼き付きを防止する事で有るが 現在では

More information

API-PAC(W32)RM/AIO

API-PAC(W32)RM/AIO PC-MODULE / PC-HELPER API-PAC(W32) AIO http://www.contec.co.jp/ http://www.contec.com/ http://www.contec.com.cn/ PDF / ( ) E-mail(tsc@contec.co.jp) FAX E-mail Question FAX Question FAX Question API-PAC(W32)RM/AIO

More information

コンピュータ概論

コンピュータ概論 5.1 VBA VBA Check Point 1. 2. 5.1.1 ( bug : ) (debug) On Error On Error On Error GoTo line < line > 5.1.1 < line > Cells(i, j) i, j 5.1.1 MsgBox Err.Description Err1: GoTo 0 74 Visual Basic VBA VBA Project

More information

型名 RF007 ラジオコミュニケーションテスタ Radio Communication Tester ソフトウェア開発キット マニュアル アールエフネットワーク株式会社 RFnetworks Corporation RF007SDK-M001 RF007SDK-M001 参考資料 1

型名 RF007 ラジオコミュニケーションテスタ Radio Communication Tester ソフトウェア開発キット マニュアル アールエフネットワーク株式会社 RFnetworks Corporation RF007SDK-M001 RF007SDK-M001 参考資料 1 型名 RF007 ラジオコミュニケーションテスタ Radio Communication Tester ソフトウェア開発キット マニュアル アールエフネットワーク株式会社 RFnetworks Corporation RF007SDK-M001 RF007SDK-M001 参考資料 1 第 1 章製品概要本開発キットは RF007 ラジオコミュニケーションテスタ ( 本器 ) を使用したソフトウェアを開発するためのライブラリソフトウェアです

More information

データアダプタ概要

データアダプタ概要 データベース TableAdapter クエリを実行する方法 TableAdapter クエリは アプリケーションがデータベースに対して実行出来る SQL ステートメントやストアドプロシージャで TableAdapter で型指定されたメソッドと仕て公開される TableAdapter クエリは 所有るオブジェクトのメソッドと同様に 関連付けられたメソッドを呼び出す事に依り実行出来る TableAdapter

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション プロシージャ プロシージャの種類 Subプロシージャ Functionプロシージャ Propertyプロシージャ Sub プロシージャ Subステートメント~ステートメントで囲まれる 実行はするけど 値は返さない 途中で抜けたいときは Exit Sub を行なう Public Sub はマクロの実行候補に表示される Sub プロシージャの例 Public Sub TestSubProc() Call

More information

~ ユーザーインターフェイスの自動テスト ~

~ ユーザーインターフェイスの自動テスト ~ ~ ユーザーインターフェイスの自動テスト ~ 著作権 このドキュメントに記載されている情報は このドキュメントの発行時点におけるマクロソフトの見解を反映したものです マクロソフトは市場の変化に対応する必要があるため このドキュメントの内容に関する責任を問われないものとします また 発行日以降に発表される情報の正確性を保証できません このホワトペーパーは情報提供のみを目的としています 明示 黙示 または法令に基づく規定に関わらず

More information

ファイル操作-バイナリファイル

ファイル操作-バイナリファイル ファイル操作 バイナリ ファイルを読み書きする バイナリファイル ( 即ちテキストファイル以外のファイル ) を読み書きするには FileStream クラス (System.IO 名前空間 ) を利用する FileStream クラスはファイル用のストリームをサポートするクラスで有り Stream クラス (System.IO 名前空間 ) の派生クラスの 1 つで有る 基本的には コンストラクタで指定したファイルのストリームに対して

More information

USB汎用インターフェース・キット ガイドブック

USB汎用インターフェース・キット ガイドブック 57 CreateFile CreateFile DeviceIOControl CloseHandle DeviceIOControl DeviceIOControl 58 DeviceIOControl lpinbuffer ninbuffersize lpoutbuffer CreateFile InBuffer InBuffer OutBuffer OutBuffer Dim result

More information

チア ダンス

チア ダンス チアダンス きょうつうへんすうこうぞうたいせんげん 共通の変数や構造体を宣言する せんたくひょうじ 1. ソリューションエクスプローラで CheerDance.vb を選択し コードの表示をクリックする 2. 次のコードが表示されるので 1の所に 下の囲いのコードを入力する Imports System.IO Public Class frmmain 1 ここに入力する! End Class Private

More information

Title.PDF

Title.PDF WebServer Option Ver 2.0: IIS Web VisualBasic 6 MapExpert WebServer MetaWare Research WebServer Option 2.0 WebServer Option 1.0 WebServer Option Ver 2.0 MapExpert Ver 4.45 MapExpert Ver 4.45 WebServer

More information

1/6 ページ プログラミングするなら Microsoft Visual Studio 2005 シンプルでパワフルな C# の最新版 www.defyallchallenges.jp/.net Tips (VB.NET, C#, Visual Studio...).NET Frameworkプログラミング, Visual Basic.NET, C#, Visual Studio, デプロイメントなどのTips

More information