Recent

Author Topic: How to assign a value to a pointer?  (Read 3354 times)

dkjMusic

  • Full Member
  • ***
  • Posts: 146
How to assign a value to a pointer?
« on: May 17, 2014, 02:18:53 am »
I retrieved the following in a Google-search re setting mouse speed:
==================================================
I had the same problem. What M$ thought when they cooked this up is a complete mystery to me. Anyway, the solution:

DWORD iNewSpeed; /* between 0 and 20 */

SystemParametersInfo(SPI_SETMOUSESPEED,0,(void*)iNewSpeed, NULL);

Note the cast to a pointer.. you do not pass a pointer to the variable
(which seems more logical) but you pass the value directly, disguised as a pointer.
==================================================
My question is how do I implement (void*)iNewSpeed in Free Pascal?
Windows 7 Ultimate/32 bit;
Lazarus 0.9.31/Rev 33300;
FPC 2.7.1/Rev 19464;
GDB 7.0.50;
(via CodeTyphon 2.30)

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: How to assign a value to a pointer?
« Reply #1 on: May 17, 2014, 02:58:01 am »
it is a simple cast, pointer(inewvalue).
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

dkjMusic

  • Full Member
  • ***
  • Posts: 146
Re: How to assign a value to a pointer?
« Reply #2 on: May 17, 2014, 03:38:00 am »
That worked. Many thanks.
Windows 7 Ultimate/32 bit;
Lazarus 0.9.31/Rev 33300;
FPC 2.7.1/Rev 19464;
GDB 7.0.50;
(via CodeTyphon 2.30)

 

TinyPortal © 2005-2018