Removec Windows Title bar help!
DanneGu

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

al_set_new_display_flags(ALLEGRO_NO_FRAME); ?

DanneGu

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

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.

DanneGu

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
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()".

DanneGu

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

Arthur Kalliokoski

Use the win32 api to register the window?

DanneGu

and how do i do that?

Arthur Kalliokoski
DanneGu

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

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

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

DanneGu

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

Arthur Kalliokoski

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

DanneGu

oh okey, thanks anyway! :)

Timorg

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.

Thread #609378. Printed from Allegro.cc