Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

v1.0.46 released: SubStr() and more expression operators


  • Please log in to reply
63 replies to this topic
majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006

For the next release, JGR has written the code to support built-in callbacks. I also hope to work on the mechanism for the standard library and a built-in Extract/InsertInteger.

OMFG :shock:
What happend to you Chris... :D
Posted Image

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
Yes, it makes sense, I came up with this hypothetical code:
pfn := CallBack("EnumerateWindows", "UInt", "UInt", "Int")	; hWnd, lParam, returns BOOL
DllCall("EnumWindows", "FunP", pfn, "UInt", 0)	; lParam

EnumerateWindows(_hWnd, _lParam)
{
	global winList
	
	winList .= _hWnd . "|"

	Return 1 ; Continue enumeration
}

I think the last parameter must be the return type, in some special DLLs it can be something other than 0/1 or true/false.

What happend to you Chris... :D

He was too bugged by a blue/violet monster...
Or more realistically, he got usable code! :-)
Great news, all this is eagerly expected since a long time.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

For the next release, JGR has written the code to support built-in callbacks.


:O :D

I also hope to work on the mechanism for the standard library and a built-in Extract/InsertInteger.


:D

I wish it would be like Laszlo's Encode, Decode binary numbers

Thanks :)

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
The interface is actually planned to be simpler than that:

; In the below, 2 is the number of parameters and MyExtra is any integer to be passed to the callback as the first parameter. MyExtra allows a given function to be used by more than one type of callback, which is a a flexiblity that's thought to worth seeing an extra parameter in the first position all the time:
EnumWindowsProcStub:=RegisterCallback("EnumWindowsProc", 2, [color=darkred]MyExtra[/color])
...
DllCall("EnumWindows","UInt",EnumWindowsProcStub,"UInt",0)
EnumWindowsProc([color=darkred]extra[/color], winid, otherparam)
{
   ...
   return 1
}
The code is very small; there is no string support like DllCall. Since there is no declaring of parameters or types (just the parameter count), it is up to the script to do any necessary conversions or type-casting (though that is unnecessary in most cases).

I think the last parameter must be the return type, in some special DLLs it can be something other than 0/1 or true/false.

There is currently no ability to customize it, so perhaps the hard-coded support for a 32-bit return value is suitable for 99.9% of callbacks found in nature. I'll ask JGR.