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 


Taskicons - minimize to, swap when busy

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Mon Mar 24, 2003 9:12 pm    Post subject: Taskicons - minimize to, swap when busy Reply with quote

Here's an example that minimizes the program to the systray,
and swaps to a different icon when the program actually does
something - this one just pops up a window every 5 seconds.

This uses the RUNDLL32.EXE icon as the busy icon - if it isn't
available, use another one - it's set in the var on the top line.

I used DIALOG SELECT in this example, but it isn't necessary
unless your program has child windows that process events
while it's minimized to the systray. You'd also need another
CLICK event for the second taskicon (TaskBusyCLICK", etc.)
if there's any event processing while it's minimized.

Changing the order of some of the code (such as WINDOW
NORMAL and DIALOG SHOW) may cause slightly different
effects.

There will be a slight flicker because we're removing/replacing
the icon - no way around this that I know of, but it's less in the
compiled program.
__________________________________________________________________________________________________________________________
Code:

rem -- EXE for busy icon - if you don't have this, use something else --
%%busyicon = @windir()\rundll32.exe

OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,"Test Program",-1,0,180,35
  %%hwnd = @winexists("Test Program")
  DIALOG ADD,BUTTON,Stop,5,5,50,25
  DIALOG ADD,BUTTON,Start,5,5,50,25
DIALOG SHOW

%%show = 1
%t = 0

:EVLOOP
  WAIT EVENT, ".5"
  goto @event()

:TIMER
  rem -- add icon when minimized --
  if @both(%%show, @equal(@winpos(%%hwnd, S), 2))
     DIALOG SELECT, 0
     DIALOG HIDE
     DIALOG ADD,TASKICON,TaskIco1,," Mac's Program "
     %%show = ""
  end
  rem -- change icon if program is doing something --
  if %%run
     %t = @succ(%t)
     rem -- every 5 seconds --
     if @greater(%t, 4)
        %t = 0
        rem -- replace normal task icon with busy one --
        if @not(%%show)
           DIALOG SELECT, 0
           DIALOG REMOVE, TaskIco1
           DIALOG ADD,TASKICON,TaskBusy,%%busyicon," Program is busy "
        end
        GOSUB TestWindow
        rem -- replace busy task icon with normal one --
        if @not(%%show)
           DIALOG SELECT, 0
           DIALOG REMOVE, TaskBusy
           DIALOG ADD,TASKICON,TaskIco1,," Mac's Program "
        end
     end
  end
  goto EVLOOP

:TaskIco1CLICK
  DIALOG SELECT, 0
  DIALOG REMOVE, TaskIco1
  WINDOW NORMAL, %%hwnd
  DIALOG SHOW
  %%show = 1
  goto EVLOOP

:StartBUTTON
  DIALOG HIDE, Start
  %%run = 1
  goto EVLOOP

:StopBUTTON
  DIALOG SHOW, Start
  %%run = ""
  goto EVLOOP

:CLOSE
  EXIT

:TestWindow
  DIALOG CREATE,"Test popup",-1,0,200,100,NOTITLE,ONTOP
    DIALOG ADD,STYLE,ChildS1,Comic Sans MS,16,BC,CYAN,DKBLUE
    DIALOG ADD,TEXT,ChildT1,2,2,196,96,@cr()This is a test,,ChildS1
  DIALOG SHOW
  WAIT 3
  DIALOG CLOSE
  rem -- kill extra CLOSE event --
  if @event()
  end
  exit

Cheers, Mac

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Tue Mar 25, 2003 11:38 am    Post subject: Reply with quote

Hi Mac,

It's a good idea, but what if it's the first program running on your PC? Then it will be placed on the right of the systray, but if the icon is changing, it will be placed on the left... Maybe a bit confusing for some people... Maybe you can change the icon with a Windows API message?
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Mar 25, 2003 12:04 pm    Post subject: Reply with quote

Although it will move to the right if another program (running
in the systray) is started after it, the icon stays to the right - it
doesn't show one on the left and one on the right.

Taskicons can be manipulated in C/C++ (or whatever), but not
with a simple API "SendMessage". Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2144
Location: A House

PostPosted: Tue Mar 25, 2003 8:27 pm    Post subject: Reply with quote

This is why I never posted code to do this. I tried it a year or so back,
but it was just too annoying not being able to change the icon where it
sat in the tray. Some people have icons coming and going in the tray
and an icon being change for a vds program would continue to change
location each time it was updated after another program was added to
the tray.

-Garrett

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Necroprogramming FTW! - "Wait.. Is necroprogramming legal?"
http://www.freewarehome.com <-- Freeware listings since 1996
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Mar 25, 2003 9:38 pm    Post subject: Reply with quote

Obviously "annoying" is a matter of opinion.

I find it useful when a program performs various tasks - you can
use different icons for whatever is being done at the moment AND
it's an indicator the program is running smoothly as long as the
taskicons continue to change.

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2144
Location: A House

PostPosted: Tue Mar 25, 2003 10:19 pm    Post subject: Reply with quote

Obviously you misread what I said. Let me clarify it so there's no
misunderstanding.

Having the icon constantly changing positions in the tray is seriously
annoying and can cause confusion with users.

Maybe this is acceptable for your use, but IMHO, this would not be
good for the users of a program in mass distribution.

There were talks of a dll to resolve this issue, but to date, no one has
completed a dll for this.

-Garrett

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Necroprogramming FTW! - "Wait.. Is necroprogramming legal?"
http://www.freewarehome.com <-- Freeware listings since 1996
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Mar 25, 2003 10:43 pm    Post subject: Reply with quote

I understand the meaning of "annoying" just fine. I just don't
necessarily agree.

While it's not perfect (as many VDS things aren't), I currently
use it as a monitor for some of my own utilities, and I don't think
it's nearly annoying as a popup window every few minutes (with
or without a close button) when I'm trying to type.

I never said it was a genius idea, nor did I recommend it's use
for mass marketing. This was just a code example that I had
not seen and hoped some would find useful - or at least get
some ideas from. Half the fun of programming (in my opinion)
is trying new stuff.

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2144
Location: A House

PostPosted: Wed Mar 26, 2003 7:32 am    Post subject: Reply with quote

Would be nice if within VDS itself we could just change the icon image in
place though. I've been hoping for this for a long time now.

-Garrett

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Necroprogramming FTW! - "Wait.. Is necroprogramming legal?"
http://www.freewarehome.com <-- Freeware listings since 1996
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code 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