Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Background output

Status
Not open for further replies.

AndyHollywood

Programmer
Oct 7, 2001
30
GB
Why would my program output to a text file when the window is in focus, but not when another window has the focus?

the following is in a dll and if the function that is giving me probs:

Code:
LRESULT CALLBACK KeyboardFunc (int nCode, WPARAM wParam, LPARAM lParam )
{
    HDC    hDC;
    //Timer Elements
    _ftime( &timebuffer );
    timeline = ctime( & ( timebuffer.time ) );
                        


    if ( nCode >= 0 ) {

        if ( nCode == HC_NOREMOVE )
            strcpy(szType, "NOT Removed from Queue");
        else
            strcpy(szType, "REMOVED from Queue                                             ");
        
        //strcpy(temp, keyType(wParam));
        if(pKB) //Output to txt File
            if (lParam < 0)
                fprintf(pKB, &quot;Key:%d,Up,%.19s.%hu %s&quot;,wParam,timeline, timebuffer.millitm, &timeline[20] );
            else
                fprintf(pKB, &quot;Key:%d,Down,%.19s.%hu %s&quot;,wParam,timeline, timebuffer.millitm, &timeline[20] );

        wsprintf((LPSTR)szFilterLine[KEYBOARDINDEX],
            &quot;KEYBOARD\tKey:%d\t%s&quot;,wParam,(LPSTR)szType);

        hDC = GetDC(hwndMain);
        TabbedTextOut(hDC, 1, nLineHeight * KEYBOARDINDEX,
            (LPSTR)szFilterLine[KEYBOARDINDEX],
            strlen(szFilterLine[KEYBOARDINDEX]), 0, NULL, 1);
        ReleaseDC(hwndMain, hDC);
   }
CallNextHookEx.
   return( CallNextHookEx(hhookHooks[KEYBOARDINDEX], nCode, wParam, lParam));
}


am i outputting to the text file properly?!

it paints the results in the window ok, but dosent output to the txt file?! why would this be?

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top