views:

22

answers:

0

I am writing plugins for Google SketchUp using their Ruby API. One of the common problems we (SketchUp scripters) have is that when a script is performing intensive operations it locks up the SketchUp UI and there is no way to see the progress of the current process.

What I would like to do is call the new Taskbar API in Windows7 in a hope that it will allow for a reactive progress indication.

I found this MSDN article: http://msdn.microsoft.com/en-us/magazine/dd942846.aspx

The simplest example appear to be:

ITaskbarList3* ptl;
VERIFY(CoCreateInstance(
    CLSID_TaskbarList, NULL, CLSCTX_ALL,
    IID_ITaskbarList3, (void**)&ptl));

...

HWND hmainwnd;//Application main window
ITaskbarList3* ptl;//Created earlier

DWORD WINAPI DoWork(LPVOID) {
    ptl->SetProgressState(hmainwnd, TBPF_NORMAL);
    for (int i = 0; i < WorkToDo; ++i) {
        DoSomePartOfTheWork(i);
        ptl->SetProgressValue(hmainwnd, i, WorkToDo);
    }
    ptl->SetProgressState(hmainwnd, TBPF_PAUSED);
    return 0;
}

I have briefly toyed with some simple Win32API calls from Ruby - but this one I am unable to translate.

I am able to get the window handle of the SketchUp window, but how do I initiate these taskbar progressbar calls?

(SketchUp uses Ruby 1.8)