Jump to content

DllCall Q


Smed
 Share

Recommended Posts

I finally have a real question.

Since the "ptr" type exists for DllCall parameters, I'm guessing that it actually works. The help file shows only very basic examples of calls, a search on the forum produced a lot of "thats not quite what I'm looking for" results.

I'm trying to call a DLL function that returns results in a buffer specified by the 3rd parameter. The results returned in the array by DllCall appears to be useless in this instance.

Can someone point me towards an example on how to do this?

Before someone says, "post your code", I'd like to point out that I'm not asking YOU to fix MY code, I'm asking for help on how to fix it myself. I'll post the code if and when I deem it usefull.

601DisengageEnd Program

Link to comment
Share on other sites

I don't 100% understand what you're asking. If you posted an example it'd help me understand how to help you.

I think ptr can sometimes be int, though.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

buffer sounds like a "str" to me... try it

<{POST_SNAPBACK}>

already tried that I just get the same string back.

OK, here's the code, in its current incarnation.... sigh.

$MAC = _GetMACFromIP ("192.168.1.1")
MsgBox (0, "MAC Value", $MAC)
;MsgBox (0, "MAC Value", $MAC[0]&"-"&$MAC[1]&"-"&$MAC[2]&"-"&$MAC[3]&"-"&$MAC[4])

Func _GetMACFromIP ($sIP)

  $bMAC = "hhhhhh"
  $r = DllCall ("Ws2_32.dll", "int", "inet_addr", "str", $sIP)
  $iIP = $r[0]
  $r = DllCall ("iphlpapi.dll", "int", "SendARP", "int", $iIP, "int", 0, "str", $bMAC, "int", 6)
  Return $bMAC
EndFunc

I've tried arrays, strings, you name it, and I only get bs results.

leave it to me to try something goofy for my first attempt at DllCall code. :)

Edited by Smed

601DisengageEnd Program

Link to comment
Share on other sites

wont the mac be in $r[3]

hmm that didnt work...

<{POST_SNAPBACK}>

Yeh, I figured that you'd be interested in that function, but I had hoped to get it working before I started posting code.

601DisengageEnd Program

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...