다음을 통해 공유


LU2용 세션 통합자를 사용하여 메시지 받기

LU2 세션을 만든 후 및 Microsoft.HostIntegration.SNA.Session.SessionDisplay 개체를 통해 3270 콘솔에서 정보와 메시지를 검색할 Microsoft.HostIntegration.SNA.Session.ScreenData 수 있습니다.

LU2 연결을 통해 정보 수신

  1. 필요한 경우 를 사용하여 Microsoft.HostIntegration.SNA.Session.ScreenData전체 화면을 화면 덤프로 검색합니다.

    대부분의 경우 화면에서 모든 정보를 검색할 필요가 없습니다. 대신 대부분의 애플리케이션에 개체를 Microsoft.HostIntegration.SNA.Session.SessionDisplay 사용할 수 있습니다.

  2. 를 호출하여 커서의 위치를 가져옵니다 Microsoft.HostIntegration.SNA.Session.ScreenCursor.

  3. 필요에 따라 또는 메서드 중 하나 또는 Microsoft.HostIntegration.SNA.Session.SessionDisplay.GetFields%2AMicrosoft.HostIntegration.SNA.Session.SessionDisplay.CurrentField%2A 속성에 대한 호출을 사용하여 화면의 Microsoft.HostIntegration.SNA.Session.SessionDisplay.GetField%2A 다른 필드 내에 포함된 위치와 정보를 가져올 수 있습니다.

    Microsoft.HostIntegration.SNA.Session.SessionDisplay.GetField%2AMicrosoft.HostIntegration.SNA.Session.SessionDisplay.GetFields%2A 둘 다 여러 오버로드를 포함하므로 사용자가 제공하는 정보에 따라 화면에서 필드 정보를 검색할 수 있습니다. 반면 Microsoft.HostIntegration.SNA.Session.SessionDisplay.CurrentField%2A 은 커서가 현재 있는 필드만 나타냅니다.

  4. 마지막으로, 다양한 SessionDisplay.Wait 메서드를 호출하여 필드 업데이트 정보를 받을 수 있습니다.

예제

다음 코드는 Host Integration Server SDK의 3270 애플리케이션에서 가져옵니다. 샘플에서는 를 사용하여 SessionDisplay.CurrentField.Data 화면 데이터에 액세스합니다.

private void PerformTX_Click(object sender, EventArgs e)  
        {  
            try  
            {  
                // Disable every button and text box.  
                DisableEverything();  
  
                m_Handler.SendKey("@E");  
                TraceScreen();  
  
                // Wait for screen to calm down.  
                m_Handler.WaitForSession(SessionDisplayWaitType.NotBusy, 5000);  
                TraceScreen();  
  
                // See if the Balance Field is filled out.  
                m_Handler.Cursor.Row = m_row;  
                m_Handler.Cursor.Column = m_column;  
                TraceScreen();  
                // Tab to the Account Number field.  
                m_Handler.SendKey("@T");  
                TraceScreen();  
                // Move to the Next Field (Empty Stuff after 123456).  
                m_Handler.MoveNextField();  
                TraceScreen();  
                // Move to the Next Field (Title, Account Balance).  
                m_Handler.MoveNextField();  
                TraceScreen();  
                // Move to the Next Field (Account Balance).  
                m_Handler.MoveNextField();  
                TraceScreen();  
  
                // Extract Data from this field.  
                string accountBalance = m_Handler.CurrentField.Data;  
  
                // Trim the string.  
                accountBalance = accountBalance.Trim();  
  
                // Only things to do now are clear screen or disconnect.  
                EnableClearScreen();  
  
                // If we failed (not Abended) then this field will be blank.  
                if (accountBalance.Length == 0)  
                    throw new Exception("Failed to get Account Balance");  
                else  
                    MessageBox.Show(accountBalance, "Account Balance");  
            }  
            catch (Exception ex)  
            {  
                MessageBox.Show(ex.Message);  
            }  
        }  

참고 항목

LU2용 세션 통합자
LU0용 세션 통합자