Pescado ali do outro forum. Nunca se sabe, podemos precisar mais tarde
Ligar e desligar o X e mudar o titulo da janela
Código: Selecionar todos
function main()
local hWnd, wText := ltrim(str(seconds()))
SetConsoleTitle( wText )
hWnd := FindWindow( wText )
DeleteCloseButton( hWnd )
SetConsoleTitle( 'Testing xharbour' )
wait ""
return nil
//Attention!! the following lines are case sensitive
*************************************
#PRAGMA BEGINDUMP
#include "hbapi.h"
#include "Windows.h"
HB_FUNC( SETCONSOLETITLE )
{
hb_retl( SetConsoleTitle( hb_parc(1) ) );
}
HB_FUNC( FINDWINDOW )
{
hb_retnl( (LONG)FindWindow( NULL, hb_parc(1) ) ) ;
}
HB_FUNC( DELETECLOSEBUTTON )
{
DeleteMenu(GetSystemMenu( (HWND)hb_parnl( 1 ), FALSE),
SC_CLOSE,
MF_BYCOMMAND ) ;
DrawMenuBar( (HWND)hb_parnl( 1 ) );
}
HB_FUNC( ENABLECLOSEBUTTON )
{
DeleteMenu(GetSystemMenu( (HWND)hb_parnl( 1 ), TRUE),
SC_CLOSE,
MF_BYCOMMAND ) ;
DrawMenuBar( (HWND)hb_parnl( 1 ) );
}
HB_FUNC( SENDMAXMESSAGE )
{
HWND hWnd;
BOOL nRtn = 1;
//---get handle to the window
hWnd = GetForegroundWindow();
//---tell the window to maximize iteself. won't be
// true "full-screen" but it's the best we can do
// and does not require any user action.
SendMessage( hWnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
hb_retni( nRtn );
}
#PRAGMA ENDDUMP
*************************************
Saudações,
Itamar M. Lins Jr.