共用方式為


FindWindow 標記

 

發行︰ 2016年11月

適用於: Dynamics 365 (online)、Dynamics 365 (on-premises)、Dynamics CRM 2013、Dynamics CRM 2015、Dynamics CRM 2016

<FindWindow> 標記內的子元素清單代表符合作業順序,所有作業需要成功,才表示找到目標視窗。

下列程式碼片段顯示不同 <FindWindow> 元素如何用來尋找目標視窗:

# RELAX NG XML grammar for FindWindow
# http://relaxng.org/compact-tutorial-20030326.html
grammar {
   start      = FindWindow
   FindWindow = element FindWindow {
element ControlId { attribute match { xsd:integer }?, text }*
& element Caption { attribute match { xsd:integer }?, text }*
& element CaptionStartsWith { same as Caption }*
& element CaptionEndsWith { same as Caption }*
& element CaptionContains { same as Caption }*
& element Class { attribute match { xsd:integer }?, text }*
& element ClassStartsWith { same as Class }*
& element ClassEndsWith { same as Class }*
& element ClassContains { same as Class }*
& element Find { Caption & Class }*
& element Desktop { empty }*
& element Application { empty }*
& element Owner { empty }*
& element RelaxProcessIdRestriction { empty }*
& element RelaxThreadIdRestriction  { empty }*
}
}

<FindWindow> 標記元素

下表描述 <FindWindow> 標記的各種元素:

項目

描述

ControlId

使用識別碼的視窗。

Caption

視窗標題文字。

CaptionStartsWith

標題開頭文字。

CaptionEndsWith

標題結尾文字。

CaptionContains

標題包含文字。

Class

使用類別名稱的視窗。

ClassStartsWith

類別名稱開頭文字。

ClassEndsWith

類別名稱結尾文字。

ClassContains

類別包含文字。

Find

搜尋透過 ClassCaption 元素指定的視窗。

Desktop

設定搜尋點為桌面。

Application

設定搜尋點為應用程式的最上層視窗。

Owner

具有指定的負責人的視窗。

RelaxProcessIdRestriction

在搜尋中包含不同程序識別碼的視窗。 根據預設,所有視窗屬於相同程序識別碼。

RelaxThreadIdRestriction

在搜尋程序中包含不同執行緒識別碼的視窗。 根據預設,所有視窗屬於相同執行緒識別碼。

下列 XML 顯示使用 <FindWindow> 標記的控制項定義。

<FindWindow>
<Desktop/>
<Caption match="1">Font</Caption>
<Class>#32770</Class>
<Caption>OK</Caption>
</FindWindow>
<FindWindow>
<Application/>
<ControlId>7d</ControlId>
</FindWindow>
<FindWindow>
<Desktop/>
<Class>Notepad</Class>
</FindWindow>

在前面的 XML 範例中,元素下列定義:

  • <Application/> – 將內容視窗設為應用程式的最上層視窗。 根據預設,內容初始化為 <FindWindow/> 中第一個子節點之前的最上層視窗頂端視窗。

  • <Desktop/> – 將內容視窗設為根層級桌面視窗。

  • <Caption match="1">Font</Caption> - 在視窗階層,從目前內容視窗開始並向下搜尋階層,尋找標題文字符合所提供的文字的第一個視窗。 如果 match="2",則搜尋標題文字符合所提供的文字的第二個視窗。 如果沒有提供 match 屬性,match="1" 是預設值。 文字比較是對標題文字的子字串比對。 如果在主旨視窗標題中找到所提供文字的子字串,視為符合。 成功相符的視窗變成新內容視窗。 如果找不到相符項目,搜尋失敗。 根據預設,只有屬於相同 ProcessIdThreadId 的視窗才視為符合。

  • <Class>#32770</Class> – 在視窗階層,搜尋類別文字符合所提供的文字的第一個視窗。 所有其他行為詳細資料與 <Caption/>. 相同。

  • <ControlId>7d</ControlId> – 在視窗階層,搜尋控制項識別碼符合所提供的值的第一個視窗。 這必須是完全相符。 所有其他行為詳細資料與 <Caption/> 相同。

以下 XML 從桌面開始,在具有標題 Font 和類別識別碼 32770 的第一個視窗中,搜尋具有標題 OK 的視窗。

<FindWindow>
<Desktop/>
<Caption match="1">Font</Caption>
<Class>#32770</Class>
<Caption>OK</Caption>
</FindWindow> 

下列 XML 從應用程式的最上層視窗開始尋找控制項識別碼 7D 的視窗。

<FindWindow>
<Application/>
<ControlId>7d</ControlId>
</FindWindow>

下列 XML 從桌面開始搜尋帶有類別名稱 Notepad 的 (第一個) 視窗。

<FindWindow>
<Desktop/>
<Class>Notepad</Class>
</FindWindow> 

另請參閱

WinDDA
使用資料驅動型配接器 (DDA)

Unified Service Desk 2.0

© 2017 Microsoft. 著作權所有,並保留一切權利。 著作權