C/C++ Allegro 程序导致 Windows 7 切换到 Aero Basic
我只是在尝试 allegro 库,这是迄今为止我得到的代码:
#include <allegro.h>
int main(int argc, char *argv[]) {
allegro_init(); // initialize the allegro libraries
install_keyboard(); // initialize keyboard functions
set_color_depth(16); // set the color depth
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); // set up 640*480px window
BITMAP *pic = NULL;
pic = load_bitmap("C:/picture.bmp", NULL); // load the picture
blit(pic, screen, 0, 0, 0, 0, 1000, 1000);
readkey();
destroy_bitmap(pic);
return 0;
}
END_OF_MAIN()
它工作正常,但是当我运行它时,当程序的窗口打开时,Windows 7 将主题从 Aero 更改为 Aero basic 。如果您不确定我的意思,则会弹出此信息(我从 Google 获得此信息,这就是为什么它说 Vista 而不是 Windows 7):
(来源:suitedcowboys.com )
- 为什么?
- 我怎样才能确保这种情况不会发生?
I'm just trying out the allegro library, and here is the code which I've got so far:
#include <allegro.h>
int main(int argc, char *argv[]) {
allegro_init(); // initialize the allegro libraries
install_keyboard(); // initialize keyboard functions
set_color_depth(16); // set the color depth
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); // set up 640*480px window
BITMAP *pic = NULL;
pic = load_bitmap("C:/picture.bmp", NULL); // load the picture
blit(pic, screen, 0, 0, 0, 0, 1000, 1000);
readkey();
destroy_bitmap(pic);
return 0;
}
END_OF_MAIN()
It works fine, but when I run it, while the program's window is open, Windows 7 changes the theme from Aero to Aero basic. If you aren't sure what I mean, this pops up (I got this from Google, which is why it says Vista rather than Windows 7):
(source: suitedcowboys.com)
- Why?
- How can I ensure that this doesn't happen?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Aero 需要将颜色设置为 32 位,但您将其设置为 16:
set_color_depth(16);
Aero needs color set to 32 bit, but you're setting it to 16:
set_color_depth(16);
除非您有充分的理由使用特定的颜色深度,否则请执行以下操作:
虽然现在通常不是问题,但许多较旧的显卡仅支持 15/16 位之一和 24/32 位之一。
如果您因为使用调色板而需要使用 8 位颜色深度,则只需使用 GFX_GDI 驱动程序即可获得最大兼容性。
Unless you have good reason to use a specific color depth, do this:
While generally not a problem today, many older video cards only support one of 15/16 bit and one of 24/32 bit.
If you need to use 8-bit color depth because you use a palette, then just use the
GFX_GDI
driver for maximum compatibility.