Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / DGDK and Win32 API dont work

Author
Message
Hayer
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 28th Sep 2008 21:24
Hi!
This code(Before the DGDKLoop) makes the button flash one time at start up, then disappear.


Why? Is it even possible to use Win32 API for GUIs?
How can I get it to work?

Willie Mundermuffin
18
Years of Service
User Offline
Joined: 5th Jan 2006
Location:
Posted: 29th Sep 2008 11:17
It is definitely possible to use Dark GDK w/ winAPI - I do it all the time. Dark GDK simply creates a window and makes it's client area a directx surface - i.e. the hardware does the drawing, etc. If you want control over the gdk window, #include "globstruct.h" and then use the pointer g_pGlob->hWnd to access the window. You'll then have free reign over the window. You can make it a child window, etc. Use dbSetWindowLayout with value of '0' to rid it of the title bar. I'm working on a limb/mesh modifying app right now and I simply use a typical GetMessage loop and set a timer for 100 ms intervels and simply call dbSync() with the WM_TIMER case - this constantly keeps the window updated w/o overburdenning the system with messages. However, this would not work well for apps that need a high framerate (obviously), cause 100 ms isn't very smooth; also, WM_TIMER messages are given low priority and can be dropped (as stated in the msdn library). As far as the DarkLoop - it isn't needed for non-game apps. In fact, as far as I can tell, it is simply a glorified while loop with a few internal calls that aren't needed in this type of app. Any other questions, let me know. Oh yeah, as for why the button isn't sticking around - i'm assuming you're putting the button within the dx window - thus, as soon as dx initiates, it starts repainting the client surface, therefore "removing" the image of the button. Since your app is stuck in the darkloop, there is no way for windows to handle repainting the button. You can simply use peekmessage within the darkloop (MAKE SURE TO USE PM_REMOVE AS LAST PARAM TO REMOVE HANDLED MESSAGES!!!). Unlike GetMessage, this will always immediately return control to your app (as opposed to only when there's a message). I'm sure this'll help clear some things up (and create more questions).

Peace,
Jared C. Matthews
C/C++/WinAPI Software Engineer
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 29th Sep 2008 13:13
All you stated is very interesting. I'm using an adaptation of Sephnroth's tutorial:

Menu's and Dialogs - DarkSDK Tutorial

(it was written for VS2003, but everything said is still valid for VS2008, just replace 'DarkSDK' with 'DarkGDK' and 'LoopSDK' with 'LoopGDK')

I've been doing many tests with it, until finally including a menu for my simulation. However it turns to be kind of tricky to catch the windows messages and control them along with the 3d painting.

One of the main problems is that the DGDK painting 'freezes' when windows takes control of the menu. Some messages like changing from one drop-down sub-menu to another, cannot even be catched (or at least I was not able to do so).

Now what you described seems to be a workaround for this kind of issues, or at least a different aproach from Sephnroth's one.

Please if you can post some example code showing us what you explained, that would be nice. Like having a code example of peekmessage and how and when should be removed the handled messages.
It is quite easy to make a mistake, the results can change dramatically depending on when is GetMessage called etc.

I think that many members of the community would like to have this subject -windows menus and controls in DGDK- being part of the common know-how. Thanks in advance.
Neo Cortex
17
Years of Service
User Offline
Joined: 6th Jan 2007
Location:
Posted: 19th Oct 2008 17:38
Hi,

i got an error while compiling your project after converting to VS2008 Express Edition

Quote: "Script1.rc(10) : fatal error RC1015: cannot open include file 'afxres.h'"


Does anybody know help?

thx

DB Noob

Login to post a reply

Server time is: 2024-11-25 03:46:29
Your offset time is: 2024-11-25 03:46:29