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.

DarkBASIC Discussion / multiple windows from one program?

Author
Message
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 8th Nov 2009 18:47
ok im learning the windows commands for a job im working on, and i was wondering is there any way to get multiple windows out of one program, or do i need to save an EXE for each windows?

TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 8th Nov 2009 21:32
I think you can use visual BASIC for separate windows, but I'm not sure...

TheComet


Make the paths of your enemies easier with WaypointPro!
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 8th Nov 2009 22:10
in DB or in another language? do you want multiple windows with DirectX in them?

if you mean db and you want DirectX in both windows then yes and no. you would have to create your own D3D device and attach it to the new window. then to do any drawing or anyhing you would need to use the d3d commands not db. you would definetly need a dll for that because d3d uses lib files not dll files and i don't think db can load those.

if you mean just a window then you can have as many as you want per exe. from db you would need a dll to call you window functions though(like mine) because the CreateWindow function takes 11 parameters.


Quote: "I think you can use visual BASIC for separate windows, but I'm not sure...
"


Yes this is true, although you can have multiple windows in any language. C++, Visual BASIC, or even DarkBASIC(given some exeptions) although to clarify you do mean 'Window' as a overlapped window correct? as in it has a title bar and it can move? because in windows all the 'windows' are treated the same weather it's a button, scroll bar, edit box, or overlapped winodw. iit's controlled by there Window Procedure which is a user defined function that handles the window messages or in other words window commands. and by there window styles(like WS_OVERLAPPED,CHILD,THICKBORDER,blaa blaa blaa)


To awnser you question simply Yes.

New Site! Check it out \/
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 9th Nov 2009 00:12
maybe its just the amount of info presented there caleb, but it sounds to me that its pretty complex to run multiple windows windows (that sounds weird) from a single program

and yes, this is DBC, that why its on the DBC board, lol

it sounds to me like it would just be easier to just create a seperate program for the second window (i will only 2 or 3 windows active) and run that program using (i think the command is) RUN FILE

Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 9th Nov 2009 03:38
Ok i did throw a lot information out at you, but in my defence you weren't very specific. lol.

like i said above, a 'window' is pretty much everything you see in Windows(that sounds weird also) so yes you can have more then one window open at a time per program.

if you want multiple windows in dbc that all have directX in them then you would have to have seperate programs or use DirectX calls directly(i don't think that's even possible though from dbc)

from the wording in the last post this is what you want.


Quote: "but it sounds to me that its pretty complex to run multiple windows windows (that sounds weird) from a single program"


it was probably the amount of information. sorry that's my fault. it is actually quite simple. there is a command to create a window(it's a dll function in user32.dll) here it is:

CreateWindowA

or

CreateWindowExA

to call them from dbc, you have to have a dll call them because they take more then 9 parameters(dll parameter limit is 9) to attach DirectX to these windows you need Direct3D structures and calls that you cannot call from dbc(that i know of) so, can you have multiple windows in dbc? Yes. Can you have multiple windows with directX in dbc? unfortinatly no.

New Site! Check it out \/
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 9th Nov 2009 18:16
Quote: "im learning the windows commands"


'Multiple windows' is a vague term. Do you mean Windows windows?

For example, in Delphi you can have multiple 'forms' and each one looks like a Windows window - with all the associated gadgets.

DB though, being a game software development tool isn't geared up for writing Windows applications - hence the lack of support for menus, radio buttons, combo boxes and so on.

DBC can run in a window, but it doesn't look much like a standard Windows window because it's just a container for a DirectX viewport.

I'm not 100% sure as I'm not an expert with DirectX, but I seem to remember reading somewhere that you can only open one DirectX window at a time, so that suggests you can rule out running two DB exe's - though I've not tried it.

So, if you want to learn the Windows API, you might consider Delphi - there are free versions available to download.

TDK

That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 10th Nov 2009 03:34
ok, to clarify, what i mean by window is the result of the command "set window on", enclosing the program in a windows form with the associated buttons

and i dont need directX, its going to be purely 2d

Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 10th Nov 2009 04:29 Edited at: 10th Nov 2009 04:36
It's possible in DBC. It's possible to have an entire Windows type interface in DBC but you have to jump through a few hoops. DBC is meant to be a game engine so it doesn't want to readily do windows stuff. There is something called a windows class. DBC actually creates a window class named "DBG" .

By accessing the class, you can subclass, get at the window procedure, and do things like add a windows type menu, handle window messages, etc. Most of this stuff you'll need a custom DLL to do through DBC. But you can actually get away with a lot using MDI directly through the Win32 API. MDI stands for "Multiple Document Interface" . I used it a lot when trying to make DB behave more "Window Like" . If you want multiple Windows (like DarkEdit for example) you might want to use an MDI implimentation.

Though I used to mess around with this stuff for DB all the time, I haven't done so in a while and none of it is fresh in my brain - so the "how to" will be up to your research.

Enjoy your day.
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 10th Nov 2009 06:20
if you don't want DirectX in it then sub-classing the window procedure is easy, along with creating a window. here is how you sub-class it:

first get the handle to the original window. then use:

SetClassLong(HandleToDBWindow, GWL_WNDPROC, NewWindowProcFunction)

NewWindowProcFunction is the pointer to the procedure function(you get this by using the function name without the parameters or parentheses). This also returns the pointer to the old window procedure(which you will need. so save it as a WNDPROC* variable) your new procedure function should look something like this




that will show a message box when the user clicks the left mouse button. other messages are sent to the old window procedure(that's why we saved it) Of course as you see this is all in c++ so you will need a dll. Oh and the SetClassLong takes a parameter of LONG so you need to type cast the pointer to LONG like this

(LONG)(funcptr)

you cannot do this from dbc because dbc doesn't support pointers and you cannot get a function pointer in dbc.


After that you can create a new window with the dbc class("DBG") which i didn't know the name till now lol. i just got the class handle from WinAPI and the window handle lol. You cannot call "GetMessage" from dbc though. or i have never gotten it to work.

New Site! Check it out \/

Login to post a reply

Server time is: 2024-04-24 15:15:04
Your offset time is: 2024-04-24 15:15:04