DllCall Pointer? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Cuadrix
Posts: 236
Joined: 07 May 2017, 08:26

DllCall Pointer?

20 May 2019, 04:10

From MSDN Docs:

Code: Select all

LONG ChangeDisplaySettingsExA(
  LPCSTR   lpszDeviceName,
  DEVMODEA *lpDevMode,
  HWND     hwnd,
  DWORD    dwflags,
  LPVOID   lParam
);
If I were to make a DllCall to this function, what should I do about the asterisk * in the above?
Should I just ignore it, and do this?;

Code: Select all

Var := DllCall("ChangeDisplaySettingsExA", "Ptr", arg1, "Ptr", arg2, "Ptr", arg3, "UInt", arg4, "Ptr", arg5)
Or what? An explanation from anyone who knows would be nice. :?:
just me
Posts: 9574
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: DllCall Pointer?  Topic is solved

20 May 2019, 05:02

Code: Select all

/*
LONG ChangeDisplaySettingsExA(
  LPCSTR   lpszDeviceName,		; Str or Ptr
  DEVMODEA *lpDevMode,			; Ptr
  HWND     hwnd,				; Ptr, always 0
  DWORD    dwflags,				; UInt
  LPVOID   lParam				; Ptr
);
*/
DeviceName := "DeviceName"
Flags := 0
Param := 0
SizeOfDevMode := ???
VarSetCapacity(DevMode, SizeOfDevMode, 0)
NumPut(SizeOfDevMode, DevMode, 36, "UShort") ; ANSI: 32 + 4
Result := DllCall("ChangeDisplaySettingsExA", "Str", DeviceName , "Ptr", &DevMode, "Ptr", 0, "UInt", Flags, "Ptr", Param, "Int") ; for AHK ANSI only
*not tested*

I'm pretty sure you'll find examples on the forums.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Draken, Google [Bot], oktavimark and 377 guests