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 136087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:53:35+00:00 2026-05-11T06:53:35+00:00

Got some C# forms/controls that can be called up either from a C# control

  • 0

Got some C# forms/controls that can be called up either from a C# control on a Winform in a Winforms MDI app OR the same C# control used by a PowerBuilder MDI app via COM.

I’ve been using the WinAPI call SetParent to attach forms to the MDI.

  1. It works (or seemed to) in both environments.
  2. It lets the child window have its own WindowState (Normal, Maximised) instead of taking on that of the child windows already open (which was a real pain).

Say the control is called T. Code on control T calls up form D.

Control T is on form X.
Control T is also on form Y.

In .Net all is well, and form D stays within the MDI.

in PB:
Control T is on PB control PX. Control T is also on PB control PY.

For PX all is well.
For PY, however, there is a problem – form D does not seem to become an MDI child – it can go outside the app and has a taskbar icon. I stress that this is using same objects as the ones that do work. The SetParent is literally the same line of code.

Further research has revealed that SetParent doesn’t really work for proper MDI childing – but that’s OK(ish) cos we don’t need to merge menus etc.

Interestingly, have found that though SetParent seems to ‘work’, you don’t get the handle back if you try GetParent…

Form form = new MyForm(); WindowsMessageHelper.SetParent(form.Handle, MDIParentHandle); //passed down  int parentHandle = WindowsMessageHelper.GetParent(form.Handle); 

parentHandle will always be 0….

Is there any way of making form D behave under all circumstances? My own researches have not been promising. I don’t really want to go back and rewrite my forms as controls and have PowerBuilder manage them – mainly becasue there can be multiple instances of each form and PowerBuilder would have to handle that (instead of the controller class/base class I’ve got doing it in the .net app).

Can I stress that there is NO problem within .Net, the problem only shows up in the PowerBuilder app

  • 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. 2026-05-11T06:53:35+00:00Added an answer on May 11, 2026 at 6:53 am

    In the end, we found that the difference was that PB was doing the equivalent of setting .MDIParent for the control PX (the one where calling up form D worked) but not for PY.

    Once that was sorted then we were then getting the correct MDIParent handle and all is now well.

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

Sidebar

Ask A Question

Stats

  • Questions 207k
  • Answers 207k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer top will tell you the amount of physical memory assigned… May 12, 2026 at 9:16 pm
  • Editorial Team
    Editorial Team added an answer Just tried figuring something out and the closest pure-css solution… May 12, 2026 at 9:16 pm
  • Editorial Team
    Editorial Team added an answer In the end I just implemented a flow where it… May 12, 2026 at 9:16 pm

Related Questions

I need to create reports in a C# .NET Windows app. I've got an
What are the steps to deploying a project created in VS2008 (windows forms and
Using C++ and .net I have a stream of data I want to display
I have to make a graphical user interface application using the language of my

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.