12

How can I add some thumbnail toolbar buttons to a QMainWindow with PyQt4, without using native code (ctypes and similar are fine, but not creating a DLL from another language)?

I'd prefer a solution that doesn't break the platform independence of my application (i.e. on Linux it should just do nothing).

Thumbnail Toolbar
(source: microsoft.com)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Lord Spectre
  • 761
  • 1
  • 6
  • 21
  • have a look at [this answer](http://stackoverflow.com/a/1744503/790439) and then read the [microsoft article](http://msdn.microsoft.com/en-us/magazine/dd942846.aspx) on the subject. – vikki Mar 07 '13 at 16:28
  • Thanks, I'll try... Do you know how does this behave on Windows XP/Vista? – Lord Spectre Mar 08 '13 at 18:00
  • I cannot compile the TLB because I'm developing under Linux and I don't have admin rights on the Windows 7 machine I use for testing. Can you compile the file in [the previous answer](http://stackoverflow.com/a/1744503/790439) for me? Thanks – Lord Spectre Mar 08 '13 at 20:55
  • I honestly don't know how this behaves in xp/vista, I'd guess that it fails silently. For the tlb just Google `taskbar.tlb`, you'll find a bunch of github repos that are using it and you can try those. I currently don't have the Windows 7sdk installed but I can do it if the other option fails. just let me know. – vikki Mar 09 '13 at 06:15
  • Thanks, it works. On XP `CreateObject` throws a `WindowsError`, which I catch and ignore. I managed to set the progress bar, but now I have trouble passing non-Python types to `ITaskbarList3` functions, specifically `HICON`, `LPTHUMBBUTTON` and `RECT*`. Do you know a soultion? – Lord Spectre Mar 09 '13 at 12:58
  • for the rect you can try `win32gui.rectangle`, for the hicon go into your `python for Windows` documentation and do a search for hicon, you'll see various functions that return a `hicon`. I can't find anything on `lpthumbbutton`, you'll have to try Google for that one, or ask a new question. – vikki Mar 09 '13 at 14:24
  • I found that I can use the structs (`RECT` and `THUMBBUTTON`) as Python classes by using `comtypes.gen.TaskbarLib.RECT` and `comtypes.gen.TaskbarLib.THUMBBUTTON`. No solution for `HICON` yet. – Lord Spectre Mar 09 '13 at 16:14
  • @LordSpectre How did you initialise `RECT` and `THUMBBUTTON`? I've had no success with those. –  Jun 13 '13 at 04:41
  • I didn't use them in my application yet (I need `HICON` too), but as far as I remember I was able to instantiate them normally (`rect=comtypes.gen.TaskbarLib.RECT()`). I'll check when I have access to my Win7 test machine. – Lord Spectre Jun 13 '13 at 17:51

1 Answers1

1

You shoud read this webpage

http://nicug.blogspot.com.br/2011/03/windows-7-taskbar-extensions-in-qt.html

good luck

sharkguto
  • 172
  • 2
  • 9