Jump to content

Callback


piccaso
 Share

Recommended Posts

I'm eagerly awaiting callbacks. I have several uses for them, and I'm tired of having to write shims in the meantime.

-S

(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]
Link to comment
Share on other sites

Well, a good example of an API that I'd like to use callbacks in is the ActiveWorlds SDK. It would be nice to write AW "bots" in AutoIt to cut development time. In particular, the API requires you to install event handlers for specific bot functions.

http://www.activeworlds.com/sdk/

You're welcome to attempt the feat yourself using your FreeBasic code. It doesn't solve the problem for me because I've already created a shim for it, and your code is really just another shim of sorts. If AutoIt, however, had inborn callback functionality, I wouldn't have to include any shims. That's what I'm looking for, ultimately.

By the way, loosely interpreted, a "shim" in programming parlance (particularly an API shim) is a library that converts one API into another. In the sense we're using here, a shim is code stuck between two APIs to bridge communication between them.

(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]
Link to comment
Share on other sites

  • 4 weeks later...

I tryed to write a dll that enables autoit to do callback's

...

Updated: 06.08.06

Other windows messages can be used to

Commented Example "EnumWindows"

function headers with DllCall Syntax in dll source

This looks really useful! Have you done any more with it? Further documentation, examples, etc?

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

Didnt test this with Shutdown only Logoff but...

This can be done without callback:

$WM_QUERYENDSESSION  = 0x11
$WM_ENDSESSION       = 0x16
$hWndDummy = GUICreate("")
$fTrigger = False

GUIRegisterMsg($WM_QUERYENDSESSION,"_Msg")
Func _Msg($hWndGUI, $MsgID, $WParam, $LParam)
    $fTrigger = True
    Return False
EndFunc

While 1
    If $fTrigger Then
        $fTrigger = False
        MsgBox(0,"Shutdown","No you dont!")
    EndIf
    Sleep(250)
WEnd
You code works good, but... shutdown hangs :P

How can I let shutdown go after doing something (MsgBox in our example)?

Link to comment
Share on other sites

  • 4 months later...

I tryed to write a dll that enables autoit to do callback's

Thx for solution, but I'v some problems - AutoIT crashes during Shell API CallBack functions call... This problem fixing by tow steps: declaring MyCallBack function as STDCALL (instead of CDECL) and decreasing count of parameters to actual...

Any ideas?.. May be in addition compile separate function for every count of parameters?.. For example: CallBack01, CallBack02, etc...

Edited by amel27
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...