Página 1 de 1

Tirar o X da Janela Win98/Me

Enviado: 05 Set 2014 09:56
por Itamar M. Lins Jr.
Só no Harbour 3.2 e 3.4 no GIT, harbour 3.2 antigo não tem.

Código: Selecionar todos

2014-09-03 20:21 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
  * src/rtl/gtwin/gtwin.c
    + added support for disabling [x] button of console window in older
      MS-Windows versions which do not have GetConsoleWindow() function,
      i.e. Win9x/ME

best regards
Przemek
Saudações,
Itamar M. Lins Jr.

Tirar o X da Janela Win98/Me

Enviado: 05 Set 2014 10:55
por Itamar M. Lins Jr.
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.

Tirar o X da Janela Win98/Me

Enviado: 11 Set 2014 13:39
por Itamar M. Lins Jr.
Mais...

Código: Selecionar todos

DeleteCloseButton(GetConsoleWindow()) 
//where:

#pragma BEGINDUMP 

HB_FUNC( GETCONSOLEWINDOW ) 
{ 
hb_retnl( (LONG)GetConsoleWindow( ) ) ; 
} 

HB_FUNC( DELETECLOSEBUTTON ) 
{ 
DeleteMenu(GetSystemMenu( (HWND)hb_parnl( 1 ), FALSE), SC_CLOSE,MF_BYCOMMAND ) ; 
DrawMenuBar( (HWND)hb_parnl( 1 ) ); 
} 
#pragma ENDDUMP 

//That works with GTWIN. 
//Can I add something in C code to disable "close the window" menu item at task bar ?