<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Shortcut for Finish button from UIDocument.Selection.PickObjects()? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/shortcut-for-finish-button-from-uidocument-selection-pickobjects/m-p/12726604#M40381</link>
    <description>&lt;P&gt;Hi, the following steps work for my project even if I restart the Revit app and open in different files,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Firstly, import these functionalities:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;[DllImport("user32.dll")] 
private static extern IntPtr GetWindow(IntPtr hwndParent, uint uCmd); 

[DllImport("user32.dll")] 
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); 

[DllImport("user32.dll")] 
private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); 

[DllImport("user32.dll", CharSet = CharSet.Auto)] 
private static extern IntPtr SendMessage(IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then check the structures of handles from the Revit App - current File to the Finish Button as jlpgy mentioned:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="handle0.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1353222i5888B595ACC338C0/image-size/large?v=v2&amp;amp;px=999" role="button" title="handle0.png" alt="handle0.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for example in the ui of Revit 2024:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. get the main app handle via FindWindow() or simply using the function RevitAPI provided&lt;/P&gt;&lt;P&gt;2. get the control bar handle via FindWindowEX()&lt;/P&gt;&lt;P&gt;3. get the first dialog handle&amp;nbsp;via FindWindowEX() or GetWindow()&amp;nbsp;&lt;/P&gt;&lt;P&gt;4. repeatedly get the dialog handle via GetWindow() until there's a child handle matches the target button&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;finally use SendMessage() to send BM_CLICK message&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;according to the document of GetWindow() method &amp;nbsp;&lt;/P&gt;&lt;P&gt;type 5 == GW_CHILD &amp;nbsp; type 2 == GW_HWNDNEXT&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.pinvoke.net/default.aspx/user32/GetWindow.html" target="_blank"&gt;pinvoke.net: GetWindow (user32)&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Apr 2024 03:31:59 GMT</pubDate>
    <dc:creator>zefreestijl</dc:creator>
    <dc:date>2024-04-23T03:31:59Z</dc:date>
    <item>
      <title>Shortcut for Finish button from UIDocument.Selection.PickObjects()?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/shortcut-for-finish-button-from-uidocument-selection-pickobjects/m-p/8972899#M40375</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you know there are a couple of buttons(Finish &amp;amp; Cancel) from&amp;nbsp;&lt;SPAN&gt;UIDocument.Selection.&lt;/SPAN&gt;&lt;SPAN&gt;PickObjects().&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I know ESC is for Cancel, however, the shortcut for Finish hasn't been found out yet.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Does anyone know if the shortcut exists? Or is there a way to set up?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 06:01:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/shortcut-for-finish-button-from-uidocument-selection-pickobjects/m-p/8972899#M40375</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-19T06:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: Shortcut for Finish button from UIDocument.Selection.PickObjects()?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/shortcut-for-finish-button-from-uidocument-selection-pickobjects/m-p/8973008#M40376</link>
      <description>&lt;P&gt;HI&amp;nbsp;@Anonymous&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I think in Revit there is no shortcut option for finish.&lt;/P&gt;
&lt;P&gt;You can only finish your selection by clicking the Finish button.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is a button option for finish then it would have been mentioned here(REFER THE ATTACHED IMAGE)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PickObjects.png" style="width: 566px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/668019i15507D80BC0E73D4/image-size/large?v=v2&amp;amp;px=999" role="button" title="PickObjects.png" alt="PickObjects.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 07:05:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/shortcut-for-finish-button-from-uidocument-selection-pickobjects/m-p/8973008#M40376</guid>
      <dc:creator>naveen.kumar.t</dc:creator>
      <dc:date>2019-08-19T07:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: Shortcut for Finish button from UIDocument.Selection.PickObjects()?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/shortcut-for-finish-button-from-uidocument-selection-pickobjects/m-p/8977688#M40377</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5661631" target="_blank" rel="noopener"&gt;naveen.kumar.t&lt;/A&gt;!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are my hero!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 07:45:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/shortcut-for-finish-button-from-uidocument-selection-pickobjects/m-p/8977688#M40377</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-21T07:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: Shortcut for Finish button from UIDocument.Selection.PickObjects()?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/shortcut-for-finish-button-from-uidocument-selection-pickobjects/m-p/9176465#M40378</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5661631"&gt;@naveen.kumar.t&lt;/a&gt;:&lt;/P&gt;&lt;P&gt;Actually it can be done! But the safety of the following solution is not guaranteed:&lt;/P&gt;&lt;PRE&gt;// Codes working for this funcion in our product has been highly wrapped with annoying complexity&lt;/PRE&gt;&lt;P&gt;Let's ask "Spy++" for some help.&lt;/P&gt;&lt;P&gt;This tool should be named as "spyxx.exe" or "spyxx_amd64.exe" if the C++ desktop develop workload has been installed:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-12-02_150300.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/703306iA91E4EF46962A5C8/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-12-02_150300.png" alt="2019-12-02_150300.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then we can check some detailed infomation of the "Finish" button:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-12-02_150912.png" style="width: 922px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/703308i310730713FCE24EF/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-12-02_150912.png" alt="2019-12-02_150912.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-12-02_151247.png" style="width: 875px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/703309i3325A6F5CC526293/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-12-02_151247.png" alt="2019-12-02_151247.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Once you have recursively searched all children windows of Revit Windle, and got the Finish Button, send a CLICK message to this button (window):&lt;/P&gt;&lt;PRE&gt;SendMessage(revitHandle, 0x00F5, new IntPtr(0), IntPtr.Zero);&lt;BR /&gt;// revitHandle can be accesed easily in 2019 API&lt;/PRE&gt;&lt;P&gt;++ This solution works fine from Revit 2016 to 2020 ++&lt;/P&gt;&lt;P&gt;But safety is still not guaranteed &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 07:22:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/shortcut-for-finish-button-from-uidocument-selection-pickobjects/m-p/9176465#M40378</guid>
      <dc:creator>jlpgy</dc:creator>
      <dc:date>2019-12-02T07:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: Shortcut for Finish button from UIDocument.Selection.PickObjects()?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/shortcut-for-finish-button-from-uidocument-selection-pickobjects/m-p/11505033#M40379</link>
      <description>&lt;P&gt;I'd also be interested in this solution. Could you provide a bit more context here, i.e. what are SendMessage, revitHandle, etc.?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2022 19:41:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/shortcut-for-finish-button-from-uidocument-selection-pickobjects/m-p/11505033#M40379</guid>
      <dc:creator>grubdex</dc:creator>
      <dc:date>2022-10-24T19:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Shortcut for Finish button from UIDocument.Selection.PickObjects()?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/shortcut-for-finish-button-from-uidocument-selection-pickobjects/m-p/12726604#M40381</link>
      <description>&lt;P&gt;Hi, the following steps work for my project even if I restart the Revit app and open in different files,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Firstly, import these functionalities:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;[DllImport("user32.dll")] 
private static extern IntPtr GetWindow(IntPtr hwndParent, uint uCmd); 

[DllImport("user32.dll")] 
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); 

[DllImport("user32.dll")] 
private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); 

[DllImport("user32.dll", CharSet = CharSet.Auto)] 
private static extern IntPtr SendMessage(IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then check the structures of handles from the Revit App - current File to the Finish Button as jlpgy mentioned:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="handle0.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1353222i5888B595ACC338C0/image-size/large?v=v2&amp;amp;px=999" role="button" title="handle0.png" alt="handle0.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for example in the ui of Revit 2024:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. get the main app handle via FindWindow() or simply using the function RevitAPI provided&lt;/P&gt;&lt;P&gt;2. get the control bar handle via FindWindowEX()&lt;/P&gt;&lt;P&gt;3. get the first dialog handle&amp;nbsp;via FindWindowEX() or GetWindow()&amp;nbsp;&lt;/P&gt;&lt;P&gt;4. repeatedly get the dialog handle via GetWindow() until there's a child handle matches the target button&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;finally use SendMessage() to send BM_CLICK message&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;according to the document of GetWindow() method &amp;nbsp;&lt;/P&gt;&lt;P&gt;type 5 == GW_CHILD &amp;nbsp; type 2 == GW_HWNDNEXT&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.pinvoke.net/default.aspx/user32/GetWindow.html" target="_blank"&gt;pinvoke.net: GetWindow (user32)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 03:31:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/shortcut-for-finish-button-from-uidocument-selection-pickobjects/m-p/12726604#M40381</guid>
      <dc:creator>zefreestijl</dc:creator>
      <dc:date>2024-04-23T03:31:59Z</dc:date>
    </item>
  </channel>
</rss>

