PDA

View Full Version : Add timers to your C++ app



Dxt-Cobra
10-07-2007, 05:59 PM
How to add timers to your C++ app
by cobra

Ok well if you have your trainer open in C++,Rt Click on your form dialog

Hit Class wizard
look for wm_timers as shown below in messages box.

http://img442.imageshack.us/img442/3391/timersmo3.jpg

click WM_TIMERS,then click add function
now we have just set up our timer function for coding.
Now while we are still in Class Wizard,hit edit code.

It will take you to were we code our timers,or make each timer.

This is what you should see


void CHiDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default

CDialog::OnTimer(nIDEvent);
}


now remove the todo,and place this in there,its our fisrt timer we are making
as you can see our timers our defined as FIRSTTIMER,SECONDTIMER,THIRDTIMER,etc.


switch(nIDEvent)
{
case FIRSTTIMER:
{
//Hack for timer goes here,say stamina
Writealong (0x7fb344,115342553); //this is not a real address
}
break; // end of a case
}


now this is how it would look if you placed the code in properly


void CHiDlg::OnTimer(UINT nIDEvent)
{
switch(nIDEvent)
{
case FIRSTTIMER:
{
//Hack for timer goes here,say stamina
Writealong (0x7fb344,115342553); //this is not a real address
}
break; // end of a case
}
CDialog::OnTimer(nIDEvent);
}



now we are not done yet,we must add this timer to our resource.h
to open this file goto your window on the left were all the files are stored
open the header folder,and double click the resource.h file
Now we can add our timer in resource.h to define our timer

here is a pic to show you better
http://img249.imageshack.us/img249/2329/resourcehpicqr2.jpg

now you see all are #defines,we want to add our timers in here in the first batch of code




#define IDR_MAINFRAME 128
#define IDD_HI_DIALOG 102


now if you have buttons and all on your app already you wil have alot more #defines like this


//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Dxt Vip Trainer.rc
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_DXTVIPTRAINER_DIALOG 102
#define IDR_MAINFRAME 128
#define IDR_1 133
#define IDD_XPSTYLES_DIALOG 134
#define IDR_11 143
#define IDI_ICON1 152
#define IDC_BUTTON1 1000
#define IDC_BUTTON2 1001
#define IDC_BUTTON3 1002
#define IDC_BUTTON4 1003
#define IDC_BUTTON5 1004
#define IDC_BUTTON6 1005
#define IDC_BUTTON7 1006
#define IDC_BUTTON8 1007
#define IDC_BUTTON9 1008
#define IDC_BUTTON10 1009
#define IDC_BUTTON11 1010
#define IDC_BUTTON12 1011
#define IDC_BUTTON13 1012
#define IDC_BUTTON14 1013
#define IDC_BUTTON15 1021
#define IDC_BUTTON16 1022
#define IDC_BUTTON17 1023
#define IDC_BUTTON18 1024
#define IDC_BUTTON19 1025
#define IDC_BUTTON20 1026
#define IDC_BUTTON21 1027
#define IDC_BUTTON22 1031
#define IDC_BUTTON23 1032
#define IDC_BUTTON24 1033
#define IDC_BUTTON25 1034
#define IDC_BUTTON26 1037
#define IDC_BUTTON27 1038
#define IDC_BUTTON28 1039
#define IDC_BUTTON29 1040
#define IDC_BUTTON30 1041
#define IDC_BUTTON31 1042
#define IDC_BUTTON32 1044
#define FIRSTTIMER 1045
#define IDC_BUTTON33 1045
#define SECONDTIMER 1046
#define IDC_BUTTON34 1046
#define THIRDTIMER 1047
#define IDC_BUTTON35 1047
#define FORTHTIMER 1048
#define IDC_BUTTON36 1048
#define FIFTHTIMER 1049
#define IDC_BUTTON37 1049
#define SIXTHTIMER 1050
#define IDC_BUTTON38 1050
#define IDC_BUTTON39 1051
#define IDC_BUTTON40 1057
#define IDC_BUTTON41 1058
#define IDC_BUTTON42 1059
#define IDC_BUTTON43 1060
#define IDC_BUTTON44 1061
#define IDC_BUTTON45 1064
#define SEVENTHTIMER 1065
#define IDC_BUTTON46 1065
#define IDC_BUTTON47 1067
#define IDC_BUTTON48 1068
#define IDC_BUTTON49 1070
#define IDC_BUTTON50 1071
#define EIGHTHTIMER 1073
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 153
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1064
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif


this is a code snip from my trainer in resource.h
as you can see ive added my timers with a number value

now lets add your first timer


//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by HI.RC
//
#define IDR_MAINFRAME 128
#define IDD_HI_DIALOG 102
#define FIRSTTIMER 1003
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS

#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 32771
#endif
#endif


as you can see i added my #define FIRSTTIMER 1003
we have to add a number to define this timer in the app,i used 1003 so nothing else has that number,so no errors
if you add more timers it would be 1004 and so on as long as noting else has that number.
now ever time we add a timer in our .cpp,we must come here and add the define timer
so if we had ten timers,you have to define all ten in resources.h

look at my code snip if need to see more timers in resource.h

now we are ready to do a button to call our timer on or off
lets goto your dialog and add a button

in your button code do


SetTimer(FIRSTTIMER, 1, NULL);


so this is how it will look inside your button code


void CHiDlg::OnButton1()
{
SetTimer(FIRSTTIMER, 1, NULL);
}


now go back to your dialog and add another button off button
goto the code for our button do


KillTimer(FIRSTTIMER);


again this is how it should look


void CHiDlg::OnButton2()
{
KillTimer(FIRSTTIMER);
}


now we have just did a timer in C++ on and off function
well thats it for now compile it,when it asks to reload the project hit no,Very important or start over.

i will show you how to do hotkeys in a timer next.Its not as hard as addinga timer.

Wicalemos
10-31-2007, 05:46 PM
yo im using ur C++ and keygen thing but it wont lemme open any resource.h shit can u help meh?

Doomdive
11-07-2007, 01:11 PM
the menu looks a bit different... is there a other solution to deactivate hacks?

http://rapidshare.com/files/68128500/cexample.JPG

Doomdive
11-07-2007, 01:49 PM
problem solved, works brilliantly love ya cobra!!

SH15TER
11-09-2007, 03:47 PM
ok but next time Edit your post :P

net
11-26-2007, 10:38 PM
hi Cobra im new in c++ haw i do time 2 plz i need your help

is done thx

shocky
12-07-2007, 04:53 PM
hey i tryed this tut out on how to make it work with stamina and i got these 3 errors
error C2065: 'FIRSTTIMER' : undeclared identifier
error C2051: case expression not constant
error C2065: 'Writealong' : undeclared identifier
warning C4060: switch statement contains no 'case' or 'default' labels
can somone please tell me what to do and how do i fix the errors and warning?

wr194t
12-07-2007, 08:58 PM
hey i tryed this tut out on how to make it work with stamina and i got these 3 errors
error C2065: 'FIRSTTIMER' : undeclared identifier
error C2051: case expression not constant
error C2065: 'Writealong' : undeclared identifier
warning C4060: switch statement contains no 'case' or 'default' labels
can somone please tell me what to do and how do i fix the errors and warning?You haven't declared FIRSTTIMER in your resource.h file, and you haven't got the writelong function in your code, or you have only editee the function name writelong, but not in your hack code.

iloveyou
12-07-2007, 09:01 PM
i can help u my xfire is jboogie3

shocky
12-07-2007, 09:29 PM
kk thanks guys i fixed it and jboogie this part is for u this is how to add second timer and etc

where it says
void CHiDlg::OnTimer(UINT nIDEvent)
{
switch(nIDEvent)
{
case FIRSTTIMER:
{
//Hack for timer goes here,say stamina
Writealong (0x7fb344,115342553); //this is not a real address
}
break; // end of a case
}
right under the last } re copy the text above and change FIRSTTIMER to SECONDTIMER and thats how.

ganglyman21
12-09-2007, 09:40 AM
Thanks very much man helped me a lot been racking my brain for a few days now, finally got there and got some things to work makes me happy :D

R3bel19
12-14-2007, 03:19 PM
Hi, I had 6 errors *lol* and I found 3 errors.
-In this tut you wrote writealong but it is just writelong!-


EDIT: I got It no errors anymore!

Rebel19

andy105
12-16-2007, 07:45 PM
how do you add anthoer timer i got one to work but it wont let me add antoer one

wr194t
12-17-2007, 04:51 AM
This is the first timer:


case FIRSTTIMER:
{
//Hack for timer goes here,say stamina
Writealong (0x7fb344,115342553); //this is not a real address
}
break; // end of a case

To add another add this under break;:


case SECONDTIMER:
{

hack code here
}
break;

Don't forget to declare the second timer in your resource.h, and add this at the bottom of your last timer:


}
CDialog::OnTimer(nIDEvent);
}

So the whole code will look like this:


void CHiDlg::OnTimer(UINT nIDEvent)
{
switch(nIDEvent)
{
case FIRSTTIMER:
{
//Hack for timer goes here,say stamina
Writealong (0x7fb344,115342553); //this is not a real address
}
break; // end of a case

case SECONDTIMER:
{

hack code here address
}
break;
}
CDialog::OnTimer(nIDEvent);
}

f4rshad
12-17-2007, 07:03 AM
Getting this facking error:

E:\Microsoft Visual Studio\MyProjects\idk\idkDlg.cpp(184) : error C2065: 'WriteALong' : undeclared identifier
Generating Code...
Error executing cl.exe.


i started to make NoRecoil^^

pls help

masterboy
12-17-2007, 07:28 AM
Its WriteLong not WriteAlong

f4rshad
12-17-2007, 07:33 AM
OMFG:

:\Microsoft Visual Studio\MyProjects\timers\timersDlg.cpp(181) : error C2065: 'WriteLong' : undeclared identifier
Generating Code...
Error executing cl.exe.

wr194t
12-17-2007, 07:38 AM
You need this in your coding:


void Writelong(long addy, long value)
{
memory();
WriteProcessMemory(hProcess, (LPVOID*)(DWORD) addy, &value, sizeof(value), NULL);

}

f4rshad
12-17-2007, 07:40 AM
and where do i put this?

graz

wr194t
12-17-2007, 07:43 AM
Above your hacks.

f4rshad
12-17-2007, 07:45 AM
am i silly?!

E:\Microsoft Visual Studio\MyProjects\timers\timersDlg.cpp(176) : error C2065: 'memory' : undeclared identifier
E:\Microsoft Visual Studio\MyProjects\timers\timersDlg.cpp(177) : error C2065: 'hProcess' : undeclared identifier
E:\Microsoft Visual Studio\MyProjects\timers\timersDlg.cpp(188) : error C2065: 'WriteLong' : undeclared identifier

wr194t
12-17-2007, 07:56 AM
Read this tutorial:
http://www.dxth4x.com/forums/showthread.php?t=4

HydroQc
02-21-2008, 06:08 PM
For SJ whane you are pressing Ctrl do you go up and stay there...Or you are coming down...Do we have to add extra code to come down??

jammy122333
02-24-2008, 06:26 AM
my scope was fine with no errors but what have i done wrong with my timer?

i get this message, can anyone help me? my code is below ( i nkow it is detected, will make in undetected aftyer i get he hang of C++)


Compiling...
1337h4x PublicDlg.cpp
C:Documents and SettingsJamesMy DocumentsC++1337h4x Public1337h4x PublicDlg.cpp(211) : error C2065: 'FIRSTTIMER' : undeclared identifier
C:Documents and SettingsJamesMy DocumentsC++1337h4x Public1337h4x PublicDlg.cpp(218) : error C2051: case expression not constant
C:Documents and SettingsJamesMy DocumentsC++1337h4x Public1337h4x PublicDlg.cpp(221) : error C2065: 'Writealong' : undeclared identifier
C:Documents and SettingsJamesMy DocumentsC++1337h4x Public1337h4x PublicDlg.cpp(225) : warning C4060: switch statement contains no 'case' or 'default' labels
Error executing cl.exe."





heres my code, thought i would do all so u can read it all :)

// 1337h4x PublicDlg.cpp : implementation file
//

#include "stdafx.h"
#include "1337h4x Public.h"
#include "1337h4x PublicDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
DWORD proc_id;
HANDLE hProcess;

void memory()
{
HWND hWnd = FindWindow(0, "WarRock");
GetWindowThreadProcessId(hWnd, &proc_id);
hProcess = OpenProcess(PROCESS_ALL_ACCESS|PROCESS_VM_OPERATIO N|PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_QUERY_I NFORMATION, FALSE, proc_id);
}

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
CAboutDlg();

// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA

// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMy1337h4xPublicDlg dialog

CMy1337h4xPublicDlg::CMy1337h4xPublicDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMy1337h4xPublicDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMy1337h4xPublicDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CMy1337h4xPublicDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMy1337h4xPublicDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CMy1337h4xPublicDlg, CDialog)
//{{AFX_MSG_MAP(CMy1337h4xPublicDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, OnScopeOn)
ON_BN_CLICKED(IDC_BUTTON2, OnInstantSpawnOn)
ON_WM_TIMER()
ON_BN_CLICKED(IDC_BUTTON3, OnInstantSpawnOff)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMy1337h4xPublicDlg message handlers

BOOL CMy1337h4xPublicDlg::OnInitDialog()
{
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

// TODO: Add extra initialization here

return TRUE; // return TRUE unless you set the focus to a control
}

void CMy1337h4xPublicDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}

// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.

void CMy1337h4xPublicDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting

SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;

// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}



// The system calls this to obtain the cursor to display while the user drags
// the minimized window.

void Writelong(long addy, long value)
{
memory();
WriteProcessMemory(hProcess, (LPVOID*)(DWORD) addy, &value, sizeof(value), NULL);

}
void WritePointerFloat(long addy, short offset, float value)
{
long maddy;
long saddy;
memory();
ReadProcessMemory(hProcess, (LPVOID*)(DWORD) addy, &maddy, sizeof(maddy), NULL);
saddy = maddy + offset;
WriteProcessMemory(hProcess, (LPVOID*)(DWORD) saddy, &value, sizeof(value), NULL);
}

HCURSOR CMy1337h4xPublicDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}

void CMy1337h4xPublicDlg::OnScopeOn()
{
Writelong(0xB08A6A, 1);
}

void CMy1337h4xPublicDlg::OnInstantSpawnOn()
{
SetTimer(FIRSTTIMER, 1, NULL);
}

void CMy1337h4xPublicDlg::OnTimer(UINT nIDEvent)
{
switch(nIDEvent)
{
case FIRSTTIMER:
{
//Hack for timer goes here,say stamina
Writealong (0x00D854A8,0);
Writealong (0x010B2E3C,0);//adress and offset
}
break; // end of a case
}
CDialog::OnTimer(nIDEvent);
}

void CMy1337h4xPublicDlg::OnInstantSpawnOff()
{
KillTimer(FIRSTTIMER);
}

Ty for reading this far lol :/

Please try and help

wr194t
02-24-2008, 07:48 AM
You need to declare your timer in your resource.h, and you have used Writealong in your timer, instead of Writelong.

olie122333
02-24-2008, 08:39 AM
You need to declare your timer in your resource.h, and you have used Writealong in your timer, instead of Writelong.

Ah ok, i thought i did declare it but i will check, axnd the writelong mistake is because i am new to C++, i only know VB6

wazofski
03-23-2008, 07:14 AM
I get this error:

error C2143: syntax error : missing ':' before '{'

wr194t
03-23-2008, 08:25 AM
I get this error:

error C2143: syntax error : missing ':' before '{'You forgot to put a : somewhere. Double click the error, look where it shows you the error and copy & paste that line of code here.

DeeJay-M
03-24-2008, 11:17 AM
--------------------Configuration: pop - Win32 Debug--------------------
Compiling...
NewDialog.cpp
C:Documents and SettingsJohanBureaubladPwnH4xNewDialog.cpp(90) : error C2065: 'Writealong' : undeclared identifier
Error executing cl.exe.

pop.exe - 1 error(s), 0 warning(s)

OMG -- What's this

void CNewDialog::OnTimer(UINT nIDEvent)
{
switch(nIDEvent)
{
case FIRSTTIMER:
{
//Hack for timer goes here,say stamina
Writealong (0x288,115342553); //this is not a real address
}
break; // end of a case
}
CDialog::OnTimer(nIDEvent);
}

void CNewDialog::OnStaminaOn()
{
SetTimer(FIRSTTIMER, 1, NULL);
}

void CNewDialog::OnStaminaOff()
{
KillTimer(FIRSTTIMER);
}


Plz help me ,, i get error

masterboy
03-24-2008, 11:29 AM
Its Writelong instead of Writealong

seth26jan
03-29-2008, 10:11 PM
If, in a button, you were to kill and then set another timer. How would that look?
I get these errors.


--------------------Configuration: SethyboyPub - Win32 Debug--------------------
Compiling...
SethyboyPubDlg.cpp
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(472) : error C2601: 'OnButton1' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(477) : error C2601: 'OnButton2' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(482) : error C2601: 'OnButton3' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(487) : error C2601: 'OnButton4' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(492) : error C2601: 'OnButton5' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(497) : error C2601: 'OnButton6' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(502) : error C2601: 'OnButton7' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(507) : error C2601: 'OnButton8' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(512) : error C2601: 'OnButton9' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(517) : error C2601: 'OnButton10' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(522) : error C2601: 'OnButton11' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(527) : error C2601: 'OnButton12' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(532) : error C2601: 'OnButton13' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(537) : error C2601: 'OnButton14' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(542) : error C2601: 'OnButton15' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(547) : error C2601: 'OnButton16' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(554) : error C2601: 'OnButton17' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(559) : error C2601: 'OnButton18' : local function definitions are illegal
C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPubDlg. cpp(769) : fatal error C1075: end of file found before the left brace '{' at 'C:Program FilesMicrosoft Visual StudioMyProjectsSethyboySethyboyPubSethyboyPu
bDlg.cpp(749)' was matched
Error executing cl.exe.
SethyboyPub.exe - 19 error(s), 0 warning(s)

PS: I have 56 buttons and a lot of timers. Any tips?

sailerboy
03-29-2008, 10:29 PM
from what i see, you have 1 { thats missing. Thats whats causing all the errors.

seth26jan
03-29-2008, 10:42 PM
from what i see, you have 1 { thats missing. Thats whats causing all the errors.
But where? Look at this:


//end of last case
break;
}
CDialog::OnTimer(nIDEvent);
}
void CSethyboyPubDlg::OnButton1()
{
SetTimer(stamina, 1, NULL);
}
void CSethyboyPubDlg::OnButton2()
{
KillTimer(stamina);
}
void CSethyboyPubDlg::OnButton3()
{
SetTimer(nfd, 1, NULL);
}
void CSethyboyPubDlg::OnButton4()
{
KillTimer(nfd);
}
void CSethyboyPubDlg::OnButton5()
{
SetTimer(wait, 1, NULL);
}
void CSethyboyPubDlg::OnButton6()
{
KillTimer(wait);
}
void CSethyboyPubDlg::OnButton7()
{
SetTimer(fifthslot, 1, NULL);
}
void CSethyboyPubDlg::OnButton8()
{
KillTimer(fifthslot);
}
void CSethyboyPubDlg::OnButton9()
{
SetTimer(bounds, 1, NULL);
}
void CSethyboyPubDlg::OnButton10()
{
KillTimer(bounds);
}
void CSethyboyPubDlg::OnButton11()
{
SetTimer(ffah, 1, NULL);
}
void CSethyboyPubDlg::OnButton12()
{
KillTimer(ffah);
}
void CSethyboyPubDlg::OnButton13()
{
SetTimer(spread, 1, NULL);
}
void CSethyboyPubDlg::OnButton14()
{
KillTimer(spread);
}
void CSethyboyPubDlg::OnButton15()
{
SetTimer(esp, 1, NULL);
}
void CSethyboyPubDlg::OnButton16()
{
KillTimer(esp);
}
SetTimer(espoff, 1, NULL);
}
void CSethyboyPubDlg::OnButton17()
{
SetTimer(antikick, 1, NULL);
}
void CSethyboyPubDlg::OnButton18()
{
KillTimer(antikick);
{
SetTimer(antikickoff, 1, NULL);
}
void CSethyboyPubDlg::OnButton19()
{
SetTimer(ammo, 1, NULL);
}
void CSethyboyPubDlg::OnButton20()
{
KillTimer(ammo);
{
SetTimer(ammoff, 1, NULL);
}
void CSethyboyPubDlg::OnButton21()
{
SetTimer(headshot, 1, NULL);
}
void CSethyboyPubDlg::OnButton22()
{
KillTimer(headshot);
{
SetTimer(hsoff, 1, NULL);
}
void CSethyboyPubDlg::OnButton23()
{
SetTimer(invis, 1, NULL);
}
void CSethyboyPubDlg::OnButton24()
{
KillTimer(invis);
{
SetTimer(invioff, 1, NULL);
}
void CSethyboyPubDlg::OnButton25()
{
SetTimer(scope, 1, NULL);
}
void CSethyboyPubDlg::OnButton26()
{
KillTimer(scope)l
}
void CSethyboyPubDlg::OnButton27()
{
SetTimer(recoil, 1, NULL);
}
void CSethyboyPubDlg::OnButton28()
{
KillTimer(recoil);
}
void CSethyboyPubDlg::OnButton30()
{
KillTimer(sky);
}
void CSethyboyPubDlg::OnButton29()
{
SetTimer(sky, 1, NULL);
}
void CSethyboyPubDlg::OnButton31()
{
SetTimer(medic, 1, NULL);
}
void CSethyboyPubDlg::OnButton32()
{
KillTimer(medic);
{
SetTimer(medicoff, 1, NULL);
}
void CSethyboyPubDlg::OnButton33()
{
SetTimer(stw, 1, NULL);
}
void CSethyboyPubDlg::OnButton34()
{
KillTimer(stw);
{
SetTimer(stwoff, 1, NULL);
}
void CSethyboyPubDlg::OnButton35()
{
SetTimer(wtw, 1, NULL);
}
void CSethyboyPubDlg::OnButton36()
{
KillTimer(wtw);
{
SetTimer(wtwoff, 1, NULL);
}
void CSethyboyPubDlg::OnButton37()
{
SetTimer(delay, 1, NULL);
}
void CSethyboyPubDlg::OnButton38()
{
KillTimer(delay);
{
SetTimer(delayoff, 1, NULL);
}
void CSethyboyPubDlg::OnButton39()
{
SetTimer(vecgps, 1, NULL);
}
void CSethyboyPubDlg::OnButton40()
{
KillTimer(vecgps);
}
void CSethyboyPubDlg::OnButton41()
{
SetTimer(minigps, 1, NULL);
}
void CSethyboyPubDlg::OnButton42()
{
KillTimer(minigps);
{
SetTimer(minigpsoff, 1, NULL);
}
void CSethyboyPubDlg::OnButton43()
{
SetTimer(xhair, 1, NULL);
}
void CSethyboyPubDlg::OnButton44()
{
KillTimer(xhair);
}
void CSethyboyPubDlg::OnButton45()
{
SetTimer(prem, 1, NULL);
}
void CSethyboyPubDlg::OnButton46()
{
KillTimer(prem);
}
void CSethyboyPubDlg::OnButton47()
{
SetTimer(shotty, 1, NULL);
}
void CSethyboyPubDlg::OnButton48()
{
KillTimer(shotty);
}
void CSethyboyPubDlg::OnButton49()
{
SetTimer(m14, 1, NULL);
}
void CSethyboyPubDlg::OnButton50()
{
KillTimer(m14);
{
SetTimer(m14off, 1, NULL);
}
void CSethyboyPubDlg::OnButton51()
{
SetTimer(radar, 1, NULL);
}
void CSethyboyPubDlg::OnButton52()
{
KillTimer(radar);
{
SetTimer(radaroff, 1, NULL);
}
void CSethyboyPubDlg::OnButton54()
{
KillTimer(opk);
}
void CSethyboyPubDlg::OnButton55()
{
SetTimer(prone, 1, NULL);
}
void CSethyboyPubDlg::OnButton56()
{
KillTimer(prone);
}

Str8Soulja
03-29-2008, 10:52 PM
add me str8soilder@hotmail.com and ill fix your error

jammy122333
04-13-2008, 04:47 PM
urgh, not working :/ 4 errors,

My errors,


C:Documents and SettingsJamesDesktopL337PublicL337PublicDlg.cpp(21 5) : error C2653: 'CHiDlg' : is not a class or namespace name
C:Documents and SettingsJamesDesktopL337PublicL337PublicDlg.cpp(22 2) : error C2065: 'Writealong' : undeclared identifier
C:Documents and SettingsJamesDesktopL337PublicL337PublicDlg.cpp(23 3) : error C2248: 'OnTimer' : cannot access protected member declared in class 'CWnd'
c:program filesmicrosoft visual studiovc98mfcincludeafxwin.h(2365) : see declaration of 'OnTimer'
C:Documents and SettingsJamesDesktopL337PublicL337PublicDlg.cpp(23 3) : error C2352: 'CWnd::OnTimer' : illegal call of non-static member function
c:program filesmicrosoft visual studiovc98mfcincludeafxwin.h(2365) : see declaration of 'OnTimer'

My code,


void CHiDlg::OnTimer(UINT nIDEvent)
{
switch(nIDEvent)
{
case FIRSTTIMER:
{
//Hack for timer goes here,say stamina
Writealong (0x7fb344,115342553); //this is not a real address
}
break; // end of a case

case SECONDTIMER:
{
//Hack for timer goes here,say stamina
Writealong (0x7fb344,115342553); //this is not a real address

}
break;
}
CDialog::OnTimer(nIDEvent);
}


void CL337PublicDlg::OnInstantSpawnOn()
{
SetTimer(FIRSTTIMER, 1, NULL);
}

void CL337PublicDlg::OnFastSpawnOff()
{
KillTimer(FIRSTTIMER);
}

void CL337PublicDlg::OnStaminaOn()
{
SetTimer(SECONDTIMER, 1, NULL);
}

void CL337PublicDlg::OnStaminaOff()
{
KillTimer(SECONDTIMER);
}

Thanks, - Jammy

btw i know the timers have the same fake code but i can easily change that when i solve the errors..

Keiven12
03-01-2009, 01:37 AM
hey i tryed this tut out on how to make it work with stamina and i got these 3 errors
error C2065: 'FIRSTTIMER' : undeclared identifier
error C2051: case expression not constant
error C2065: 'Writealong' : undeclared identifier
warning C4060: switch statement contains no 'case' or 'default' labels
can somone please tell me what to do and how do i fix the errors and warning :mad:

-=ProUser=-
12-04-2009, 08:58 AM
dxt-cobra, you are using C++ 6 right?

rjghetto15
01-13-2010, 02:25 AM
weak ka gagu

SEQT1290
01-13-2010, 04:20 AM
Thanks Dxt-cobra, im just starting out on C++ but ima sure it will come in handy =)