5 Replies - 1987 Views - Last Post: 02 August 2009 - 10:22 AM Rate Topic: -----

#1 gibson_junk   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 95
  • Joined: 24-July 09

cannot convert parameter 2...

Posted 02 August 2009 - 04:04 AM

I get this error
1>c:\users\*****\documents\visual studio 2008\projects\ko aio\files\main.cpp(83) : error C2664: 'UseHD' : cannot convert parameter 2 from 'long (__cdecl *)(void)' to 'long'
trying to use with this code.

int HDID			 = GetPrivateProfileInt("DP", "HDID", 0, "./Settings.ini");
int D_MinValue			 = GetPrivateProfileInt("DP", "D_MinValue", 0, "./Settings.ini");



void UseHD(DWORD HDID, long getCID)
		{
	 BYTE pPacket[] = {0x31, 0x03, 0, 0, 0, 0x00, 0, 0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
	 CopyBytes(pPacket + 2, HDID);
	 CopyBytes(pPacket + 6, getCID);
	 SendPacket(pPacket, sizeof(pPacket));
		}


if(!keyWasPressed)
						{
							cout << "\nPrevention Enabled" << endl;
							keyWasPressed = true;
								if (getCurrentD() > 0)
							{
								if (getCurrentD() <= D_MinValue)
								UseHD(HDID, getCID);

								}
						Sleep(400);



long getCID()
{
	return ReadLong(OffsetCID);
}



what am i doing wrong?

This post has been edited by gibson_junk: 02 August 2009 - 04:05 AM


Is This A Good Question/Topic? 0
  • +

Replies To: cannot convert parameter 2...

#2 deery5000   User is offline

  • D.I.C Lover

Reputation: 88
  • View blog
  • Posts: 1,097
  • Joined: 09-May 09

Re: cannot convert parameter 2...

Posted 02 August 2009 - 04:11 AM

hi mate, i cant tell from your code

can you post the line the compiler points you to?

void UseHD(DWORD HDID, long getCID)
//could it be that this function is expecting "long"



This
long getCID

and this are different
long getCID()

This first one is a long variable and not a fumction

maybe have a quick look at passing paramaters will solve your problems

Hope this helps
Kevin

This post has been edited by deery5000: 02 August 2009 - 04:16 AM

Was This Post Helpful? 0
  • +
  • -

#3 gibson_junk   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 95
  • Joined: 24-July 09

Re: cannot convert parameter 2...

Posted 02 August 2009 - 04:24 AM

View Postdeery5000, on 2 Aug, 2009 - 03:11 AM, said:

hi mate, i cant tell from your code

can you post the line the compiler points you to?

void UseHD(DWORD HDID, long getCID)
//could it be that this function is expecting "long"



This
long getCID

and this are different
long getCID()

This first one is a long variable and not a fumction

maybe have a quick look at passing paramaters will solve your problems

Hope this helps
Kevin


Pointes here

UseHD(HDID, getCID);



and if edit this part to this

void UseHD(DWORD HDID, long getCID())
		{
	 BYTE pPacket[] = {0x31, 0x03, 0, 0, 0, 0x00, 0, 0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
	 CopyBytes(pPacket + 2, HDID);
	 CopyBytes(pPacket + 6, getCID());
	 SendPacket(pPacket, sizeof(pPacket));
		}



i get a different error

1>c:\users\*****\documents\visual studio 2008\projects\ko aio\files\functions.h(225) : error C2102: '&' requires l-value
pointing here
	 CopyBytes(pPacket + 6, getCID());


This post has been edited by gibson_junk: 02 August 2009 - 04:58 AM

Was This Post Helpful? 0
  • +
  • -

#4 deery5000   User is offline

  • D.I.C Lover

Reputation: 88
  • View blog
  • Posts: 1,097
  • Joined: 09-May 09

Re: cannot convert parameter 2...

Posted 02 August 2009 - 08:15 AM

can you show me the code you use to pass the variables in your main

void UseHD(DWORD HDID, long getCID())
// this is incorrect



you call your function somewhere like so
UseHD(HDID, getCID);



what what are the values of these ?
are you reading in the same types ?

seems to me that getCID is just a name of a variable
and getCID is a function also and your getting a little mixed up.

Have you tried the debugger?
add break points and use f10 to stepover each line, allowing you to see the valuse of each variable

Hope this helps
Kevin

Im guessing you havnt written this code yourself :)

This post has been edited by deery5000: 02 August 2009 - 08:16 AM

Was This Post Helpful? 0
  • +
  • -

#5 Plus   User is offline

  • D.I.C Regular
  • member icon

Reputation: 41
  • View blog
  • Posts: 414
  • Joined: 24-November 08

Re: cannot convert parameter 2...

Posted 02 August 2009 - 08:57 AM

first error SOLUTION:

void UseHD(DWORD HDID, long(__cdecl *)(void) getCID)
{
	BYTE pPacket[] = {0x31, 0x03, 0, 0, 0, 0x00, 0, 0, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00};

	CopyBytes(pPacket + 2, HDID);
	CopyBytes(pPacket + 6, getCID);
	SendPacket(pPacket, sizeof(pPacket));
}



seconed error SOLUTION:

	TYPE x = CopyBytes(pPacket + 6, getCID());



IMPORTANT: CHANGE 'TYPE' TO THE TYPE OF THE VARIABLE RETURNED BY CopyBytes FUNCTION ...

hopefully it helps,
Was This Post Helpful? 0
  • +
  • -

#6 gibson_junk   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 95
  • Joined: 24-July 09

Re: cannot convert parameter 2...

Posted 02 August 2009 - 10:22 AM

View PostPlus, on 2 Aug, 2009 - 07:57 AM, said:

first error SOLUTION:

void UseHD(DWORD HDID, long(__cdecl *)(void) getCID)
{
	BYTE pPacket[] = {0x31, 0x03, 0, 0, 0, 0x00, 0, 0, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			  0x00, 0x00, 0x00, 0x00, 0x00};

	CopyBytes(pPacket + 2, HDID);
	CopyBytes(pPacket + 6, getCID);
	SendPacket(pPacket, sizeof(pPacket));
}



seconed error SOLUTION:

	TYPE x = CopyBytes(pPacket + 6, getCID());



IMPORTANT: CHANGE 'TYPE' TO THE TYPE OF THE VARIABLE RETURNED BY CopyBytes FUNCTION ...

hopefully it helps,


Not sure what to change type to.
I will send anyone my code if they figure they could fix it if they seen it all
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1