Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: how to show a window's normal window in the fullscreen game?  (Read 2800 times)

0 Members and 1 Guest are viewing this topic.

yaobifeng

  • Lurker
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 24
    • View Profile
how to show a window's normal window in the fullscreen game?
« on: April 07, 2008, 03:55:50 AM »

hi,
I want to use the windows's UI in the game,ex window,button,list box,checkbox and so on,I use delphi write a function in dll file:

h := GetForegroundWindow;
Form1:=TForm1.CreateParented(h);
form1.ShowModal;
setwindowpos(form1.Handle,hwnd_topmost,0,0,0,0, swp_nosize or swp_nomove);
form1.Free;


then call it in the script:
external "D:\Program Files\Borland\Delphi6\Projects\dll.dll" TestDll(int);
...
TestDll(55);
...


it works like:



here is the problem,sometime the showmodle window open and show back of the game surface,sometime it's open and show front of the game surface.
how can i open and show the window front of the game surface always?
Logged

sychron

  • Wanderer zwischen den Welten
  • Global Moderator
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 223
  • There is no spoon. The enemy gate is down!
    • View Profile
Re: how to show a window's normal window in the fullscreen game?
« Reply #1 on: April 07, 2008, 07:04:24 AM »

As far as I remember, delphi forms have a "StayOnTop" or "alwaysOnTop" somewhere, in the window style or as a special property. I don't know wether this works while directX is handling a full screen device, but it should work. Otherwise, try the bringToFront() method.

BUT ... Having normal windows.forms windows appear while a directx fullscreen window is launched is always tricky and may crash on some systems, or slow down the engine on others. It's never a good idea to steal the focus of a directX surface.

Try using WME windows instead. You could use a screenshot of your window to preserve the visual appearence, and remodel the window with wme controls.
« Last Edit: April 07, 2008, 07:06:51 AM by sychron »
Logged
... delete the inner sleep ...

yaobifeng

  • Lurker
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 24
    • View Profile
Re: how to show a window's normal window in the fullscreen game?
« Reply #2 on: April 07, 2008, 07:56:27 AM »

As far as I remember, delphi forms have a "StayOnTop" or "alwaysOnTop" somewhere, in the window style or as a special property. I don't know wether this works while directX is handling a full screen device, but it should work. Otherwise, try the bringToFront() method.

BUT ... Having normal windows.forms windows appear while a directx fullscreen window is launched is always tricky and may crash on some systems, or slow down the engine on others. It's never a good idea to steal the focus of a directX surface.

Try using WME windows instead. You could use a screenshot of your window to preserve the visual appearence, and remodel the window with wme controls.
"StayOnTop" or bringToFront() even use Window's API setwindows all have not effect in the fullscreen mode,but work well in the window mode。I use normal windows forms because my game has many data input and output  forms,also many  forms have complex layout, it's terribly and impossible if i use WME's UI controls。I think use a normal windows form that contains a webbrowser control is a good idea。I display the normal windows form top of the game scenes,my clients use web pages input their data and view all kinds of  report,my game will connected to the web server retrieve data and redraw the scenes......
anybody can help me?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: how to show a window's normal window in the fullscreen game?
« Reply #3 on: April 07, 2008, 01:40:17 PM »

I'm afraid displaying native windows over the Direct3D window will never work 100% correctly, and you can run into a lot of problems there. I would definitely avoid this.
I believe the cleanest way of doing that is to integrate your native windows with the Direct3D device. If I remeber correctly, there's some example in DirectX SDK which demonstrates that. However, this only works in Direct3D 9, not in Direct3D 8. I don't know much about it, but it might work.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

sychron

  • Wanderer zwischen den Welten
  • Global Moderator
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 223
  • There is no spoon. The enemy gate is down!
    • View Profile
Re: how to show a window's normal window in the fullscreen game?
« Reply #4 on: April 07, 2008, 03:02:40 PM »

hmm ... these examples also were in the dx7 sdk, as far as I remember.
Logged
... delete the inner sleep ...
 

Page created in 0.037 seconds with 18 queries.