Ok, I am making a program that runs in 2 windows, When the main window is executed it calls(using the spawn function) the second program in another window.
The 2 programs actings as one interact through sending data through a file, now the heres the problem. Think of how winamp or music match jukebox works, the have like 2 windows running at once, but both are active at the same time, with me I have to click between windows to activate each one. Is there a solution to that (so both windows can be active at the same time)
thankss
Win32 or allegro? I don't think that there is a way to make two windows active in Win32 at the same time (If what you mean is that both of them should be "blue" at the same time). However, they will receive their messages nevertheless, so I don't really see the problem.
I mean allegro,
with the whole message thing, I'm NOT using win32 api message system. I'm using my own method through allegro to send data to a file, and both windows read from that file and communicate.
but heres the thing,i'm making my own video player to play special video files that I make(that are really datafiles with pictures in them).
One window is the video window(that plays the movie flie) and the second window has the controls, like play, stop, pause, etc.
When I run the video window is calls the control window and they both are on showing, but when I click on the control window the movie stops because that window becomes inactive and resume only after I click on it again.
you said that you didn't think it was possible? so how does winamp do it, like they have they playlist window, and the window that shows that file is playing (NO win32 api please).
Thanks
When any program has more than 1 window at once, only 1 is active in any given point in time. They are just all showing at the same time. They dont stop showing their contents. However, they arnt "active". If winamp used a normal a "windows" window, only one window will be blue at the top. If you look at winamp with its base skin, you can see this, the top of the player will change color when you anrnt using the player window. Since they are always up, they both seem to active.
[edit] I was replying when you were, so I still thought you ment in windows...my fault.
I don't know much of GUI programming... But you could give the "impression" that when you click of the windows both show up. When you click one window, bring the other window on the top first and then the one you clicked on.
Ok, I understand that, but how about the programs that have 2 windows up and both are only represented by one window on the task bar.
Its like the one program is separating itself into 2 windows. This example that i'm taking about is a program that isn't running in the default windows window, but its own custom window that usually dosent have the default (minimize, expand, and close) buttons at the top right corner
NO win32 api please
Then you don't get an answer.
Allegro is, primarily, a game library. It's interface to the GUI is precisely enough to get a game up and running, and nothing more than that.
If you want to do something like what you're wanting to do, you're going to have to talk to the GUI directly. That's simply the nature of the beast.
can that be done with
including winalleg
and not having to do all that
windows handling, hwnd.blahh
code
thanks
Well, you can still use allegro to create your main window etc.. but for changing window properties etc.. you'll still need to use some Win32 code.
just a suggestion: Why not deal with only ONE(1) window instead of having to deal with multiple windows. Split your main window (in allegro) into several parts as you wish. Although you will lose the flexibility of multiple windows here (movable, etc).
are there any good tutorials out their for integrating Win32 with allegro.
Like having the advantages of the win32 windows
but the ease of allegro graphic functions, like blitting, and datafiles,
Thankss
Ok, I understand that, but how about the programs that have 2 windows up and both are only represented by one window on the task bar.
They make use of child windows and dialogs. You should really read up on Win32. The forgers win32 programming tutorial is really good, and should get you started. Eventually, I recommend you to buy Programming Windows fifth edition by Charlez Petzholds. The best Win32 programming book! (Well, I have only read that one, but everyone else says so
)
your problem has to do with set_display_switch_mode. AFAIK when a windowed allegro program looses focus, it pauses. You cannot change the display switch mode for windowed programs (at least not on my computer). I think it's a directx issue, but i'm not sure.
You could change focus really fast between your windows, but that's not really a solution.
superstar, in order to get two windows, you need to manage two windows.
At the moment, allegro supports only one window. That means if you want a 2nd one, you have to manage it yourself.
That means you'll need to use the in32 API in one way, or the other. There's no "easy way" to avoid that.
If you don't want to learn / use the win32 API, you're out of luck and can't use a 2nd window, then.
allrgro function set_display_switch_mode()
its in the docs.
why not just use something like the spacebar to pop the controls up over the video, then press space again to hide them?
have one window.
then spam the desktop using blit_to_hdc( ... );
use the hdc for the windows desktop.
use a win32 api function to get the windows desktops hdc.
or
launch another window that does nothing.
then get its hdc (use the win32 api function to get the hdc of that other window)
then blit_to_hdc()
or
write a win32 app.
or
use one window, make it full screen
then, just before the window is activated (using set_gfx_mode)
copy the windows hdc to a bitmap.
then go allegro full screen
blit that bitmap to the full screen.
it will look like the windows desktop.
then just draw your own windows on top of that !
Hm... blitting directly to the screen is a nice idea. But... it won't do the trick. Same with hijacking another windows hdc. Reason for this is mainly the fact that he won't be able to process anything that's happening that area.
If he's blitting to the screen, he might click on something that is on the desktop (or on a control of another program at this position). I t will also lead to redraw problems.
Using a single fullscreen window will work. But it's a fake. If he wanted to run fullscreen, he would use a fullscreen app and use internal windows for that stuff.
Since he runs windowed, I guess there's a reason for this (like being able to run nicely together with other apps, or simulate a "normal" win32 app).
use one window, make it full screen
then, just before the window is activated (using set_gfx_mode)
The idea is good, but he needs to grab the dektop before he calls allegro_init and set_gfx_mode().
Setting the mode will destroy the desktop content.
While that's not hard (check the lexEyes source for an example) it requires win32 API calls. Which he wants to avoid.
I'd guess he wants to simulate a normal win app, without learning the win32 API. That will not work properly, sincy he'd have to simulate a lot of windows behavior by hand. It might be better to go his own way, so the user doesn't expect windows functionality in the frist place.
But, in the long run, learning win32 wil be worth it.. so why not start today?
seriously win32 api is not that hard.
the basics id say are easier than allegro.
gettings some data out of the system, or settings same stuff is often one function call.
and its as easy as just adding a header file to the top of the 'c' file that uses the win32 call.
try this:
int main(void)
{
allegro_init();
MessageBox(win_get_window(), "msg", "title", MB_OK );
}
there you have it, a win32 call... how easy !
if you dont want to use allegro in the above example...
try this:
int main(void)
{
MessageBox( NULL, "msg", "title", MB_OK );
}
the problem with me and the winapi
is that its so confusing.
I tried to learn it and quit like 3 different times.
Plus it just seems like it has soo much extra overhead. With allegro I can do things so much easier and with way less lines of code.
With the winapi its like 70 lines just to get a window open, and the who resource bit, and having to declare menu items and all that, and all the classes.
I'll just use one window like the win media player on xp.
Plus I have heard that there are alternatives to the win 32api.
Well i'm a computer science Minor at college, and next semester i'm taking this really good computer course and I'll see if they teach the win32 api and talk with my professor about all the little details.
Thanks for all the suggestions.
seriously win32 api is not that hard.
the basics id say are easier than allegro.
You, sir, are on crack 
I wrote a little example of getting Allegro and Win32 to work together. So now all you need to do is learn a little Win32 to run a second window. See mEmO's last post; Petzold rocks
. Allegro will run slower in a window than fullscreen though; no question.
Though if one were very 1337, I would bet you could put the main game window into fullscreen using ChangeDisplaySettings() and then running a smaller window over that. But I've never tried that.
Win32 is not too hard, though it can be cumbersome. Never tried any alternatives though. Isn't this that "console" thing everyone loves so much? You could create a simple GUI window using Allegro or something, no?
Just rambling ...
EDIT: Hey, I just noticed
that ss4410 is using paragraphs!
When did he start
doing that?
Why not use 3 thread? One for each window (GUI operation and verification) and an other for the core of the program.
threads are not the issue...
the issue is about getting multi-windows..
heres another idea...
have 2 seperate programs... both use allegro for drawing etc... both are stand alone allegro programs.
BUT, one launches the other.
then communicate between them using
win32::SendMessage( WM_COPYDATA, ... );
sorted
Or you could use shared memory... Or a pipe.. Or a socket... etc...
i was trying to offer the simplest method, as someones afraid of win32, and needs to be shown the light 
i would bet that win32::SendMessage(WM_COPYDATA,...) is the simplest, and yes i know its not portable, but really what (useful warez) is these days anyway.