The way I do this is like Roar has said, but I ask Chat GPT to tell me what to add, I will add an example:
I say this is an example of what I add to sections to create a maximise screen in my MT4 code.
in the on tick section I use this:
// Example usage: maximize the window
SetWindowState(SW_SHOWMAXIMIZED);
~next~
In the custom function section I use this:
void SetWindowState(int desiredState) {
int hWnd = WindowHandle(Symbol(), Period());
int parent = GetParent(hWnd);
// Check current state using WinUser32.mqh functions
bool isMaximized = IsZoomed(parent);
bool isMinimized = IsIconic(parent);
if (desiredState == SW_SHOWMAXIMIZED && !isMaximized) {
ShowWindow(parent, SW_SHOWMAXIMIZED);
} else if (desiredState == SW_SHOWMINIMIZED && !isMinimized) {
ShowWindow(parent, SW_SHOWMINIMIZED);
} else if (desiredState == SW_RESTORE && (isMaximized || isMinimized)) {
ShowWindow(parent, SW_RESTORE);
}
}
In the global variables section I use this:
#include <WinUser32.mqh>
#import "user32.dll"
int GetParent(int);
int ShowWindow(int, int);
#define SW_SHOWMAXIMIZED 3
#define SW_SHOWMINIMIZED 6
#define SW_RESTORE 9
#import
Use this set-up and create a code that does this "Choose what you would like to create". It may take a few corrections but using this you can create blocks doing what you like...