Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

CallBack - RegisterCallback function


  • This topic is locked This topic is locked
32 replies to this topic

#21 Uten

Uten

    stupid is as stupid does..

  • Active Members
  • PipPipPipPipPipPip
  • 1,989 posts

Posted 11 July 2007 - 12:08 PM

Looking forward to check out the latest.
Maybe it's time to create a topic in scripts (if you have not done so already). I find it easier to find stuff there than here (or in one place if you like..:whistle: ).







#22 tonedeaf

tonedeaf

    Prodigy

  • Active Members
  • PipPipPip
  • 152 posts

Posted 18 March 2008 - 09:07 PM

I see that DllCallBackRegister() function has now been added to AutoIt. But it is not supporting all the options in the original DllCallBack.au3 UDF.
According to UDF the _DllCallBack function parameters are:
Parameter(s):       $sFunction - Name of callback function ;                   $sParameters - DllStruct like parameter definition (only 32 and 64bit datatypes supported) ;                   $nOptions, Optional - Can be one or more (add them together) of the folowing constants: ;                       $_DllCallBack_StdCall (0)  - Use 'stdcall' calling method (Default) ;                       $_DllCallBack_Cdecl (1) - Use 'cdecl' calling method ;                       $_DllCallBack_Sync (2)   - Enable Critical Section (see Remarks) ;                      $_DllCallBack_Subclass (4) - Enable Subclassing (see Remarks) ;                       $_DllCallBack_Struct (8)   - Pass the struct to the handler function (see Remarks) ;                       $_DllCallBack_Debug (1024) - Enable breakpoint (requires a JIT debugger)

The $nOptions parameter has been removed from the AutoIt integrated function DllCallBackRegister().
I cannot now, for example, enable subclassing using the AutoIt DllCallBackRegister function.

I can still use the UDF, but why not include the full functionality if integrating the function in the first place?

Edited by tonedeaf, 18 March 2008 - 09:08 PM.


#23 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,686 posts

Posted 18 March 2008 - 09:26 PM

@tonedaf

Here is link to UDF from piccaso: link

It would be better to post that there or in new BugTrac maybe.
Unfortunatelly original UDF thread is locked so maybe send PM to moderators if they can unlock it.

#24 Valik

Valik

    Former developer.

  • Active Members
  • PipPipPipPipPipPip
  • 18,879 posts

Posted 18 March 2008 - 10:08 PM

The mistake you're making is assuming the the built in function is based on the UDF. Nothing was "removed". Nothing was "integrated". The function was added and has nothing to do with the existence of a similar UDF.

#25 tonedeaf

tonedeaf

    Prodigy

  • Active Members
  • PipPipPip
  • 152 posts

Posted 19 March 2008 - 10:45 AM

The function was added and has nothing to do with the existence of a similar UDF.

The AutoIt function was added as per picasso's recommendation in this post with the proposed function names: DllCallBackRegister(), DllCallBackGetPtr(), DllCallBackFree() (otherwise must be a one hell of a coincidence that the built-in names matched exactly with the UDF proposed functions)
Picasso introduced this functionality and Jon proposed including it in AutoIt. The built-in functions implement the recommended function signature, and includes the asm code used in the UDF.

The real point of my post is that the original DllCallBack() accepted a useful parameter $nOptions for specifying subclassing, multithreaded calls syn, breakpoints etc. which the built-in function dosen't. Is there any reason why this parameter is skipped?

Or, the other alternative is to use the built-in function, identify the parts of the UDF implementing the Subclassing which is:
If BitAND($_DllCallBack_Subclass, $nOptions) Then; Subclassing         $sStub &= "83F800"; cmp eax,0         $sStub &= "74" & "1C"; je 0x1c - if eax == 0 jump down 0x1c opcodes (to return)         $sStub &= "8B5424" & "10" & "52"; mov edx,dword ptr ss:esp+10; push edx - lparam         $sStub &= "8B5424" & "10" & "52"; mov edx,dword ptr ss:esp+10; push edx - wparam         $sStub &= "8B5424" & "10" & "52"; mov edx,dword ptr ss:esp+10; push edx - msg         $sStub &= "8B5424" & "10" & "52"; mov edx,dword ptr ss:esp+10; push edx - hwnd         $sStub &= "50"; push eax - lpPrevWndFunc         $sStub &= "B8" & __DllCallBack_Endian($gp_DllCallBack_CallWindowProc); Set eax to CallWindowProc         $sStub &= "FFD0"; call eax     EndIf

allocate memory, and execute the code. Unfortunately, I don't have the privilege of understanding code to such fathomless levels, so I would rather just use the UDF.

Edited by tonedeaf, 19 March 2008 - 11:33 AM.


#26 Jon

Jon

    Up all night to get lucky

  • Administrators
  • 10,470 posts

Posted 19 March 2008 - 11:21 AM

The AutoIt function was added as per picasso's recommendation in this post with the proposed function names: DllCallBackRegister(), DllCallBackGetPtr(), DllCallBackFree().

The built-in functions were obviously added based on the UDF. Picasso introduced this functionality and Jon proposed including it in AutoIt. The built-in functions implement the recommended function names and signature, and includes the asm code used in the UDF.

The real point of my post is that the original DllCallBack() accepted another parameter for specifying $nOptions which the built-in function dosen't. Is there any reason why this parameter is skipped, as it looks quite useful.

The functions were implemented quite differently than the UDF code, for one thing we have to also support 64bit which was a project in itself :) I chose to implement the "pure" callback functionality without muddying the waters with window related functions like subclassing.

#27 tonedeaf

tonedeaf

    Prodigy

  • Active Members
  • PipPipPip
  • 152 posts

Posted 19 March 2008 - 02:09 PM

The functions were implemented quite differently than the UDF code, for one thing we have to also support 64bit which was a project in itself :) I chose to implement the "pure" callback functionality without muddying the waters with window related functions like subclassing.

Thanks for clarifying Jon. That's what I was looking for, a reason for the missing options.
I understand that AutoIt core now needs to support both platforms, and some options may not be compatible.

#28 Siao

Siao

    RTFM, foo!

  • Active Members
  • PipPipPipPipPipPip
  • 937 posts

Posted 19 March 2008 - 03:02 PM

Subclassing with DllCallBackRegister() can be done just fine.
"be smart, drink your wine"

#29 Valik

Valik

    Former developer.

  • Active Members
  • PipPipPipPipPipPip
  • 18,879 posts

Posted 19 March 2008 - 03:40 PM

The AutoIt function was added as per picasso's recommendation in this post with the proposed function names: DllCallBackRegister(), DllCallBackGetPtr(), DllCallBackFree() (otherwise must be a one hell of a coincidence that the built-in names matched exactly with the UDF proposed functions)

picasso isn't stupid. He's been around long enough to know our naming conventions.

Picasso introduced this functionality and Jon proposed including it in AutoIt.

Other than being the spark that got Jon motivated, I think picasso had very little to do with it. As far as I know, the design Jon used is based off my ideas I outlined before picasso ever wrote the UDFs. There were a couple discussions between Jon and myself about various points and then Jon went off and wrote something.

The built-in functions implement the recommended function signature, and includes the asm code used in the UDF.

How do you know it uses the ASM code? Knowing Jon, I would virtually guarantee it doesn't, although to be fair, there is going to be some similarity in a few lines as the basic premise is always going to do essentially the same thing to a certain degree.

The real point of my post is that the original DllCallBack() accepted a useful parameter $nOptions for specifying subclassing, multithreaded calls syn, breakpoints etc. which the built-in function dosen't. Is there any reason why this parameter is skipped?

This is the part I finding irritating. I told you why, yet you choose not to believe me, at least, not until Jon comes along and says essentially the same thing. Both of us are saying the function is not based off the UDF yet you only believe him and not me - why?

#30 tonedeaf

tonedeaf

    Prodigy

  • Active Members
  • PipPipPip
  • 152 posts

Posted 19 March 2008 - 06:31 PM

This is the part I finding irritating. I told you why, yet you choose not to believe me, at least, not until Jon comes along and says essentially the same thing. Both of us are saying the function is not based off the UDF yet you only believe him and not me - why?

I believed Jon because he provided a valid reason. What you communicated was your perception that the question is somehow not valid enough to warrant an answer.
Simply put Jon answered the question, you didn't. That's why I believed him.

#31 Jon

Jon

    Up all night to get lucky

  • Administrators
  • 10,470 posts

Posted 19 March 2008 - 06:49 PM

How do you know it uses the ASM code? Knowing Jon, I would virtually guarantee it doesn't

Me reinvent something for the sake of it? Doesn't sound like me...

:)

#32 Valik

Valik

    Former developer.

  • Active Members
  • PipPipPipPipPipPip
  • 18,879 posts

Posted 19 March 2008 - 07:06 PM

I believed Jon because he provided a valid reason. What you communicated was your perception that the question is somehow not valid enough to warrant an answer.
Simply put Jon answered the question, you didn't. That's why I believed him.

You're asking why two things developed independently don't do the same thing, I told you, because they were developed independently. That's not so hard to understand unless you're a complete dumbass.

#33 Jon

Jon

    Up all night to get lucky

  • Administrators
  • 10,470 posts

Posted 19 March 2008 - 07:44 PM

*click*




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users