프로젝트

일반

사용자정보

통계
| 개정판:

hytos / DTI_PID / SPPIDConverter / FindOpc.vb @ d45df999

이력 | 보기 | 이력해설 | 다운로드 (1.33 KB)

1
Public Class FindOpc
2

    
3

    
4
    'Dialog Caption : Set Stockpile Location of Partner OPC
5
    'Dialog Class : ThunderRT6FormDC
6
    Private Declare Auto Function FindWindow Lib "user32.dll" (
7
ByVal lpClassName As String,
8
ByVal lpWindowName As String
9
) As IntPtr
10

    
11
    Private Declare Auto Function FindWindowEx Lib "user32.dll" (
12
ByVal hwndParent As IntPtr,
13
ByVal hwndChildAfter As IntPtr,
14
ByVal lpszClass As String,
15
ByVal lpszWindow As String
16
) As IntPtr
17

    
18
    Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long,
19
ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
20

    
21
    Private Declare Auto Function SendMessage Lib "user32.dll" (
22
hWnd As IntPtr, uMsg As Int32, WParam As IntPtr, LParam As IntPtr
23
) As IntPtr
24

    
25
    Private Const WM_CLOSE As Long = &H10
26
    Private Declare Function SetFocus Lib "user32" (ByVal hwnd As Long) As Long
27

    
28
    Public Sub RemoveOPCDlg()
29
        Try
30
            Dim iHandle As Integer = FindWindow("ThunderRT6FormDC", "Set Stockpile Location of Partner OPC")
31
            If iHandle > 0 Then
32
                System.Threading.Thread.Sleep(100)
33
                SendMessage(iHandle, WM_CLOSE, 0, 0) 'Press Ctrl Key
34
                System.Threading.Thread.Sleep(100)
35
                iHandle = 0
36
            End If
37
        Catch ex As Exception
38

    
39
        End Try
40
    End Sub
41

    
42

    
43
End Class
클립보드 이미지 추가 (최대 크기: 500 MB)