DX, and multiple forms

Shimms
12-17-2001, 04:44 AM
I started coding DirectX in VB about 3 hours ago, so I hope this is an easy question to answer:

I have a form, (frmMain), which is the startup form. In this form, I am setting the screen res, initializing dirextX, and setting the cooperation mode.

<pre> Set DirectDraw = DirectX.DirectDrawCreate("")
Call DirectDraw.SetCooperativeLevel(Me.hWnd, DDSCL_FULLSCREEN Or DDSCL_EXCLUSIVE Or DDSCL_ALLOWREBOOT)
Call DirectDraw.SetDisplayMode(800, 600, 32, 0, DDSDM_DEFAULT) </pre>

When I then try to call another form:

frmMessageBox.Show

the MessageBox form is being loaded and displayed, yet its being hidden by the main form.

I assume this is to do with how im setting the cooperation mode, (I have also tried frmMessageBox.SetFocus after showing it, which had no effect).

I believe the problem lies in the DDSCL_EXCLUSIVE flag, but I'm just not sure, what to change it to.

Any help would be appreciated, thanks.

Squirm
12-17-2001, 10:14 AM
You cannot use other forms while in fullscreen DirectX mode, that kind of defeats the object. If you want to have other forms and things pop up then:

*) Unlock the surface and BitBlt the form onto it (very hard)
*) Design your own GUI using DirectX (hard)
*) Use windowed mode DirectX (medium)
*) Dont use DirectX (easy)

Up to you how you do it, but when you set DirectX fullscreen onto one form, it takes control of the graphics device away from windows for a while, thus you cant expect it to do anything you normally could do with forms and controls.

Banjo
12-17-2001, 10:23 AM
I have seen games that show a window (normally for settings) that looks just like a normal window with the same behaviour as well that appears over the top of a full screen game. Admittedly the window is in the same res as the game but I can't believe they went to the effort of duplicating the Windows standard controls so precisely. This is with DX games, so how come?

Squirm
12-17-2001, 10:26 AM
Banjo - they weren't coded in VB. And yes, that does make a difference.images/icons/wink.gif

Banjo
12-17-2001, 10:28 AM
How so? Are the VB DX TLB's different to the C ones?

Squirm
12-17-2001, 10:37 AM
I would think so. Something like this would involve interrupting the regular DirectX flipping chain and then pausing the rendering while the other form was displayed. Although technically this would be possible, I have never ever seen it done before in VB. When I get a spare moment I will knock together some code and see what happens. Until then....

images/icons/smile.gif

divil
12-17-2001, 10:53 AM
Yes, the VB libs are different from the C ones. If you look at the DirectX documentation, it says that you *can* use the Windows GUI from DirectX, but it says you can only do this if you're writing it in C++. Perhaps you can attempt to duplicate it using VB, but I wouldn't want to try, personally.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum