Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Removec Windows Title bar help!

This thread is locked; no one can reply to it. rss feed Print
Removec Windows Title bar help!
DanneGu
Member #13,944
January 2012

Hi, I recently started using allegro to program with and I would love to learn how to get rid of the title bar/border on the windows explorer window. Is this possible to do in allegro c++? If so can someone tell me how to do it on a basic level.

Regards Daniel.

Example with windows title bar/border:
http://www.mistywindow.com/windows/win-pics/windows-explorer.jpg

Example without windows title bar/border (This is how i want it to be):
http://imag.malavida.com/mvimgbig/download/comodo-firewall-4277-1.jpg

jmasterx
Member #11,410
October 2009

al_set_new_display_flags(ALLEGRO_NO_FRAME); ?

DanneGu
Member #13,944
January 2012

Where am i suppose to put that code? my code looks like this :)

#include <allegro.h>
#include <winalleg.h>

void init();
void deinit();

int main() {

init();
set_window_title("Program");



while (!key[KEY_ESC]) {
/* put your code here */
}

deinit();
return 0;


}
END_OF_MAIN()

void init() {
int depth, res;
allegro_init();
depth = desktop_color_depth();
if (depth == 0) depth = 32;
set_color_depth(depth);

res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 1000, 600, 0, 0);

if (res != 0) {
allegro_message(allegro_error);
exit(-1);
}

install_timer();
install_keyboard();
int install_mouse();
show_mouse(screen);
/* add other initializations here */
}

void deinit() {
clear_keybuf();
/* add other deinitializations here */
}

Thanks! :)

gnolam
Member #2,030
March 2002
avatar

First off, always put code you post in <code></code> tags.
The function jmasterx posted is an Allegro 5 function. It's not available in Allegro 4.x, which you appear to be using. If you want the same in Allegro 4.x, you'll have to create the window yourself and attach it to Allegro with win_set_window(HWND wnd). See the section "Windows specifics" in the manual for more details.

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

DanneGu
Member #13,944
January 2012

Im really sorry but I don't really understand where to put that function although i've read it on allegro.cc. I know I'm a rookie but would someone mind telling me exactly where to put it in my code to remove the title bar on my program, thanks! :)

Best regards Daniel.

#SelectExpand
1#include <allegro.h> 2#include <winalleg.h> 3 4void init(); 5void deinit(); 6 7int main() { 8 9init(); 10set_window_title("Program"); 11 12 13 14while (!key[KEY_ESC]) { 15/* put your code here */ 16} 17 18deinit(); 19return 0; 20 21 22} 23END_OF_MAIN() 24 25void init() { 26int depth, res; 27allegro_init(); 28depth = desktop_color_depth(); 29if (depth == 0) depth = 32; 30set_color_depth(depth); 31 32res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 1000, 600, 0, 0); 33 34if (res != 0) { 35allegro_message(allegro_error); 36exit(-1); 37} 38 39install_timer(); 40install_keyboard(); 41int install_mouse(); 42show_mouse(screen); 43/* add other initializations here */ 44} 45 46void deinit() { 47clear_keybuf(); 48/* add other deinitializations here */ 49}

Arthur Kalliokoski
Second in Command
February 2005
avatar

DanneGu said:

would someone mind telling me exactly where to put it in my code to remove the title bar on my program

It says right in the link gnolam posted "This function is meant to be called before initialising the library with allegro_init()".

They all watch too much MSNBC... they get ideas.

DanneGu
Member #13,944
January 2012

Okey got it thanks! But now what, how do i edit my window (get rid of the border) with the function?

Arthur Kalliokoski
Second in Command
February 2005
avatar

Use the win32 api to register the window?

They all watch too much MSNBC... they get ideas.

DanneGu
Member #13,944
January 2012

and how do i do that?

Arthur Kalliokoski
Second in Command
February 2005
avatar

They all watch too much MSNBC... they get ideas.

DanneGu
Member #13,944
January 2012

Okey i've done the window now how do i connect it with my allegro c++ project (im using Dev-c++ to program in)?

Arthur Kalliokoski
Second in Command
February 2005
avatar

http://www.allegro.cc/files/attachment/605476

The example programs showing how to interface windows that come with allegro 4.4.2 source.

They all watch too much MSNBC... they get ideas.

DanneGu
Member #13,944
January 2012

Isn't that c not c++ files? if not how can i test run them?

Arthur Kalliokoski
Second in Command
February 2005
avatar

I don't do IDE's (especially dev-c++ since everybody here agrees it's crap), Windows or C++. Hopefully someone else will help.

They all watch too much MSNBC... they get ideas.

DanneGu
Member #13,944
January 2012

oh okey, thanks anyway! :)

Timorg
Member #2,028
March 2002

Hey DanneGu, If you just want a borderless window, it is not that hard to achieve by messing about with allegros window specific functionality. I experiemented a long time ago with adding an graphics mode flag that allowed allegro to create borderless windows. I have cobbled something together that will help you create a borderless window. (You can download the example by clicking on the little paper clip.)

The problem is that you are not only wanting to create a borderless window, you are also wanting to create a custom toolbar. You need to create a new title bar and draw that into the window yourself. You then need to write the windows code so that the window will minimize, restore, drag and drop and in general behave like a normal window. I am not sure how trivial any of this is, and I wish you luck in it, but this should point you in the right direction.

I have only tested the example on Win7, but in theory it should work without change on WinXP.

Edit: Since I started this post and went away and fiddled with writing up an example, people have posted back and forth. I feel kind of slow.

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

Go to: