spokes
Full Member
I <3 Rollerblading
Posts: 423 Reputation: 10
34 / /
Joined: May 2004
|
RE: Can anybody develop this simple thing?
segosa, as i don't have a c++ compiler, and im dumb at it, could you quickly edit one for me, so it presses enter (about 5 times), then f5? every 5 minutes?
(for surfjunky in the nights, lol)
is this right? if so all i need is someone to compile it
code: #include <windows.h>
#include "resource.h"
#pragma comment(linker, "/NODEFAULTLIB")
#pragma comment(linker, "/ENTRY:NOCRT_ENTRY")
#pragma comment(linker, "/ALIGN:4096")
#define DEFAULT_TIMER_INTERVAL 300000
unsigned int nTimerId=0;
HWND hwndDlg;
VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
if (uMsg==WM_TIMER)
{
if (GetActiveWindow() != hwndDlg)
keybd_event(VK_RETURN,NULL,NULL,NULL);
keybd_event(VK_RETURN,NULL,NULL,NULL);
keybd_event(VK_RETURN,NULL,NULL,NULL);
keybd_event(VK_RETURN,NULL,NULL,NULL);
keybd_event(VK_RETURN,NULL,NULL,NULL);
keybd_event(VK_F5,NULL,NULL,NULL);
}
}
INT_PTR CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
switch (uMsg)
{
case WM_CLOSE:
ExitProcess(0);
break;
case WM_COMMAND:
{
switch LOWORD(wParam)
{
case CMD_ONOFF:
{
char *szText=(char*)GlobalAlloc(GPTR,256+1);
GetDlgItemText(hwndDlg,CMD_ONOFF,szText,256);
if (lstrcmp(szText,"Enable")==0)
{
if (nTimerId)
break;
nTimerId=(int)SetTimer(NULL,NULL,DEFAULT_TIMER_INTERVAL,TimerProc);
if (nTimerId)
SetDlgItemText(hwndDlg,CMD_ONOFF,"Disable");
}
else //disable the timer
{
if (!nTimerId)
break;
if (KillTimer(NULL,nTimerId))
{
SetDlgItemText(hwndDlg,CMD_ONOFF,"Enable");
nTimerId=0;
}
}
GlobalFree(szText);
break;
}
}
}
}
return 0;
}
int __stdcall WinMain(HMODULE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
hwndDlg=CreateDialog(hInstance,MAKEINTRESOURCE(DLG_MAIN),NULL,DialogProc);
ShowWindow(hwndDlg,SW_SHOWDEFAULT);
MSG msg;
BOOL bRet;
while ((bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
{
if (bRet == -1)
ExitProcess(0);
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int)msg.wParam;
}
void NOCRT_ENTRY(void)
{
WinMain((HINSTANCE)GetModuleHandle(NULL),NULL,GetCommandLine(),SW_SHOWDEFAULT);
}
This post was edited on 02-24-2005 at 06:51 PM by spokes.
|
|