Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8723729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:41:34+00:00 2026-06-13T07:41:34+00:00

I’m writing an industrial process control application to run on a PC, using .Net.

  • 0

I’m writing an industrial process control application to run on a PC, using .Net. The program monitors the progress of various parts being assembled by teams on the factory floor. There can be an arbitrary number of parts – 1,2,3,4,5, etc, and in the old VB6 version of the app each part gets its own window and the operators like to arrange them on the screen.

What I’m describing is a classic MDI interface but WPF doesn’t support MDI. Other threads on SO have suggested the wpfmdi project on Codeplex, but that’s listed as “abandoned” since last February ( http://wpfmdi.codeplex.com ) and avalondocks but those are docking tiles that don’t look like they can be arbitrarily dragged and moved.

I don’t know what to do. I didn’t want to use WinForms because WPF/XAML provides cooler visuals and easier styling and because Microsoft seems to have abandoned WinForms. The current VB6 version of this product is 12 years old and I’d like to plan on a similar lifespan for the new one.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:41:35+00:00Added an answer on June 13, 2026 at 7:41 am

    I found the answer on another discussion forum (I can’t remember which one or I’d give them credit). It turned out to be easier than I thought. If you hook the WM_MOVING message (I do it, below when the window is loaded) you can intercept moves before the window is moved and constrain the location of the window.

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        WindowInteropHelper helper = new WindowInteropHelper(this);
        HwndSource.FromHwnd(helper.Handle).AddHook(HwndMessageHook);
    
        InitialWindowLocation = new Point(this.Left, this.Top);
    }
    
    // Grab the Win32 WM_MOVING message so we can intercept a move BEFORE 
    // it happens and constrain the child window's location.
    
    private IntPtr HwndMessageHook(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam, ref bool bHandled)
    {
        switch (msg)
        {
            //   might also want to handle case WM_SIZING:
            case WM_MOVING:
                {
                    WIN32Rectangle rectangle = (WIN32Rectangle)Marshal.PtrToStructure(lParam, typeof(WIN32Rectangle));
    
                    if (rectangle.Top < 50)
                    {
                        rectangle.Top = 50;
                        rectangle.Bottom = 50 + (int)this.Height;
                        bHandled = true;
                    }
    
                    if (rectangle.Left < 10)
                    {
                        rectangle.Left = 10;
                        rectangle.Right = 10 + (int)this.Width;
                        bHandled = true;
                    }
    
                    if (rectangle.Bottom >800)
                    {
                        rectangle.Bottom = 800;
                        rectangle.Top = 800 - (int)this.Height;
                        bHandled = true;
                    }
    
                    // do anything to handle Right case?
                    if (bHandled)
                    {
                        Marshal.StructureToPtr(rectangle, lParam, true);
                    }
                }
                break;
        }
        return IntPtr.Zero;
    }
    

    The XAML header looks like this:

    <Window x:Class="Mockup_9.Entity11"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:local="clr-namespace:Mockup_9"
            ShowInTaskbar="False"
            Background="LightGoldenrodYellow"
            Loaded="Window_Loaded"
            Title="Mockup_part -" Height="540" Width="380" ResizeMode="NoResize"
            Icon="/Mockup_9;component/Images/refresh-icon1.jpg">
    

    . . . etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have thousands of HTML files to process using Groovy/Java and I need to
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.