CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Join Date
    Aug 2002
    Location
    UK
    Posts
    11

    How To Show MDI Form in ActiveXDll.OCX

    Hi,

    I want to display a MDI form form ActiveX control. Do U have any idea how to do that? I know it's possible in VB.NET but I want to do it in VB.6.0

    Uttam

  2. #2
    Join Date
    Dec 2001
    Posts
    6,332
    My first thought is to set the parent of the form to the control. Another aproach might be to use another control inside the main one, and just make it *look* like a form.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  3. #3
    Join Date
    Aug 2002
    Location
    UK
    Posts
    11
    Many thanks for reply but still I'm having problem in loading the form. I will be highly obliged if U send a small demo code for the same.

    Thanks in advance!!!

    Uttam

  4. #4
    Join Date
    Dec 2001
    Posts
    6,332
    OK.
    Here is a little demo to get you started. It even lets you minimize the MDI child inside the control.

    Let us know how it goes!
    Attached Files Attached Files
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  5. #5
    Join Date
    Aug 2002
    Location
    UK
    Posts
    11
    Many many thanks. It solved my problems. Once again many thanks.

  6. #6
    Join Date
    Aug 2002
    Location
    UK
    Posts
    11
    Hi,

    Sorry for asking too many questions but the problem is:

    I want to make it an ocx so that I can use the same in another application but it doesn't allow to do so. Could U plz let me know how can I make the project given by U as ActiveX Control?

    Many Thanks in advance!!!

    Uttam

  7. #7
    Join Date
    Dec 2001
    Posts
    6,332
    OK. Start with your control only, and make the project an activex control type (in project properties). Then set the startup object to none. Now make your control public in the control's properties. Then add a regular form to the project (not an mdi).

    Now when you compile it, the form will be part of the ocx!
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  8. #8
    Join Date
    Aug 2002
    Location
    UK
    Posts
    11
    Hi,

    Sorry for asking lots of questions but when I'm trying to compile the OCX as U had told it's saying MDI form can not be shown modally.

    Plz help me to to solve this problem.

    I'm really very sorry but quite helpless.

    Uttam

  9. #9
    Join Date
    Dec 2001
    Posts
    6,332
    You don't add an MDI form to the project, because the API turns a regular form into an MDI form.

    Here is a sample project, and it works like I said.
    Attached Files Attached Files
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  10. #10
    Join Date
    Aug 2002
    Location
    UK
    Posts
    11
    Hi,

    I'm really very sorry for asking lots of questions but it think it would be my last question. Actually now when I'm trying to show MDIChild form on the MDI form it gives me problem. I'm attaching a sample code which is causing problem.

    Once again many thanks in advance!!!

    Regards;

    Uttam
    Attached Files Attached Files

  11. #11
    Join Date
    Dec 2001
    Posts
    6,332
    OK. I think I see what you are trying to do. Are you trying to put an MDI form inside the control, then have an MDIchild form inside of that? If so, I would say it is not likely to be possible, and at best would cause all sorts of problems. My suggestion is to make the control act as the parent form for the MDI child forms. If you want it to look like an MDI interface, I would simulate it, and not try to get the real thing. This is because the control is sited on a regular form, so I don't think it can be an MDI parent.

  12. #12
    Join Date
    Mar 2002
    Posts
    14
    Originally posted by WizBang
    You don't add an MDI form to the project, because the API turns a regular form into an MDI form.

    Here is a sample project, and it works like I said.
    Very interresting subject.
    I tried your project and it works fine. But if :
    - I build the project1.ocx
    - Register the test1.ocx using regsvr32
    - Edit an html page to loag the ocx

    When load the page in IE 6.0, I have an 406 error message concerning non-modale forms....

    Any Idea ???

    Chris ZANARDI

  13. #13
    Join Date
    Aug 2002
    Location
    UK
    Posts
    11
    I think U R not using correct version of ocx coz it works alright on my M/C

  14. #14
    Join Date
    Mar 2002
    Posts
    14
    Well, I don't understand what you mean with 'not using correct version of ocx ' coz if I see in the html page the pink rectangle with the button...

    OK, can you try on your computer this example : it is the same as the original one exept concerning the DEBUG proporties of the project. Instead of 'start with the component UserControl1', I 'start a browser with the URL...'

    Thank you and sorry to disturb you.

    Chris
    Attached Files Attached Files

  15. #15
    Join Date
    Aug 2002
    Location
    UK
    Posts
    11
    Well, Got ur problem. Try this code to. I mean replace the given function. It will work fine in ur case.

    Private Sub MakeMDI()
    'Make window act like MDI child and also so it won't show in the taskbar
    lhWnd = MDIChild.hWnd

    SetParent MDIChild.hWnd, UserControl.hWnd
    MDIChild.Visible = 1
    End Sub

    Uttam

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured