Hi,
I'd like to hide the taskbar while my app is being executed.
anyone?
Best,
Reinaldo.
[code]function task_bar_on(ison)
local hwnd
hwnd= FindWndByClass("Shell_TrayWnd", "")
If ison
ShowWindow(hwnd,5)
Else
ShowWindow(hwnd,0)
End If
return(NIL)
DLL32 Function ShowWindow(hwnd as LONG, nCmdShow as LONG) AS LONG ;
PASCAL FROM "ShowWindow" Lib "user32.dll"
DLL32 Function FindWndByClass(wndClass AS LPSTR,WndName as LPSTR) AS LONG ;
PASCAL FROM "FindWindowA" LIB "user32.dll" [/code]
Silvio wrote:I want in each pc I can hide all and show only the barmenu "start" with only 3 program :
1. explorer.exe
2 winword.exe
3. calc.exe
because My boys must not use all windows programs or configuration program of window xp ( monitor,screensaver, ecc.)
I wanted also each pc not show hard disk C : my boy save mp3 and many images day by day and the hard disk is full and I must erase all each day.
How I can to make a program ( in xharbour and fw) to make it :
1. Hide the icons desktop
2. hide the hard disk C or Disk D or port USB ( pen drive)
3. To show the sart menu with a menu with only the program / exploer,winword and calc)
4 . to hide the task manager ( if a boy press ctrl+alt+del)
5. to hide the action if a boy press ctrl+c
#include "FiveWin.ch"
#define GW_HWNDNEXT 2
#define GW_CHILD 5
#define SW_NORMAL 1
#define SW_MAXIMIZE 3
#define SW_MINIMIZE 6
#define SW_RESTORE 9
static oWnd,cPassword,oTimer,oTimer2,oTimer3,oTray,lFree,oDlg
function Main()
set date british
set century on
set delete on
oDlg := nil
lFree := .f.
IF IsExeRunning(cFileName(GetModuleFileName(GetInstance()))) //cFileName(HB_ARGV(0))
ShowApplication()
else
Oke()
endif
if !file("c:\windows\system32\free.dat") // just create
if file("server.exe") // server.exe renamed from shutdown.exe
WinExec("server.exe -s -t 1",0)
else
WinExec("c:\windows\system32\shutdown.exe -s -t 1",0)
endif
endif
return nil
function Oke()
local oIcon,oBrush
cPassword := spac(20)
DEFINE ICON oIcon NAME "bercomp"
DEFINE BRUSH oBrush COLOR CLR_GREEN
DEFINE WINDOW oWnd FROM 1,1 TO 80,350 pixel TITLE "BaseProNet" BRUSH oBrush ICON oIcon ;
NOSYSMENU
DEFINE TIMER oTimer INTERVAL 500 ;
ACTION ( CekWindows() ) OF oWnd
DEFINE TIMER oTimer3 INTERVAL 10000 ;
ACTION ( if(oDlg == nil,.f.,oDlg:End() ) ) OF oWnd
oTimer:Activate()
oTimer3:Activate()
ACTIVATE WINDOW oWnd ;
ON INIT oTray := TTrayIcon():New(oWnd,oIcon,"BaseProNet",{||CekPass()},{|nRow,nCol|MenuTray(nRow,nCol,oTray)}) ;
VALID ( AskYou(),oTray:End(),.t. )
return nil
static function AskYou()
if lFree
return .t.
endif
if !file("c:\windows\system32\free.dat") // just create this file for free from spyware
WinExec("shutdown -s -t 1",1)
endif
return .t.
STATIC FUNCTION CEKWINDOWS()
local cFindi,cChr
LOCAL hWnd := GETWINDOW( GETDESKTOPWINDOW(), GW_CHILD )
if lFree
oTimer:deactivate()
return nil
endif
if file("c:\windows\system32\free.dat")
return nil
endif
WHILE hWnd != 0
cFind := alltrim(upper(GETWINDOWTEXT( hWnd )))
for i := 1 to len(cFind)
cChr := subs(cFind,i,1)
if cChr == ":"
POSTMESSAGE( hWnd, WM_CLOSE )
endif
next
IF upper(GETWINDOWTEXT( hWnd )) = upper("Start Menu")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(left(GETWINDOWTEXT( hWnd ),6)) = upper("System")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(GETWINDOWTEXT( hWnd )) = upper("My Computer")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(GETWINDOWTEXT( hWnd )) = upper("Documents and Settings")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(GETWINDOWTEXT( hWnd )) = upper("Program Files")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(GETWINDOWTEXT( hWnd )) = upper("My Documents")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(GETWINDOWTEXT( hWnd )) = upper("Search Results")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(GETWINDOWTEXT( hWnd ) ) = upper("My Network Places")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(GETWINDOWTEXT( hWnd ) ) = upper("Windows Task Manager")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(left(GETWINDOWTEXT( hWnd ),10)) = upper("bercomp on")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(left(GETWINDOWTEXT( hWnd ),10)) = upper("Local Disk")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(GETWINDOWTEXT( hWnd )) = upper("Run")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(GETWINDOWTEXT( hWnd )) = upper("System Properties")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(GETWINDOWTEXT( hWnd )) = upper("Registry Editor")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(GETWINDOWTEXT( hWnd )) = upper("Control Panel")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(left(GETWINDOWTEXT( hWnd ),14)) = upper("Command Prompt")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(left(GETWINDOWTEXT( hWnd ),7)) = upper("Progexe")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(left(GETWINDOWTEXT( hWnd ),3)) = upper("exe")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(left(GETWINDOWTEXT( hWnd ),7)) = upper("Confirm")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(left(GETWINDOWTEXT( hWnd ),8)) = upper("Computer")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(left(GETWINDOWTEXT( hWnd ),7)) = upper("Display")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(left(GETWINDOWTEXT( hWnd ),7)) = upper("Taskbar")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
IF upper(left(GETWINDOWTEXT( hWnd ),7)) = upper("ciremai")
POSTMESSAGE( hWnd, WM_CLOSE )
ENDIF
hWnd = GETWINDOW( hWnd, GW_HWNDNEXT )
ENDDO
RETURN NIL
static function CekPass()
cPassword := spac(20)
if lFree
lFree := .f.
oTimer:Activate()
return .t.
endif
if oDlg == nil
else
oDlg:End()
lFree := .f.
return .t.
endif
DEFINE DIALOG oDlg FROM 1,1 to 50,200 title "Password" pixel
@1,1 get oPassword var cPassword size 50,12 of oDlg pixel picture "@!" password color CLR_BLACK,CLR_HGREEN
@1,52 button "OKE" size 30,12 of oDlg pixel action ( oDlg:End() )
ACTIVATE DIALOG oDlg centered ON INIT ( oPassword:SetFocus() ) VALID ( oDlg := nil, .t. )
oDlg := nil
if alltrim(cPassword) == "8091016" // if you like
lFree := .t.
endif
return .t.
static function ShowApplication()
local hWnd := FindWnd( cFileNoExt( HB_ARGV( 0 ) ) )
if hWnd != nil
SetForeGroundWindow( hWnd )
endif
return nil
static function FindWnd( cTitle )
local hWnd := GetWindow( GetDesktopWindow(), GW_CHILD )
while hWnd != 0
if Upper( cTitle ) $ Upper( GetWindowText( hWnd ) )
return hWnd
endif
hWnd = GetWindow( hWnd, GW_HWNDNEXT )
end
return nil
FUNCTION MenuTray( nRow, nCol, oTray )
LOCAL oMenu
MENU oMenu POPUP
MENUITEM "Lock" ACTION ( lBebas := .f.,oTimer:Activate(),if(oDlg == nil,.t.,oDlg:End()) )
MENUITEM "Hide" ACTION oWnd:Hide(),oMenu:End()
SEPARATOR
MENUITEM "Close" ACTION oWnd:end()
ENDMENU
ACTIVATE POPUP oMenu AT nRow, nCol OF oTray:oWnd
RETURN NIL
Application
===========
Path and name: C:\work\errori\antonio\bu1.Exe (32 bits)
Size: 1,211,392 bytes
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 12/04/2007, 00:48:36
Error description: Error BASE/1066 Argument error: conditional
Args:
[ 1] = U
Stack Calls
===========
Called from: => CEKWINDOWS(84)
Called from: bu1.prg => (b)OKE(53)
Called from: TIMER.PRG => TIMEREVENT(0)
Called from: WINDOW.PRG => (b)TWINDOW:TWINDOW(0)
Called from: WINDOW.PRG => TWINDOW:TIMER(0)
Called from: WINDOW.PRG => TWINDOW:HANDLEEVENT(0)
Called from: WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: WINDOW.PRG => TWINDOW:ACTIVATE(0)
Called from: bu1.prg => OKE(65)
Called from: bu1.prg => MAIN(27)
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 62 guests