2014-06-25 6 views
0

나는 WatIn과 함께 작업하고 saveAs 대화 상자를 사용하여 파일을 저장하지만이 프로세스가 중지되는 Windows/PC를 잠그면 Invoke를 SendMessage로 캐스팅해야 내 PC가 잠길 때이 프로세스가 계속 실행됩니다.SendMessage로 호출

이 방법이 있습니까? 컴퓨터가 잠겨있을 때 호출

private static void ClickSaveAs(AutomationElement mainWindow, AutomationElementCollection dialogElements, string filename) 
     { 


      foreach (AutomationElement element in dialogElements) 
      { 

       if (element.Current.Name.Equals("Save")) 
       { 
        AutomationElementCollection dialogSubElements = element.FindAll(TreeScope.Children, Automation.ContentViewCondition); 
        InvokePattern clickPatternForSaveDropdown = (InvokePattern)dialogSubElements[0].GetCurrentPattern(AutomationPattern.LookupById(10000)); 
       //I need to change this to.. 
        clickPatternForSaveDropdown.Invoke(); 

//This 
        //start 
        int intWhdr = FindWindow("IEFrame", ""); 
        int currChild = FindWindowEx(intWhdr, 0, "", "Frame Notification Bar"); 
        currChild = 104755016; 
        int intRes1 = SendMessage(currChild, WM_LBUTTONDOWN, 0, 0); 
        System.Threading.Thread.Sleep(100); 
        intRes1 = SendMessage(currChild, WM_LBUTTONUP, 0, 1); 
        System.Threading.Thread.Sleep(200); 
        //end 
        Thread.Sleep(1500); 

        AutomationElementCollection dialogElementsInMainWindow = mainWindow.FindAll(TreeScope.Children, Condition.TrueCondition); 
        foreach (AutomationElement currentMainWindowDialogElement in dialogElementsInMainWindow) 
        { 
         if (currentMainWindowDialogElement.Current.LocalizedControlType == "menu") 
         { 
          // first array element 'Save', second array element 'Save as', third second array element 'Save and open' 
          InvokePattern clickMenu = (InvokePattern)currentMainWindowDialogElement.FindAll(TreeScope.Children, Condition.TrueCondition)[1].GetCurrentPattern(AutomationPattern.LookupById(10000)); 
          clickMenu.Invoke(); 
          Thread.Sleep(1); 
          ControlSaveDialog(mainWindow, filename); 
          break; 
          //strt 


          //end 
         } 
        } 
       } 
      } 
     } 

답변

0

Watin와 코드의

가 파이스가 작동하지 않습니다. Microsoft.mshtml과 Interop.SHDocVw 이진 참조를 사용하기 때문에. 이러한 바이너리는 COM 구성 요소이며 대화 형 UI가 필요합니다. 샘플의 경우 다운로드 대신 로그인 자체를 시도 할 수 있습니다. 테스트를 시작하고 기기를 잠그고 잠금을 해제하십시오. 결과를 관찰하면 COM 예외와 같은 오류가 발생하지 않을 것입니다 ... Reg 키 업데이트를 사용하여 옵션으로 기계의 잠금을 영구적으로 해제하십시오 ...