How get rid of minimize button

Previous topic - Next topic

Robert

I have a program that have to loop all the time and what I have understand you then must uppdate the screen in the loop but then you cant minimize without a crash. I want to either not uppdate screen or get rid of the minimized button so that the user not can crash the program. Is it possible on Windows? 

spacefractal

Im thinks this issue is due glb_do_pause() is called outside the main loop, etc a new thread have been created, but glbasic is not threadsafe. So its can crash sometimes. Im believe that function should only been called after or before SHOWSCREEN call.

Im did seen that in Android, and moved the calling pausemode to SHOWSCREN, which seens fixed it. Im believe its can happens on other platforms, which also include Windows (here im thinks minimize buttons is same as Hibernate).

But for Windows you should could do this to avoid it (its does not crash here):
AUTOPAUSE FALSE
AUTOESCAPE FALSE



Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Schranz0r

You have to change the Windowstyle.
I make a example later
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Moru

If it is some background process that has no grafical output you can just compile it as a console program. See the checkbox in the project options. Ofcourse there are some limits on what commands you can use for console programs so this only works if it's some background process that does not display anything except for text.

Robert

Quote from: spacefractal on 2015-Apr-02
Im thinks this issue is due glb_do_pause() is called outside the main loop, etc a new thread have been created, but glbasic is not threadsafe. So its can crash sometimes. Im believe that function should only been called after or before SHOWSCREEN call.

Im did seen that in Android, and moved the calling pausemode to SHOWSCREN, which seens fixed it. Im believe its can happens on other platforms, which also include Windows (here im thinks minimize buttons is same as Hibernate).

But for Windows you should could do this to avoid it (its does not crash here):
AUTOPAUSE FALSE
AUTOESCAPE FALSE


Ok intresting but I have set the autopause and autopause false

Robert

Quote from: Schranz0r on 2015-Apr-02
You have to change the Windowstyle.
I make a example later

It sounds like its that I need so I am waiting.

Robert

Quote from: Moru on 2015-Apr-02
If it is some background process that has no grafical output you can just compile it as a console program. See the checkbox in the project options. Ofcourse there are some limits on what commands you can use for console programs so this only works if it's some background process that does not display anything except for text.

I tried that but I couldn't get it to work the way I wanted with just console commands. Its not graphic but I want it to interact in a way that wasn't possible in a console. 

Schranz0r

Here we go!
Sry, yesterday there was not enough time for me :/

I remove the window Menu, so you only have the windowcaption available.
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Robert

Quote from: Schranz0r on 2015-Apr-03
Here we go!
Sry, yesterday there was not enough time for me :/

I remove the window Menu, so you only have the windowcaption available.

Thanks. It works as I wanted. I don't care about having the close button for this projekt but is it possible to modifie the inline code so that you keep it?   


Schranz0r

Sure, check this out:

Code (glbasic) Select
INLINE
        }
        extern "C" int __stdcall GetWindowLongA(void*, int);
        extern "C" int __stdcall SetWindowLongA(void*, int, int);
        #define GWL_STYLE                       (-16)
        #define WS_SYSMENU        0x00080000L
        #define WS_MAXIMIZEBOX 0x00010000L
        #define WS_MINIMIZEBOX 0x00020000L
        namespace __GLBASIC__ {
ENDINLINE

FUNCTION disableWindowMenu:
INLINE

    int style = ::GetWindowLongA(GLBASIC_HWND(), GWL_STYLE);
    style &= ~WS_MAXIMIZEBOX;
    style &= ~WS_MINIMIZEBOX;
::SetWindowLongA(GLBASIC_HWND(), GWL_STYLE,  style);

ENDINLINE
ENDFUNCTION
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Robert

This was perfect because now I also see the icon in the window.