<?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: Keep API dialog on top (Modal) in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469829#M39516</link>
    <description>I use the following in VB executables I run from an ACAD macro:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
*** The calling routine&lt;BR /&gt;
&lt;BR /&gt;
    mdlWindow.MakeTopMost Me.hwnd&lt;BR /&gt;
    Me.WindowState = 0&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
*** In a module I call mdlWindow.bas&lt;BR /&gt;
&lt;BR /&gt;
Private Declare Function SetWindowPos Lib "user32" _&lt;BR /&gt;
       (ByVal hwnd As Long, _&lt;BR /&gt;
        ByVal hWndInsertAfter As Long, _&lt;BR /&gt;
        ByVal x As Long, y, _&lt;BR /&gt;
        ByVal cx As Long, _&lt;BR /&gt;
        ByVal cy As Long, _&lt;BR /&gt;
        ByVal wFlags As Long) As Long&lt;BR /&gt;
&lt;BR /&gt;
Private Const HWND_TOPMOST = -1&lt;BR /&gt;
Private Const HWND_NOTOPMOST = -2&lt;BR /&gt;
Private Const SWP_NOMOVE = &amp;amp;H2&lt;BR /&gt;
Private Const SWP_NOSIZE = &amp;amp;H1&lt;BR /&gt;
Private Const SWP_NOACTIVATE = &amp;amp;H10&lt;BR /&gt;
Private Const SWP_SHOWWINDOW = &amp;amp;H40&lt;BR /&gt;
Private Const TOPMOST_FLAGS = SWP_NOMOVE Or SWP_NOSIZE&lt;BR /&gt;
&lt;BR /&gt;
Public Sub MakeTopMost(Handle As Long)&lt;BR /&gt;
    SetWindowPos Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
Public Sub MakeNormal(Handle As Long)&lt;BR /&gt;
    SetWindowPos Handle, HWND_NOTOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
It will remain stubbornly on top unless you put the minimize button on the&lt;BR /&gt;
form and click it.&lt;BR /&gt;
&lt;BR /&gt;
Lennart&lt;BR /&gt;
&lt;BR /&gt;
&lt;FXCASTIL&gt; wrote in message news:4995221@discussion.autodesk.com...&lt;BR /&gt;
I want to keep the API dialog forms such as (Folder &amp;amp; File Search) . I do&lt;BR /&gt;
not want the user to be able to mouse click inside the AutoCAD window when&lt;BR /&gt;
the from is shown, because this will minimize the dialog box and put it in&lt;BR /&gt;
the taskbar.  I have read mant posts about how to do this but I can not keep&lt;BR /&gt;
the dialog form on top.  The attached file has examples of how I tried to&lt;BR /&gt;
implement the previous posts.&lt;/FXCASTIL&gt;</description>
    <pubDate>Wed, 26 Oct 2005 21:00:40 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2005-10-26T21:00:40Z</dc:date>
    <item>
      <title>Keep API dialog on top (Modal)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469828#M39515</link>
      <description>I want to keep the API dialog forms such as (Folder &amp;amp; File Search) . I do not want the user to be able to mouse click inside the AutoCAD window when the from is shown, because this will minimize the dialog box and put it in the taskbar.  I have read mant posts about how to do this but I can not keep the dialog form on top.  The attached file has examples of how I tried to implement the previous posts.</description>
      <pubDate>Wed, 26 Oct 2005 15:58:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469828#M39515</guid>
      <dc:creator>fxcastil</dc:creator>
      <dc:date>2005-10-26T15:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: Keep API dialog on top (Modal)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469829#M39516</link>
      <description>I use the following in VB executables I run from an ACAD macro:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
*** The calling routine&lt;BR /&gt;
&lt;BR /&gt;
    mdlWindow.MakeTopMost Me.hwnd&lt;BR /&gt;
    Me.WindowState = 0&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
*** In a module I call mdlWindow.bas&lt;BR /&gt;
&lt;BR /&gt;
Private Declare Function SetWindowPos Lib "user32" _&lt;BR /&gt;
       (ByVal hwnd As Long, _&lt;BR /&gt;
        ByVal hWndInsertAfter As Long, _&lt;BR /&gt;
        ByVal x As Long, y, _&lt;BR /&gt;
        ByVal cx As Long, _&lt;BR /&gt;
        ByVal cy As Long, _&lt;BR /&gt;
        ByVal wFlags As Long) As Long&lt;BR /&gt;
&lt;BR /&gt;
Private Const HWND_TOPMOST = -1&lt;BR /&gt;
Private Const HWND_NOTOPMOST = -2&lt;BR /&gt;
Private Const SWP_NOMOVE = &amp;amp;H2&lt;BR /&gt;
Private Const SWP_NOSIZE = &amp;amp;H1&lt;BR /&gt;
Private Const SWP_NOACTIVATE = &amp;amp;H10&lt;BR /&gt;
Private Const SWP_SHOWWINDOW = &amp;amp;H40&lt;BR /&gt;
Private Const TOPMOST_FLAGS = SWP_NOMOVE Or SWP_NOSIZE&lt;BR /&gt;
&lt;BR /&gt;
Public Sub MakeTopMost(Handle As Long)&lt;BR /&gt;
    SetWindowPos Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
Public Sub MakeNormal(Handle As Long)&lt;BR /&gt;
    SetWindowPos Handle, HWND_NOTOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
It will remain stubbornly on top unless you put the minimize button on the&lt;BR /&gt;
form and click it.&lt;BR /&gt;
&lt;BR /&gt;
Lennart&lt;BR /&gt;
&lt;BR /&gt;
&lt;FXCASTIL&gt; wrote in message news:4995221@discussion.autodesk.com...&lt;BR /&gt;
I want to keep the API dialog forms such as (Folder &amp;amp; File Search) . I do&lt;BR /&gt;
not want the user to be able to mouse click inside the AutoCAD window when&lt;BR /&gt;
the from is shown, because this will minimize the dialog box and put it in&lt;BR /&gt;
the taskbar.  I have read mant posts about how to do this but I can not keep&lt;BR /&gt;
the dialog form on top.  The attached file has examples of how I tried to&lt;BR /&gt;
implement the previous posts.&lt;/FXCASTIL&gt;</description>
      <pubDate>Wed, 26 Oct 2005 21:00:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469829#M39516</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-26T21:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: Keep API dialog on top (Modal)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469830#M39517</link>
      <description>Lennart,&lt;BR /&gt;
&lt;BR /&gt;
Can I get you to do me BIG favor and add this code to the file&lt;BR /&gt;
I attched I had tried what you described in the attached file , but I can not get it working.&lt;BR /&gt;
&lt;BR /&gt;
Thanks &lt;BR /&gt;
&lt;BR /&gt;
Fred C</description>
      <pubDate>Wed, 26 Oct 2005 21:19:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469830#M39517</guid>
      <dc:creator>fxcastil</dc:creator>
      <dc:date>2005-10-26T21:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: Keep API dialog on top (Modal)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469831#M39518</link>
      <description>Fred,&lt;BR /&gt;
I do not see an attachment &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
I use the following...&lt;BR /&gt;
In a code module:&lt;BR /&gt;
Public Const SWP_DRAWFRAME = &amp;amp;H20&lt;BR /&gt;
Public Const SWP_FRAMECHANGED = &amp;amp;H20&lt;BR /&gt;
Public Const SWP_HIDEWINDOW = &amp;amp;H80&lt;BR /&gt;
Public Const SWP_NOACTIVATE = &amp;amp;H10&lt;BR /&gt;
Public Const SWP_NOCOPYBITS = &amp;amp;H100&lt;BR /&gt;
Public Const SWP_NOMOVE = &amp;amp;H2&lt;BR /&gt;
Public Const SWP_NOSIZE = &amp;amp;H1&lt;BR /&gt;
Public Const SWP_NOREDRAW = &amp;amp;H8&lt;BR /&gt;
Public Const SWP_NOZORDER = &amp;amp;H4&lt;BR /&gt;
Public Const SWP_SHOWWINDOW = &amp;amp;H40&lt;BR /&gt;
Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE&lt;BR /&gt;
Public Const HWND_BOTTOM = 1&lt;BR /&gt;
Public Const HWND_BROADCAST = &amp;amp;HFFFF&amp;amp;&lt;BR /&gt;
Public Const HWND_DESKTOP = 0&lt;BR /&gt;
Public Const HWND_NOTOPMOST = -2&lt;BR /&gt;
Public Const HWND_TOP = 0&lt;BR /&gt;
Public Const HWND_TOPMOST = -1&lt;BR /&gt;
&lt;BR /&gt;
' Used for dealing with Forms&lt;BR /&gt;
Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long&lt;BR /&gt;
&lt;BR /&gt;
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long&lt;BR /&gt;
&lt;BR /&gt;
Public Function SetTopMostWindow(hwnd As Long, TopMost As Boolean) As Long&lt;BR /&gt;
&lt;BR /&gt;
    If TopMost = True Then&lt;BR /&gt;
        SetTopMostWindow = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)&lt;BR /&gt;
    Else&lt;BR /&gt;
        SetTopMostWindow = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
And then in the Form's Initialize Event:&lt;BR /&gt;
    Dim retVal As Long&lt;BR /&gt;
    Dim hwndForm As Long&lt;BR /&gt;
    &lt;BR /&gt;
    hwndForm = FindWindow(0&amp;amp;, UserForm1.Caption)&lt;BR /&gt;
    retVal = SetTopMostWindow(hwndForm, True)</description>
      <pubDate>Wed, 26 Oct 2005 21:50:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469831#M39518</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-26T21:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Keep API dialog on top (Modal)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469832#M39519</link>
      <description>&amp;gt; I do not see an attachment &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
His first post had one.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
Matt W&lt;BR /&gt;
"Children are like TV sets. When they start acting weird, whack them across &lt;BR /&gt;
the head with a big rubber basketball shoe."</description>
      <pubDate>Wed, 26 Oct 2005 21:59:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469832#M39519</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-26T21:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Keep API dialog on top (Modal)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469833#M39520</link>
      <description>Thanks :)...I caught that after re-reading posts...&lt;BR /&gt;
&lt;BR /&gt;
no editing of posts it seems &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;</description>
      <pubDate>Wed, 26 Oct 2005 22:01:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469833#M39520</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-26T22:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Keep API dialog on top (Modal)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469834#M39521</link>
      <description>cmd,&lt;BR /&gt;
&lt;BR /&gt;
The example you gave  me uses the userform handle as the argument when calling the function for the setting the top most window. The example in my original post is not a VBA useform but an API dialog box. This is where I am having problems I have tried different methods of getting the dialog box handle and then passing this to the topmost function but still no sucess. I would really appreciate if someone could fix the sample file in my original post so I can actually this this implemented . I have tried all the suggestions given to me but I still can not get it right &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
Fred</description>
      <pubDate>Thu, 27 Oct 2005 05:19:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469834#M39521</guid>
      <dc:creator>fxcastil</dc:creator>
      <dc:date>2005-10-27T05:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: Keep API dialog on top (Modal)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469835#M39522</link>
      <description>fxcastil &amp;lt;&amp;gt; wrote in news:4995987@discussion.autodesk.com:&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; cmd,&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; The example you gave  me uses the userform handle as the argument when&lt;BR /&gt;
&amp;gt; calling the function for the setting the top most window. The example&lt;BR /&gt;
&amp;gt; in my original post is not a VBA useform but an API dialog box. This&lt;BR /&gt;
&amp;gt; is where I am having problems I have tried different methods of&lt;BR /&gt;
&amp;gt; getting the dialog box handle and then passing this to the topmost&lt;BR /&gt;
&amp;gt; function but still no sucess. I would really appreciate if someone&lt;BR /&gt;
&amp;gt; could fix the sample file in my original post so I can actually this&lt;BR /&gt;
&amp;gt; this implemented . I have tried all the suggestions given to me but I&lt;BR /&gt;
&amp;gt; still can not get it right &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Thanks,&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Fred&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Setting BrwsInfo.howner = AutoCAD.hwnd should work, At least id did in &lt;BR /&gt;
WindowsXP and Autocad 2006&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
- Jose</description>
      <pubDate>Thu, 27 Oct 2005 15:17:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469835#M39522</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-27T15:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Keep API dialog on top (Modal)</title>
      <link>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469836#M39523</link>
      <description>Jose,&lt;BR /&gt;
&lt;BR /&gt;
Thanks a bunch that was the trick. Unfortunately not a lot of information on the API function properties is available. I used the function &lt;BR /&gt;
Declare Function GetActiveWindow Lib "user32" () As Long&lt;BR /&gt;
&lt;BR /&gt;
to get the active AutoCAD.hwnd , this was an easy fix knowledge is wonderful thing.&lt;BR /&gt;
&lt;BR /&gt;
Fred C.</description>
      <pubDate>Thu, 27 Oct 2005 15:34:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/keep-api-dialog-on-top-modal/m-p/1469836#M39523</guid>
      <dc:creator>fxcastil</dc:creator>
      <dc:date>2005-10-27T15:34:44Z</dc:date>
    </item>
  </channel>
</rss>

