1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
#include <stdio.h>
#include <windows.h>
// Programme permettant de supprimer la barre de titre
int Resizable = FALSE;
int main(int argc, char *argv[], char *envp[])
{
char cWindowName[256];
HWND hWindow;
LONG current_style, new_style;
DWORD style;
if (argc < 2)
{
printf("Usage : %s titre\n", argv[0]);
return (0);
}
strcpy(cWindowName, argv[1]);
if (argc == 3)
{
if (strcmp (argv[2], "RESIZE") == 0)
Resizable = TRUE;
else
Resizable = FALSE;
}
else
{
Resizable = FALSE;
}
hWindow = FindWindow(NULL, cWindowName);
if (hWindow)
{
printf("Found window %s\n", cWindowName);
current_style = GetWindowLong (hWindow, GWL_STYLE);
printf("Current style of the window = %x\n", current_style);
// Suppression titre fenetre seulement
if (Resizable)
new_style = WS_VISIBLE | WS_DLGFRAME | WS_CLIPSIBLINGS | WS_THICKFRAME;
else
new_style = WS_VISIBLE | WS_DLGFRAME | WS_CLIPSIBLINGS;
style = SetWindowLong(hWindow, GWL_STYLE, new_style);
printf("GetLastError=%u\n", GetLastError());
printf("Send new style to the window = %x\n", new_style);
}
else
{
printf("Error, window %s not found ...\n", cWindowName);
}
} |
Partager