forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Disable Taskbar Item?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Fri May 26, 2006 1:03 am    Post subject: Disable Taskbar Item? Reply with quote

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
View user's profile Send private message
kOt
Contributor
Contributor


Joined: 19 Jan 2004
Posts: 89
Location: Fyffe, AL

PostPosted: Wed May 31, 2006 1:14 pm    Post subject: Reply with quote

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 Very Happy

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 Very Happy

#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 Very Happy
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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Wed May 31, 2006 6:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Wed May 31, 2006 7:56 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
kOt
Contributor
Contributor


Joined: 19 Jan 2004
Posts: 89
Location: Fyffe, AL

PostPosted: Wed May 31, 2006 9:07 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Fri Jun 02, 2006 4:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Fri Jun 02, 2006 5:11 pm    Post subject: Reply with quote

Not really, besides re-minimizing it yourself if its maximized while your app is busy.
_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group