Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

User Image
Chris Salvian
55 discussion posts
Hi all,

I'm trying to use triggers and functions to bring the autocad text window to the front when the main AutoCAD window gets the focus. I have my text window on a second monitor that sometimes gets covered by PDF files or emails.

I have a trigger to run this function when the AutoCAD window gets the focus. But I don't wnat the text window to keep the focus. It doesn't seem to be working and I can't figure out why. Any thoughts?

Code

using System;
using System.Drawing;

// The 'windowHandle' parameter will contain the window handle for the:
//   - Active window when run by hotkey
//   - Trigger target when run by a Trigger rule
//   - TitleBar Button owner when run by a TitleBar Button
//   - Jump List owner when run from a Taskbar Jump List
//   - Currently focused window if none of these match
public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        // Find the AutoCAD text window
        IntPtr [] windowhandle = BFS.Window.GetWindowsByText("AutoCAD Text Window*");

        // Bring the AutoCAD text window to the front if AutoCAD has the focus
        bool ok1 = BFS.Window.Minimize(windowHandle);
        bool ok2 = BFS.Window.Restore(windowHandle);
    }
}
4 days ago (modified 4 days ago)  • #1
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
You want the text window brought to the front, but the main Auto Cad window to have focus?
3 days ago  • #2
User Image
Chris Salvian
55 discussion posts
Quote:
You want the text window brought to the front, but the main Auto Cad window to have focus?


Yep, exactly.
3 days ago  • #3
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Is that function currently pulling the text window to the front, or is that part failing as well?
2 days ago  • #4
User Image
Chris Salvian
55 discussion posts
Neither of the functions are working.
2 days ago  • #5
User Image
Chris Salvian
55 discussion posts
I changed the code a little to streamline, but it's still not working.

Code

using System;
using System.Drawing;

// The 'windowHandle' parameter will contain the window handle for the:
//   - Active window when run by hotkey
//   - Trigger target when run by a Trigger rule
//   - TitleBar Button owner when run by a TitleBar Button
//   - Jump List owner when run from a Taskbar Jump List
//   - Currently focused window if none of these match
public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        // Find the AutoCAD text window
        IntPtr windowhandle = BFS.Window.GetWindowByText("AutoCAD Text*");

        // Bring the AutoCAD text window to the front if AutoCAD has the focus
        BFS.Window.Minimize(windowHandle);
        BFS.Window.Restore(windowHandle);
    }
}
2 days ago  • #6
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
The restore function won't actually bring it to the front, you'll need to focus the window first. Try using this line instead:

Code

BFS.Window.Focus(windowHandle);


and then add another line to re-focus the main Autocad window after
1 day ago  • #7
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)