Data App With Multiple Windows

Reply

Join Date: Mar 2005
Posts: 263
Reputation: Toulinwoek is an unknown quantity at this point 
Solved Threads: 2
Toulinwoek's Avatar
Toulinwoek Toulinwoek is offline Offline
Posting Whiz in Training

Data App With Multiple Windows

 
0
  #1
Mar 24th, 2005
I want to create an application that consists of several "modules", each of which would be based on a database table, and will be opened either from a menu or from a button in an Outlook-styled toolbar. Obviously I'll create a "main" window, but then there will be several windows, one for each "module", of different sizes, each with its own toolbar and controls, that I want to be constrained within the boundaries of the main window. In other words, I don't want the module window(s) to appear as Windows taskbar buttons (I can do that part), but I also don't want the windows to be draggable beyong the frame of the main window, and if minimized, I want these windows to minimize within the main window.
I have tried using MDI, but that doesn't seem suited to what I'm trying to do, unless I haven't fully explioted the functionality of that concept. As usual, I don't really need code examples (but I'll sure take 'em); if someone could just explain the concept or the general procedure I can run with it.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Data App With Multiple Windows

 
0
  #2
Mar 24th, 2005
Well, The main idea behind what you are trying to do is completely MDI. However, I'm going to treat you to a little gem, that, depending on the app (since you are using your own forms, it's no problem) can cause troubles. This is a ... technique of sorts, that is namely taboo. Here you go, Though.
In A Code Module, Add This:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Public Declare Function SetParent Lib "user32.dll" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
  2.  
  3. Dim oldhwnd As Long

Now, in your MAIN Form Load, you just simple add this (keep in mind, that you can add this anywhere that you want to in your main form... a menu, a button... whatever). This is the code to grab your form, and stick it inside your other form.

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. oldhwnd = SetParent(Form2.hWnd, MainForm.hWnd)

Now, make sure to replace Form2 with the name of the form that you want inside (or however many forms you want inside) of the main window. Change the name of MainForm, To the name of your main form (don't lose the .hWnd's that follow).
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 263
Reputation: Toulinwoek is an unknown quantity at this point 
Solved Threads: 2
Toulinwoek's Avatar
Toulinwoek Toulinwoek is offline Offline
Posting Whiz in Training

Re: Data App With Multiple Windows

 
0
  #3
Mar 24th, 2005
Slick! Thanks, I'll try it. Also, I guess I need to bone up a little more on MDI.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 263
Reputation: Toulinwoek is an unknown quantity at this point 
Solved Threads: 2
Toulinwoek's Avatar
Toulinwoek Toulinwoek is offline Offline
Posting Whiz in Training

Re: Data App With Multiple Windows

 
0
  #4
Mar 25th, 2005
OK. Here's what I figured out:

I started a new Standard EXE project, which of course automatically creates a form (Form1). I then created a new MDI form, made it the default form in the project properties and set the "MDIChild" property of the automatically created form (Form1) to "true", which keeps it within the boundaries of the MDI form. So now the MDI form acts as the "main" window. I can now create other forms and by setting their MDIChild property to true, each of them will behave in the same manner.
Thanks for pointing me in the right direction. I think I'm well on my way to becoming a rookie programmer!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC