| View previous topic :: View next topic |
| Author |
Message |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Fri May 26, 2006 1:03 am Post subject: Disable Taskbar Item? |
|
|
Hi Guys,
Would anyone happen to know a way, perhaps using the Windows API, to disable an application minimized to the taskbar?
When you right click on an item in the taskbar, you are usually given the ability to Maximize and Close. However, I would like to prevent these options.
Thanks!
- Boo |
|
| Back to top |
|
 |
kOt Contributor

Joined: 19 Jan 2004 Posts: 89 Location: Fyffe, AL
|
Posted: Wed May 31, 2006 1:14 pm Post subject: |
|
|
I think i got what you need..
You can run this and minimize it to taskbar press hotkey "CTRL+W"
and you can't right click the window on the taskbar so.. no Menu any
more
| Code: |
# The Enable/Disable code came from
# http://www.vdsworld.com/forum/viewtopic.php?t=1825&highlight=disable+window
# Which was written by FreezingFire
# so thank him
#Functions/Variables
%%IsEnabled = "TRUE"
%%WinTitle = "WinEnableDisable TEST"
# Create the Window
DIALOG CREATE,WinEnableDisable TEST,-1,0,200,200
DIALOG SHOW
LOADLIB user32.dll
# ADDING A HOTKEY TO ENABLE/DISABLE IT WHILE MINIMIZED
HOTKEY ADD,HK1,CTRL+W
:EVLOOP
WAIT EVENT
GOTO @EVENT()
:HOTKEY
IF @EQUAL(%%IsEnabled,"TRUE")
%%IsEnabled = "FALSE"
ELSE
%%IsEnabled = "TRUE"
END
# Advanced Code - Enable/Disable Window
%H = @STRDEL(@WINEXISTS(%%WinTitle),1,1)
%A = @LIB(user32,EnableWindow,BOOL:,INT:%H,BOOL:%%IsEnabled)
# Test if window is enabled or disabled
%B = @LIB(user32,IsWindowEnabled,BOOL:,INT:%H)
IF @NOT(@ZERO(%B))
INFO "The Window is ENABLED"
ELSE
INFO "The Window is DISABLED"
END
goto evloop
:CLOSE
FREELIB user32.dll
EXIT |
_________________ Visual Dialogscript 5 |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Wed May 31, 2006 6:24 pm Post subject: |
|
|
Hi kOt,
Thanks for your input. Actually, I already tried this method before, but although the window becomes disabled, I am still able to right click on the minimized window to get a pop-up menu (i.e. Restore, Close, etc.). Although the Window is disabled, I am still able to restore it and close it via right clicks.
What I need is a way to totally disable these options--so that a minimized window cannot be closed, etc.
Thanks again,
- Boo |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Wed May 31, 2006 7:56 pm Post subject: |
|
|
The example below gets rid of the WS_SYSMENU style of your window when it is minimized, getting rid WS_SYSMENU also gets rid of the minimize box and close box of your window, so it has to be put back on when the window is restored.
The buttons only show back up if the window is redrawn, so the example minimizes then activates your window to update it. Hopefully this isn't noticeable, but my system is pretty fast and I can't tell.
Hopefully it works for what you want.
| Code: |
OPTION DECIMALSEP,"."
DIALOG CREATE,New Dialog,-1,0,240,160,CLASS SysMenuTest
DIALOG SHOW
LOADLIB user32.dll
%%hwnd = @strdel(@winexists(#SysMenuTest),1,1)
REM 1 is Showing, 0 is Minimized
%%status = 1
:Timer
if @equal(%%status,1)
if @equal(@winpos(@winexists(#SysMenuTest),S),2)
REM GWL_STYLE = -16
%%oldstyles = @lib(user32,GetWindowLongA,INT:,%%hwnd,-16)
REM WS_SYSMENU = $080000
%%newstyles = @diff(%%oldstyles,$080000)
%P = @lib(user32,SetWindowLongA,INT:,%%hwnd,-16,%%newstyles)
%%status = 0
end
else
if @equal(@winpos(@winexists(#SysMenuTest),S),1)@equal(@winpos(@winexists(#SysMenuTest),S),3)
REM GWL_STYLE = -16
%%oldstyles = @lib(user32,GetWindowLongA,INT:,%%hwnd,-16)
REM WS_SYSMENU = $080000
%%newstyles = @sum(%%oldstyles,$080000)
%P = @lib(user32,SetWindowLongA,INT:,%%hwnd,-16,%%newstyles)
REM Update the window
WINDOW ICONIZE,@winexists(#SysMenuTest)
WINDOW ACTIVATE,@winexists(#SysMenuTest)
%%status = 1
end
end
:Evloop
wait event,0.5
goto @event()
:Close
FREELIB user32.dll
exit
|
_________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
kOt Contributor

Joined: 19 Jan 2004 Posts: 89 Location: Fyffe, AL
|
Posted: Wed May 31, 2006 9:07 pm Post subject: |
|
|
That weird actually on my pc the disable window code actually removes my ability to do ANYTHING with the window . _________________ Visual Dialogscript 5 |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Fri Jun 02, 2006 4:21 pm Post subject: |
|
|
| Thanks, Sheep. This is closer to what I am looking for... Any way to disable it so that the window will not maximize when left clicking on the minimized window? |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Fri Jun 02, 2006 5:11 pm Post subject: |
|
|
Not really, besides re-minimizing it yourself if its maximized while your app is busy. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|