Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

ITaskBarList UDF - Rewrite for Beta All Methods Included


  • Please log in to reply
32 replies to this topic

#1 Beege

Beege

    Universalist

  • MVPs
  • 895 posts

Posted 03 March 2010 - 06:28 PM

Last Update 10/1/11

This is a rewrite of my previous thumbnail toolbar UDF that includes all the other methods for ITaskBarList4. Some of the function new functions I really liked were the icon overlays like the IE icon in the snapshot, and SetThumbNailClip that allows you to crop the Thumbnail preview to any portion of the gui you want it to be. I tested this in 64bit and didnt have any problems so hopefully all the structure alignment problems have been fixed in autoit. As with anything I post, please let me know if you have any problems or suggestions (and I love comments). Requirements are Windows 7 and the new beta (3.3.7.18). All examples are included in the attatchment.
Special thanks to the AutoitObject Team, wraithdu for his original ITaskBarList Example, and extra thanks to trancexx for the new ObjCreateInterface() thats actually included in autoit now!! Your the F****ing Sh**t! :mellow:

Posted Image


UDF Functions
AutoIt         
; #INDEX# ======================================================================================================================= ; Title .........: ITaskBarList ; AutoIt Version : 3.3.7.18 (Beta) ; Language ......: English ; Description ...: Functions to assist in using the ITaskBarList Interface. ; Author(s) .....: Brian J Christy (Beege) ; ===============================================================================================================================   ; #CURRENT# ===================================================================================================================== ; _ITaskBar_CreateTaskBarObj - Creates a ITaskBarList object. ; _ITaskBar_SetOverlayIcon - Applies an overlay to a taskbar button to indicate application status or a notification to the user. ; _ITaskBar_SetThumbNailClip - Selects a portion of a window's client area to display as that window's thumbnail in the taskbar. ; _ITaskBar_AddTBButtons - Applies buttons that have been previously created using _ITaskBar_CreateTBButton() ; _ITaskBar_CreateTBButton - Creates a ThumbBar button ; _ITaskBar_UpdateTBButton - Shows, enables, disables, or hides buttons in a thumbnail toolbar as required by the window's current state. ; _ITaskBar_SetTBImageList - Specifies an image list that contains button images for a toolbar embedded in a thumbnail image of a window in a taskbar button flyout. ; _ITaskBar_ActivateTab - Activates an item on the taskbar. The window is not actually activated; the window's item on the taskbar is merely displayed as active. ; _ITaskBar_AddTab - Adds an item to the taskbar. ; _ITaskBar_DeleteTab - Deletes an item from the taskbar. ; _ITaskBar_SetActiveAlt - Marks a taskbar item as active but does not visually activate it. ; _ITaskBar_MarkFullscreenWindow - Marks a window as full-screen. ; _ITaskBar_RegisterTab - Informs the taskbar that a new tab or document thumbnail has been provided for display in an application's taskbar group flyout. ; _ITaskBar_UnregisterTab - Removes a thumbnail from an application's preview group when that tab or document is closed in the application. ; _ITaskBar_SetTabProperties - Allows a tab to specify whether the main application frame window or the tab window should be used as a thumbnail or in the peek feature under certain circumstances. ; _ITaskBar_SetProgressState - Sets the type and state of the progress indicator displayed on a taskbar button. ; _ITaskBar_SetProgressValue - Displays or updates a progress bar hosted in a taskbar button to show the specific percentage completed of the full operation. ; _ITaskBar_SetTabActive - Informs the taskbar that a tab or document window has been made the active window. ; _ITaskBar_SetTabOrder - Inserts a new thumbnail into a tabbed-document interface (TDI) or multiple-document interface (MDI) application's group flyout or moves an existing thumbnail to a new position in the application's group. ; _ITaskBar_SetThumbNailToolTip - Specifies or updates the text of the tooltip that is displayed when the mouse pointer rests on an individual preview thumbnail in a taskbar button flyout. ; _ITaskBar_DestroyObject - Destroys ITaskBarObject and icons freeing any memory the icons occupied ; ===============================================================================================================================

Example 1
Spoiler


Example 2
Spoiler

Attached File  ITaskBarList.html   164bytes   928 downloads
Previous Downloads:562
Note: The .html link is just to help me keep track of downloads. Open the .html file and a download dialog will display.

Edited by Beege, 01 October 2011 - 04:35 PM.

  • footswitch and FireFox like this







#2 Minikori

Minikori

    I like to cut people in my freetime

  • Active Members
  • PipPipPipPipPipPip
  • 527 posts

Posted 04 March 2010 - 11:23 PM

Great job! Glad you turned it into a UDF too. Could you make it so the picture on the button can be the icon from a specified .exe? I'd been trying to make that possible and couldn't ever get it. Thanks.
For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.

They already have a punishment system for abuse.

... and his his name is Valik.

www.minikori.com

#3 gooker

gooker

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 05 March 2010 - 02:40 AM

great ,i need it!!!
Posted Image

#4 Beege

Beege

    Universalist

  • MVPs
  • 895 posts

Posted 05 March 2010 - 06:23 AM

Great job! Glad you turned it into a UDF too. Could you make it so the picture on the button can be the icon from a specified .exe? I'd been trying to make that possible and couldn't ever get it. Thanks.

Thanks Minikori. Your question helped me spot a bug in my code so be sure to get the updated UDF before using the example I set up for you. :mellow:

AutoIt         
#include <ThumbBar.au3> #include <ButtonConstants.au3> $GUI = GUICreate("Thumbnail Button", 250, 10) GUISetState(@SW_SHOW) $AutoIt_Icon = _GetEXEIcon(@AutoItExe) $IE_Icon = _GetEXEIcon(@ProgramFilesDir & '\Internet Explorer\iexplore.exe') $but1 = _ThumbBar_CreateButton('AutoIt Icon', $AutoIt_Icon, -1, '_Autoit') $but2 = _ThumbBar_CreateButton('IE Icon', $IE_Icon, -1, '_IE') _ThumbBar_AddButtons($Gui) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func _Autoit()     MsgBox(0,'Button Pressed', 'Autoit Button has been Pressed.') EndFunc Func _IE()     MsgBox(0,'Button Pressed', 'IE Button has been Pressed.') EndFunc Func _GetEXEIcon($sPath)     Local $Icon = DllStructCreate("handle")     $iIcon = _WinAPI_ExtractIconEx($sPath, 0, 0, DllStructGetPtr($Icon), 1)     If @error Then Return SetError(1, 0, 0)     Return DllStructGetData($Icon,1) EndFunc


#5 Minikori

Minikori

    I like to cut people in my freetime

  • Active Members
  • PipPipPipPipPipPip
  • 527 posts

Posted 06 March 2010 - 02:48 AM

Thanks! This helped me a lot.
For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.

They already have a punishment system for abuse.

... and his his name is Valik.

www.minikori.com

#6 gooker

gooker

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 07 March 2010 - 07:16 AM

1, i use the first Example 1.
when i hide the gui(WinSetState($GUI,"",@SW_HIDE)),and then show itWinSetState($GUI,"",@SW_SHOW) ,the Thumbnail Toolbar disappeared.

2, use the udf in my program, the console show
"! COM Error ! Number: 0x00000002 ScriptLine: 3748 - Can't install a new Errorhandler when one is still active."
my error.

Edited by gooker, 07 March 2010 - 07:19 AM.

Posted Image

#7 Beege

Beege

    Universalist

  • MVPs
  • 895 posts

Posted 08 March 2010 - 02:44 AM

1, i use the first Example 1.
when i hide the gui(WinSetState($GUI,"",@SW_HIDE)),and then show itWinSetState($GUI,"",@SW_SHOW) ,the Thumbnail Toolbar disappeared.

Its because its a new tab has been created. Same thing will happen if you use methods DeleteTab and AddTab. You must call _ThumbBar_AddButtons($GUI) after being restored. ex:

GUISetState(@SW_HIDE) sleep(3000) GUISetState(@SW_SHOW) _ThumbBar_AddButtons($GUI)


#8 gooker

gooker

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 08 March 2010 - 05:24 AM

Its because its a new tab has been created. Same thing will happen if you use methods DeleteTab and AddTab. You must call _ThumbBar_AddButtons($GUI) after being restored. ex:

GUISetState(@SW_HIDE) sleep(3000) GUISetState(@SW_SHOW) _ThumbBar_AddButtons($GUI)


thanks.
Posted Image

#9 trancexx

trancexx

    Queen F. Elizabeth MCXI

  • Active Members
  • PipPipPipPipPipPip
  • 5,989 posts

Posted 14 March 2010 - 08:41 PM

I installed win 7 x64 yesterday since I'm on new machine. One of first things I wanted to do is test these new things this system offers. It's nice, I must say.

Why am I posting this? There is a bug with AutoIt an DllStructCreate() function. It's causing (or could be) your udf not to work properly on x64. Why no one said that I guess it's a mystery. Beege, do you have x64 win 7? I see you use some code that involves checking for that. Are examples working on x64 AutoIt for you?

Anyway, considering how you construct $tagTHUMBBUTTON and access created structure afterwards you should declare $tagTHUMBBUTTON like this:
$tagTHUMBBUTTON = "dword;dword;dword;handle;WCHAR[260];dword_ptr"

Otherwise I don't see how could this udf work with both 32bit or 64bit AutoIt.
You correct - I rate.

Maybe I'm in love (Sshh, it's a secret)

.

 

eMyvnE


#10 monoceres

monoceres

    asdf

  • MVPs
  • 3,957 posts

Posted 14 March 2010 - 08:58 PM

I installed win 7 x64 yesterday since I'm on new machine. One of first things I wanted to do is test these new things this system offers. It's nice, I must say.


Does that mean I'm finally off the hook as your 64-bit bitch? :mellow:

Broken link? PM me and I'll send you the file!


#11 trancexx

trancexx

    Queen F. Elizabeth MCXI

  • Active Members
  • PipPipPipPipPipPip
  • 5,989 posts

Posted 14 March 2010 - 09:14 PM

Yes, 64-bit part can be removed.

Maybe I'm in love (Sshh, it's a secret)

.

 

eMyvnE


#12 Beege

Beege

    Universalist

  • MVPs
  • 895 posts

Posted 17 March 2010 - 08:38 PM

@trancexx, Sorry for the delay. Don't know how I missed that there was a new post. I am running 32bit. The 64bit checking was from an example in help file from one of the _guiimagelist functions. Did the examples fail for you? If so then just like you said, why the hell didnt anyone say something? There have been like 80+ downloads. :(

Anyway thanks for the fix. (it did fix it right?). I will make the changes tonight.

Edited by Beege, 17 March 2010 - 08:56 PM.


#13 Minikori

Minikori

    I like to cut people in my freetime

  • Active Members
  • PipPipPipPipPipPip
  • 527 posts

Posted 17 March 2010 - 09:25 PM

Funny it didn't work on your machine, trancexx, I'm running x64 Windows 7 Ultimate and this has worked the entire time :(
For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.

They already have a punishment system for abuse.

... and his his name is Valik.

www.minikori.com

#14 Beege

Beege

    Universalist

  • MVPs
  • 895 posts

Posted 17 March 2010 - 10:18 PM

Funny it didn't work on your machine, trancexx, I'm running x64 Windows 7 Ultimate and this has worked the entire time :(

Hmmm, Thats intresting. I have been telling myself this didn't make much sense. That dword only stores conbination of THUMBBUTTONFLAGS:
typedef enum THUMBBUTTONFLAGS {     THBF_ENABLED = 0x00000000,     THBF_DISABLED = 0x00000001,     THBF_DISMISSonclick = 0x00000002,     THBF_NOBACKGROUND = 0x00000004,     THBF_HIDDEN = 0x00000008,     THBF_NONINTERACTIVE = 0x00000010 } THUMBBUTTONFLAGS;

That should only be a max value of 32 and a dword is plenty big enough to hold that. :) What version autoit are you using Minikori?

#15 trancexx

trancexx

    Queen F. Elizabeth MCXI

  • Active Members
  • PipPipPipPipPipPip
  • 5,989 posts

Posted 18 March 2010 - 04:27 PM

I don't see what's interesting about that. :(
Everything else is more interesting. For example it's interesting you not asking what exactly is the problem on x64?
I would have.

Maybe I'm in love (Sshh, it's a secret)

.

 

eMyvnE


#16 Beege

Beege

    Universalist

  • MVPs
  • 895 posts

Posted 19 March 2010 - 01:17 AM

Its interesting that its working on some 64bit computers and not others. I also assumed that when you tell me I should declare the $tagTHUMBBUTTON structure different, that the problem is coming from the structure. Are you fucking with me or something? What exactly is the problem on x64? :(

#17 trancexx

trancexx

    Queen F. Elizabeth MCXI

  • Active Members
  • PipPipPipPipPipPip
  • 5,989 posts

Posted 19 March 2010 - 06:47 AM

Its interesting that its working on some 64bit computers and not others.

It works on all x64 computers. It's not working on x64 computers.
Both is true.

I also assumed that when you tell me I should declare the $tagTHUMBBUTTON structure different, that the problem is coming from the structure. Are you fucking with me or something? What exactly is the problem on x64? :(

Structure will be unaligned on x64 AutoIt. And there is no way of fixing that. There is no syntax.
Thing is when some bigger structures is made of smaller structures
BigStructure = SmallStructure1;SmallStructure2;SmallStructure3;
every structure for itself must be properly aligned.
Since align keyword can be used only at the beginning of structure tags AutoIt will mess things up in your case.
To go around the problem you must add another member at the end of every structure that you make for x64 AutoIt. But you can't because you are accessing elements by their ordinal values. You can on the other hand do dword[2], but that's more confusing and requires more work.

It's not important what system is run on. It's important what AutoIt is run on.

Maybe I'm in love (Sshh, it's a secret)

.

 

eMyvnE


#18 Beege

Beege

    Universalist

  • MVPs
  • 895 posts

Posted 20 March 2010 - 12:32 AM

Thanks for the explanation, but I'm still left wondering if changing the dword to a dword_ptr fixed it. :(

Structure will be unaligned on x64 AutoIt. And there is no way of fixing that.

Is this some kind of a bug?

It's not important what system is run on. It's important what AutoIt is run on.

This is why I wanted to know what version Minikori was using..

#19 wraithdu

wraithdu

    this noise inside my head

  • MVPs
  • 2,389 posts

Posted 21 March 2010 - 05:40 PM

According to help file:

If a change of alignment is needed "align" can be use before the first element which need to be changed.

So I think you can use the 'align' keyword before any member.

I've run into this problem before with the _GUICtrlListView_Create example. The definition of $tagNMLVKEYDOWN is:
Global Const $tagNMLVKEYDOWN = $tagNMHDR & ";align 1;word VKey;uint Flags"

This still somehow messes up the alignment on x64. You have to add a 32-bit member to the end of $tagNMHDR as padding when run under x64 (dword, int, whatever). I'd be interested to know how the C compilers handle this structure alignment.

In this case, the 'align' keyword cannot fix this problem.

#20 James

James

    Universalist

  • MVPs
  • 10,164 posts

Posted 28 March 2010 - 02:24 PM

Woo this is awesome Posted Image

Very good job there!

James




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users