PDA

View Full Version : Week of the c++ problems o.O



sk1nhead
12-01-2007, 08:09 AM
Okay, i've (tried to) make a hotkey for zoom In a timer.
This is the code:

case THIRDTIMER: //timer for zoom hotkey
{
if (GetKeyState(VK_RBUTTON)&1<< 0xF)
Writelong(0xADD126, 1);
else
Writelong(0xADD126, 0);
}
break;
I've defined the THIRDTIMER (and the other timers) in the resource.h. And i'm NOT getting any errors. But when I press rightmouse click in-game. nothing happens.

Did I do something wrong with the getkeystate?

Dxt-Cobra
12-01-2007, 08:51 AM
you have to activate the timer,then it will work.

to turn a timer on at the start of your app. ,do this.


find this:


OnInitDialog()


inside this function is:


{
CDialog::OnInitDialog();

// Add "About..." menu item to system menu.

// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}

// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon

SetTimer(THIRDTIMER,1,NULL); //////heres your timer i added

return TRUE;
}

sk1nhead
12-01-2007, 09:11 AM
Thanks, can be closed:D