erduman.de
Ubuntu rocks!

This place is in permanent unorder. Because it simply is:

A programmer's homepage.

 

You probably came here because of:

~downloads

 

 

Or you recently were in:

~Scotland

 

 

At your own risk:

~My low-fi blog.

 

You also may be interested in:

~read more SCIFI.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

void CIT46::DoLoop()
{
    USES_CONVERSION;

    BOOL bPrev = FALSE, bNew = FALSE;
    DWORD dwStart = GetTickCount();
    while( true )
    {
        DWORD result ; 
        MSG msg ; 

        while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) 
        { 
            if (msg.message == WM_QUIT)  
                return; 
            DispatchMessage(&msg); 
        } 

        result = MsgWaitForMultipleObjects(1, &hEvent, 
                 FALSE, 1000, QS_ALLINPUT); 

        if (result == (WAIT_OBJECT_0 + 1))
        {
            // New messages have arrived. 
            // Continue to the top of the always while loop to 
            // dispatch them and resume waiting.
            continue;
        } 
        else
        { 
            // shut down flag
            if( bAbort )
                break;


            // Our Event became signaled or we timed out.
            if( StackSize() )
            {
                int iMsg = PopStack();
                DoCommand(iMsg);
            }

            // update data cyclic
            if( IsiTunesRunning() && AppCreate() )
            {
                bNew = TRUE;
                
                // mousewheel messages
                if( addVol )
                {
                    long vol = 0;
                    app->get_SoundVolume(&vol);
                    vol += InterlockedExchange(&addVol, 0);
                    app->put_SoundVolume(vol);
                    if( !StackSize() )
                        continue;
                }
                DoUpdataData( app );
            }
            else
            {
                if( artist && wcscmp(artist, L"N/A") || 
                    album && wcscmp(album, L"N/A") || 
                    track && wcscmp(track, L"N/A"))
                {
                    chg = TRUE;
                    album.Empty();
                    artist.Empty();
                    track.Empty();
                }
                bNew = FALSE;

                    // autohide
                if( IsAveDesk() && bAutoHide )
                {
                    DWORD dwNow = GetTickCount();
                    if( dwNow > dwStart + 5000 )
                    {
                        DoUpdateProcessList();
                        std::set<CString>::iterator it;
                        for(it = proc.begin(); it != proc.end(); it++ )
                        {
                            if( actproc.find((*it)) != actproc.end() )
                            {
                                dwStart = dwNow;
                                break;
                            }
                        }
                        if( dwStart != dwNow )
                        {
                            DeskletFadeOut(m_hWnd, FALSE, -1);
                            AtlTrace("Hidden!\n");
                        }
                        else
                        {
                            if( !bAbort )//  && !DeskletIsVisible(m_hWnd) )
                            {
                                DeskletFadeIn(m_hWnd, FALSE, -1);
                                AtlTrace("Revealed!\n");
                            }
                        }
                    }
                }
            }
            if( chg || bPrev != bNew )
            {
                chg = TRUE;
                bPrev = bNew;
                wasBusy = TRUE;
                OnSize(0,0,0,bNew);
                DoUpdataData( app );
            }
        }
    }
    // bAbort
    Invoke(9, IID_NULL, 0, 0, NULL, NULL, NULL, NULL);
}


This is a small excerpt from my iTunes50 docklet...

 

Categories

last.fm stats

ArtistPlays
Nine Inch Nails3929
The Velvet Underground1522
Fatboy Slim1295
Depeche Mode1074
The Doors827
David Bowie797
Soundgarden781
Bauhaus633
Faith No More605
Electric Universe595

AskUbuntu

my profile at Ask Ubuntu, Q&A for Ubuntu users and developers

StackOverflow

my profile at StackOverflow, Q&A for professional and enthusiast programmers