• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows Win32 function failed: HRESULT: 0x887a0005

M

Michael Franklin

Guest
When I was programming I made a menu for my game. When I ran the game to test what I had done I got this error:

upload_2020-1-19_13-28-59.png

I have no idea what to do and now my game wont run because I cant get passed this error.
 

rIKmAN

Member
Are you trying to create a surface etc anywhere with an invalid or 0,0 size, or a size that is too big for the target hardware?

I think that usually gives a Texture2D error, but it's worth checking.
Also try the steps outlined by Nocturne in this post.

If that doesn't work try commenting sections of code to narrow down the offending part and post back qwith the info on what code is causing the error.
 
Last edited:
M

Michael Franklin

Guest
Are you trying to create a surface etc anywhere with an invalid or 0,0 size, or a size that is too big for the target hardware?

I think that usually gives a Texture2D error, but it's worth checking.
Also try the steps outlined by Nocturne in this post.

If that doesn't work try commenting sections of code to narrow down the offending part and post back with the info on what code is causing the error.
I did all the things Nocturne mentioned and it still gave me the error. I completely got rid of the font and everything and it still didn't work.

Im trying to make a menu with words and a moving room and trying to see if that works before adding buttons and stuff to move through the menu. This is what I added to my code.

Code:
/// @description GUI/Vars/Menu setup

gui_width = display_get_gui_width()
gui_height = display_get_gui_height()
gui_margin = 32;

menu_x = gui_width;//+200;
menu_y = gui_height - gui_margin;
menu_x_target = gui_width - gui_margin;
menu_speed = 25; //lower is faster
menu_font = Fon_Menu;
menu_itemheight = font_get_size(Fon_Menu);
menu_comitted = -1;
menu_control = true;

menu[2] = "New Game";
menu[1] = "Continue";
menu[0] = "Quit";

menu_items = array_length_1d(menu)
menu_cursor = 2;
Code:
/// @description Draw Menu

draw_set_font(Fon_Menu);
draw_set_halign(fa_right);
draw_set_valign(fa_bottom);

for (var i = 0; 1 < menu_items; i = i++){
    
    var offset = 2;
    var txt = menu[i];
    if (menu_cursor == i){
        
        txt = string_insert("> ", txt, 0);
        var col = c_white;
        
    }else{
        var col = c_gray;
    }
    
    var xx = menu_x;
    var yy = menu_y - (menu_itemheight * (i * 1.5));
    draw_set_color(c_black);
    draw_text(xx-offset,yy,txt);
    draw_text(xx+offset,yy,txt);
    draw_text(xx,yy-offset,txt);
    draw_text(xx,yy+offset,txt);
    draw_set_color(col);
    draw_text(xx,yy,txt);
    
}
 

rIKmAN

Member
So try commenting out what you added from your code and seeing if it works again.

If so, gradually add it back bit by bit until you can identify the part that is causing the error.
 
M

Michael Franklin

Guest
So try commenting out what you added from your code and seeing if it works again.

If so, gradually add it back bit by bit until you can identify the part that is causing the error.
It seems to be this part here that is giving me the error, I'm very new to this so I have no idea what is wrong with it
Code:
for (var i = 0; i < menu_items; i = i++){
    
    var offset = 2;
    var txt = menu[i];
It is apart of the second code message in my last reply.
 

rIKmAN

Member
It seems to be this part here that is giving me the error, I'm very new to this so I have no idea what is wrong with it
Code:
for (var i = 0; i < menu_items; i = i++){
  
    var offset = 2;
    var txt = menu[i];
It is apart of the second code message in my last reply.
Try changing i = i++ to just i++.

You'd normally increment using either i++ or i = i+1, never seen that way used before so it may or may not be the issue.
 
M

Michael Franklin

Guest
Try changing i = i++ to just i++.

You'd normally increment using either i++ or i = i+1, never seen that way used before so it may or may not be the issue.
Ya you were right. I dont know why I did that I must have skipped through that because ive never seen that used like that before either, I tested it and it works now. Thanks for the help
 
Top