Announcement

Collapse
No announcement yet.

Call Dword Macro Replacement

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Nathan Maddox
    replied
    maybe...

    Are you asking if there is an SDK call to give you the number of parameters in a function?

    Maybe if the functions were registered in the Registry a registry field could tell you the number of paramers per function....

    Otherwise, ... make all the parameters OPTIONAL and...

    Code:
    Function HowManyParameters(OPT A As Long, OPT B As LONG, OPT C as Long) As Long
             Local HowMany As Long
    
             IF VarPtr(A)<>0 Then Incr HowMany
             IF VarPtr(B)<>0 Then Incr HowMany
             IF VarPtr(C)<>0 Then Incr HowMany
             Function = HowMany
    End Function

    Leave a comment:


  • Michael Mattias
    replied
    The only way your code can "know" how many parameters any procedure requires/uses is by getting that info from the current module's source code, parsing either the procedure header or the DECLARE statement for that procedure.

    If you are looking for a cool way to consolidate all calls your 'wrapper' function could be something like...
    Code:
    FUNCTION DoCallDword (nParam AS LONG, OPTIONAL  param1 AS something, _ 
    param2 AS something,  param3 AS something, ... paramN AS something) AS something
    .. but even that has a long way to go before it would be useable.

    MCM

    Leave a comment:


  • Cliff Nichols
    started a topic Call Dword Macro Replacement

    Call Dword Macro Replacement

    As many of you know for over a year (maybe pressing on 2) I have been attempting to track down "Bugs" (Or more likely "Mistakes in my programming")

    Now this is a VERY Hard thing to ask seeing how I know what I want to do, but not sure how to phrase it, but basically its a more in depth "CallStk$" replacement

    Lets say I call 3 different API functions
    Code:
         
    DECLARE FUNCTION GetLastError ALIAS "GetLastError" () AS LONG
    DECLARE FUNCTION GetWindow ALIAS "GetWindow" (BYVAL hWnd AS DWORD, BYVAL wCmd AS DWORD) AS LONG
    DECLARE FUNCTION AddAtom ALIAS "AddAtomA" (lpString AS ASCIIZ) AS WORD
    in each of these, I know the parameters in their own functions and how many parameters (aka GetLastError has none, GetWindow has 2, AddAtom has 1)

    But what I am wondering is if there is a way to macro or function to determine how many parameters? or if I am stuck with many lines of code within the function to sort it out?

    Like I said, unsure how to ask it, but maybe the example shows what I am after????
Working...
X