Results 1 to 2 of 2

Thread: [VB6] Friend Callback Procedures

  1. #1

    Thread Starter
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Arrow [VB6] Friend Callback Procedures

    The attached project below demonstrates how to set up Friend procedures inside object modules (FRM, CLS, CTL, etc.) for Windows API callback purposes. The goal of such a technique is to keep as much code as possible within the object module in order to make it as self-contained as possible and also to reduce memory consumption once the object module is unloaded. There is a possibly significant disadvantage to this approach however - the overhead of redirecting calls to procedures in an object module naturally imposes some performance penalty.

    (This code has been inspired by the following post: Re: Problem with Public UDT: 'Only public user defined types......)
    Attached Files Attached Files
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  2. #2

    Thread Starter
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: [VB6] Friend Callback Procedures

    The updated demo project below reorganizes most of the code and also now includes a Hook callback function inside the Class module.
    Attached Files Attached Files
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width