Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


SetTimer?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Fri May 11, 2007 7:40 pm    Post subject: SetTimer? Reply with quote

Confused Whats up people, well I'm not sure if thats the right way to go but I'm trying to close a window in this case notepad in 2 mins. I believe SetTimer is the right way to go. But even there I can't get it to work. I'm developing a WIN32 app.

As we are here one more thing. How to we get the input from a user, from an editbox?

_________________
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Fri May 11, 2007 7:50 pm    Post subject: Reply with quote

1) call SetTimer with NULL for the callback and 120000 milliseconds count
2) in your messageloop, close notepad on WM_TIMER message
3) call InvalidateRect to stop the timer

zomgiownyou wrote:
How to we get the input from a user, from an editbox?


SendMessage(editWnd, WM_GETTEXT, (WPARAM)sizeof(Buffer), (LPARAM)Buffer);
Back to top
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Fri May 11, 2007 8:05 pm    Post subject: Reply with quote

appalsap wrote:
1) call SetTimer with NULL for the callback and 120000 milliseconds count

Thanks for the fast reply. So this should be right
Code:
SetTimer(hwnd,             
    IDT_TIMER1,           
    120000,               
    (TIMERPROC) NULL);     


Quote:
2) in your messageloop, close notepad on WM_TIMER message


Code:
case WM_TIMER:
 
    switch (wParam)
    {
        case IDT_TIMER1:
            HWND hWin;
            hWin = FindWindow(NULL,"Noptepad");
    SendMessage(hWin,WM_CLOSE,(LPARAM)0,(WPARAM)0);
 
             return 0;
}


Ref from msdn, so I believe I have to add IDT_TIMER1 in resource

_________________
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Fri May 11, 2007 8:11 pm    Post subject: Reply with quote

you only need to make a unique ID for your timer if you want to call KillTimer. If you use NULL the system will generate a unique timer id for you, but you have the right idea. Just remember to stop the timer once you've closed notepad (unless you want to do it constantly) else it will execute that code every 2 minutes.

Last edited by appalsap on Fri May 11, 2007 8:16 pm; edited 1 time in total
Back to top
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Fri May 11, 2007 8:14 pm    Post subject: Reply with quote

Once again thanks a lot, using google for those function is not very promising and using www.koders.com is not helpfully either, Thanks

*EDIT* I searched a bit, and I find it more easy to use
Code:
GetDlgItemText (Hwnd,IDC_EDIT1, buffer, 256);

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites