Option Strict Off
Option Explicit On
Friend Class Form1
	Inherits System.Windows.Forms.Form
#Region "Windows tH[ fUCiɂĐꂽR[h"
	Public Sub New()
		MyBase.New()
		If m_vb6FormDefInstance Is Nothing Then
			If m_InitializingDefInstance Then
				m_vb6FormDefInstance = Me
			Else
				Try 
					'X^[gAbv tH[ɂẮAŏɍ쐬ꂽCX^XCX^XɂȂ܂B
					If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
						m_vb6FormDefInstance = Me
					End If
				Catch
				End Try
			End If
		End If
		'̌ĂяóAWindows tH[ fUCiŕKvłB
		InitializeComponent()
	End Sub
	'Form ́AR|[lgꗗɌ㏈s邽߂ dispose I[o[Ch܂B
	Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
		If Disposing Then
			If Not components Is Nothing Then
				components.Dispose()
			End If
		End If
		MyBase.Dispose(Disposing)
	End Sub
	'Windows tH[ fUCiŕKvłB
	Private components As System.ComponentModel.IContainer
    Public WithEvents Command10 As System.Windows.Forms.Button
	Public WithEvents Command9 As System.Windows.Forms.Button
	Public WithEvents Command8 As System.Windows.Forms.Button
	Public WithEvents Command7 As System.Windows.Forms.Button
	Public WithEvents Command6 As System.Windows.Forms.Button
	Public WithEvents Command5 As System.Windows.Forms.Button
	Public WithEvents Command4 As System.Windows.Forms.Button
	Public WithEvents Command3 As System.Windows.Forms.Button
	Public WithEvents Command2 As System.Windows.Forms.Button
	Public WithEvents Command1 As System.Windows.Forms.Button
	' : ȉ̃vV[W Windows tH[ fUCiŕKvłB
	'Windows tH[ fUCigĕύXł܂B
	'R[h GfB^gďCȂłB
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Command10 = New System.Windows.Forms.Button()
        Me.Command9 = New System.Windows.Forms.Button()
        Me.Command8 = New System.Windows.Forms.Button()
        Me.Command7 = New System.Windows.Forms.Button()
        Me.Command6 = New System.Windows.Forms.Button()
        Me.Command5 = New System.Windows.Forms.Button()
        Me.Command4 = New System.Windows.Forms.Button()
        Me.Command3 = New System.Windows.Forms.Button()
        Me.Command2 = New System.Windows.Forms.Button()
        Me.Command1 = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'Command10
        '
        Me.Command10.BackColor = System.Drawing.SystemColors.Control
        Me.Command10.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command10.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command10.Location = New System.Drawing.Point(24, 136)
        Me.Command10.Name = "Command10"
        Me.Command10.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command10.Size = New System.Drawing.Size(113, 33)
        Me.Command10.TabIndex = 9
        Me.Command10.Text = "Set highlimit internal temp.(35)"
        Me.Command10.UseVisualStyleBackColor = False
        '
        'Command9
        '
        Me.Command9.BackColor = System.Drawing.SystemColors.Control
        Me.Command9.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command9.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command9.Location = New System.Drawing.Point(168, 136)
        Me.Command9.Name = "Command9"
        Me.Command9.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command9.Size = New System.Drawing.Size(113, 33)
        Me.Command9.TabIndex = 8
        Me.Command9.Text = "Set Highlimit internal temp.(60)"
        Me.Command9.UseVisualStyleBackColor = False
        '
        'Command8
        '
        Me.Command8.BackColor = System.Drawing.SystemColors.Control
        Me.Command8.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command8.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command8.Location = New System.Drawing.Point(168, 176)
        Me.Command8.Name = "Command8"
        Me.Command8.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command8.Size = New System.Drawing.Size(113, 33)
        Me.Command8.TabIndex = 7
        Me.Command8.Text = "Digital Input"
        Me.Command8.UseVisualStyleBackColor = False
        '
        'Command7
        '
        Me.Command7.BackColor = System.Drawing.SystemColors.Control
        Me.Command7.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command7.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command7.Location = New System.Drawing.Point(24, 176)
        Me.Command7.Name = "Command7"
        Me.Command7.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command7.Size = New System.Drawing.Size(113, 33)
        Me.Command7.TabIndex = 6
        Me.Command7.Text = "Status Read"
        Me.Command7.UseVisualStyleBackColor = False
        '
        'Command6
        '
        Me.Command6.BackColor = System.Drawing.SystemColors.Control
        Me.Command6.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command6.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command6.Location = New System.Drawing.Point(168, 96)
        Me.Command6.Name = "Command6"
        Me.Command6.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command6.Size = New System.Drawing.Size(113, 33)
        Me.Command6.TabIndex = 5
        Me.Command6.Text = "Set highlimit external temp.(60)"
        Me.Command6.UseVisualStyleBackColor = False
        '
        'Command5
        '
        Me.Command5.BackColor = System.Drawing.SystemColors.Control
        Me.Command5.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command5.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command5.Location = New System.Drawing.Point(24, 96)
        Me.Command5.Name = "Command5"
        Me.Command5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command5.Size = New System.Drawing.Size(113, 33)
        Me.Command5.TabIndex = 4
        Me.Command5.Text = "Set highlimit external temp.(35)"
        Me.Command5.UseVisualStyleBackColor = False
        '
        'Command4
        '
        Me.Command4.BackColor = System.Drawing.SystemColors.Control
        Me.Command4.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command4.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command4.Location = New System.Drawing.Point(168, 56)
        Me.Command4.Name = "Command4"
        Me.Command4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command4.Size = New System.Drawing.Size(113, 33)
        Me.Command4.TabIndex = 3
        Me.Command4.Text = "Digital Output(00H)"
        Me.Command4.UseVisualStyleBackColor = False
        '
        'Command3
        '
        Me.Command3.BackColor = System.Drawing.SystemColors.Control
        Me.Command3.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command3.Location = New System.Drawing.Point(24, 56)
        Me.Command3.Name = "Command3"
        Me.Command3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command3.Size = New System.Drawing.Size(113, 33)
        Me.Command3.TabIndex = 2
        Me.Command3.Text = "Digital Output(5AH)"
        Me.Command3.UseVisualStyleBackColor = False
        '
        'Command2
        '
        Me.Command2.BackColor = System.Drawing.SystemColors.Control
        Me.Command2.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command2.Location = New System.Drawing.Point(168, 16)
        Me.Command2.Name = "Command2"
        Me.Command2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command2.Size = New System.Drawing.Size(113, 33)
        Me.Command2.TabIndex = 1
        Me.Command2.Text = "WDT Stop"
        Me.Command2.UseVisualStyleBackColor = False
        '
        'Command1
        '
        Me.Command1.BackColor = System.Drawing.SystemColors.Control
        Me.Command1.Cursor = System.Windows.Forms.Cursors.Default
        Me.Command1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Command1.Location = New System.Drawing.Point(24, 16)
        Me.Command1.Name = "Command1"
        Me.Command1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Command1.Size = New System.Drawing.Size(113, 33)
        Me.Command1.TabIndex = 0
        Me.Command1.Text = "WDT Start(10sec)"
        Me.Command1.UseVisualStyleBackColor = False
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 12)
        Me.BackColor = System.Drawing.SystemColors.Control
        Me.ClientSize = New System.Drawing.Size(307, 214)
        Me.Controls.Add(Me.Command10)
        Me.Controls.Add(Me.Command9)
        Me.Controls.Add(Me.Command8)
        Me.Controls.Add(Me.Command7)
        Me.Controls.Add(Me.Command6)
        Me.Controls.Add(Me.Command5)
        Me.Controls.Add(Me.Command4)
        Me.Controls.Add(Me.Command3)
        Me.Controls.Add(Me.Command2)
        Me.Controls.Add(Me.Command1)
        Me.Cursor = System.Windows.Forms.Cursors.Default
        Me.Location = New System.Drawing.Point(251, 195)
        Me.Name = "Form1"
        Me.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
        Me.Text = "Sample Application(VBN)"
        Me.ResumeLayout(False)

    End Sub
#End Region 
#Region "AbvO[h EBU[h̃T|[g R[h"
	Private Shared m_vb6FormDefInstance As Form1
	Private Shared m_InitializingDefInstance As Boolean
	Public Shared Property DefInstance() As Form1
		Get
			If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
				m_InitializingDefInstance = True
				m_vb6FormDefInstance = New Form1()
				m_InitializingDefInstance = False
			End If
			DefInstance = m_vb6FormDefInstance
		End Get
		Set
			m_vb6FormDefInstance = Value
		End Set
	End Property
#End Region 
	Private defaultExtLimit As Byte ' Ox~bgl̕ۑp
	Private defaultIntLimit As Byte ' x~bgl̕ۑp
	Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
        Dim dwWdtTimerValue As Integer
		' WDT̃ZbgX^[g
		Dim lRetVal1 As Integer
        dwWdtTimerValue = 10000
        lRetVal1 = fcrasResetAndStartWDT(dwWdtTimerValue)
        MsgBox("Return Value = " & lRetVal1, MsgBoxStyle.Information, "WDT Start (10sec)")
	End Sub
	
	Private Sub Command10_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command10.Click
        Dim byIntLimitData As Byte
		' x̋elݒ
		Dim lRetVal10 As Integer
        byIntLimitData = 70
        lRetVal10 = fcrasIntLimitOut(byIntLimitData)
        MsgBox("Return Value = " & lRetVal10, MsgBoxStyle.Information, "Set internal temp.(+35)")
		
	End Sub
	
	Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click
		' WDT̃Xgbv
		Dim lRetVal2 As Integer
		lRetVal2 = fcrasStopWDT()
        MsgBox("Return Value = " & lRetVal2, MsgBoxStyle.Information, "WDT Stop")
	End Sub
	
	Private Sub Command3_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command3.Click
        Dim byDigitalOutData As Byte
		' fW^f[^̏o
		Dim lRetVal3 As Integer
        byDigitalOutData = &H5A
        lRetVal3 = fcrasDigitalOut(byDigitalOutData)
        MsgBox("Return Value = " & lRetVal3, MsgBoxStyle.Information, "Digtal Output(5AH)")
	End Sub
	
	Private Sub Command4_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command4.Click
        Dim byDigitalOutData As Byte
		' fW^f[^̃NA
		Dim lRetVal4 As Integer
        byDigitalOutData = &H0S
        lRetVal4 = fcrasDigitalOut(byDigitalOutData)
        MsgBox("Return Value = " & lRetVal4, MsgBoxStyle.Information, "Digital Output(00h)")
	End Sub
	
	Private Sub Command5_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command5.Click
        Dim byExtLimitData As Byte
		' Ox̋elݒ
		Dim lRetVal5 As Integer
        byExtLimitData = 70
        lRetVal5 = fcrasExtLimitOut(byExtLimitData)
        MsgBox("Return Value = " & lRetVal5, MsgBoxStyle.Information, "Set external temp.(+35)")
	End Sub
	
	Private Sub Command6_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command6.Click
        Dim byExtLimitData As Byte
		' VZOf[^f[^̃NA
        Dim lRetVal6 As Integer
        byExtLimitData = 120
        lRetVal6 = fcrasExtLimitOut(byExtLimitData)
        MsgBox("Return Value = " & lRetVal6, MsgBoxStyle.Information, "Set externla temp.(+60)")
	End Sub
	
	Private Sub Command7_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command7.Click
        Dim lpbyRasStatusX009 As FCRAS_STATUSX009
        ' RAS{[h̑SXe[^X̎擾
        Dim lRetVal7 As Integer
        lRetVal7 = fcrasGetStatusX009(lpbyRasStatusX009)
		With lpbyRasStatusX009
            MsgBox("Return Value = " & lRetVal7 & vbCrLf & "Status1 = " & (.Status1) & "(" & Hex(.Status1) & "h)" & vbCrLf & "Status2 = " & (.Status2) & "(" & Hex(.Status2) & "h)" & vbCrLf & "Status3 = " & (.Status3) & "(" & Hex(.Status3) & "h)" & vbCrLf & "Status4 = " & (.Status4) & "(" & Hex(.Status4) & "h)" & vbCrLf & "Status5 = " & (.Status5) & "(" & Hex(.Status5) & "h)" & vbCrLf & "Status6 = " & (.Status6) & "(" & Hex(.Status6) & "h)" & vbCrLf & "Status7 = " & (.Status7) & "(" & Hex(.Status7) & "h)" & vbCrLf & "Status8 = " & (.Status8) & "(" & Hex(.Status8) & "h)" & vbCrLf & "Status9 = " & (.Status9) & "(" & Hex(.Status9) & "h)", MsgBoxStyle.Information, "Status Read")
		End With
	End Sub
	
	Private Sub Command8_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command8.Click
        Dim byDigitalInData As Byte
        ' fW^̓f[^l̎擾
		Dim lRetVal8 As Integer
        lRetVal8 = fcrasDigitalIn(byDigitalInData)
        MsgBox("Return Value = " & lRetVal8 & vbCrLf & "Input Valuse = " & byDigitalInData, MsgBoxStyle.Information, "Digital Input")
	End Sub
	
	Private Sub Command9_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command9.Click
        Dim byIntLimitData As Byte
		' x̋elݒ
		Dim lRetVal9 As Integer
        byIntLimitData = 120
        lRetVal9 = fcrasIntLimitOut(byIntLimitData)
        MsgBox("Return Value = " & lRetVal9, MsgBoxStyle.Information, "Set internal temp.(+60)")
		
	End Sub
	
	Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		If (UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0) Then
			On Error Resume Next
            Call AppActivate(CStr(Me.Text))
			End
		End If
		
        Call fcsoftrasOpen()

        ' NɊOx^x̃~bg擾sB
		Call fcrasGetExtLimit(defaultExtLimit)
		Call fcrasGetIntLimit(defaultIntLimit)
	End Sub
	
    Private Sub Form1_Closed(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Closed
        ' IɊOx^x̃~bglN̒lɖ߂B
        Call fcrasExtLimitOut(defaultExtLimit)
        Call fcrasIntLimitOut(defaultIntLimit)

        Call fcsoftrasClose()
    End Sub
End Class