magician13134 Posted May 29, 2007 Share Posted May 29, 2007 How do you know the functions inside of a DLL? IS there a program to view them like the COM/OLE viewer? Like in this: DllCall("user32.dll", "int", "ShowCursor", "int", 0) This hides the cursor. Now I know CyberSlug is a genius, but he didn't just guess that "ShowCursor" was in user32. How do you find these? Thanks! Visit Magic Soft Inc. for some of my software Link to comment Share on other sites More sharing options...
The Kandie Man Posted May 29, 2007 Share Posted May 29, 2007 (edited) Looking at the windows header files for declared functions is one way. Another way is to go on MSDN and simply look at the win32api.Win32API:http://msdn.microsoft.com/library/default....i_reference.aspShowCursor function:http://msdn2.microsoft.com/en-us/library/ms648396.aspx- The Kandie Man ;-) Edited May 29, 2007 by The Kandie Man "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
xcal Posted May 30, 2007 Share Posted May 30, 2007 This is a handy app, too: DLL Explorer Viewer How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
magician13134 Posted May 30, 2007 Author Share Posted May 30, 2007 Thanks both of you! Visit Magic Soft Inc. for some of my software Link to comment Share on other sites More sharing options...
magician13134 Posted May 31, 2007 Author Share Posted May 31, 2007 (edited) Ok... well... I'm having trouble figuring out how to use them... For instance I found one in user32.dll called GetCursorPos, and I know this is like MouseGetPos(), but how would I actually use the dll? can someone give me an example? Edited May 31, 2007 by magician13134 Visit Magic Soft Inc. for some of my software Link to comment Share on other sites More sharing options...
PaulIA Posted May 31, 2007 Share Posted May 31, 2007 Ok... well... I'm having trouble figuring out how to use them... For instance I found one in user32.dll called GetCursorPos, and I know this is like MouseGetPos(), but how would I actually use the dll? can someone give me an example?$tPoint = DllStructCreate("int X; int Y") DllCall("User32.dll", "int", "GetCursorPos", "ptr", DllStructGetPtr($tPoint)) ConsoleWrite("Cursor X position: " & DllStructGetData($tPoint, "X") & @CR) ConsoleWrite("Cursor Y position: " & DllStructGetData($tPoint, "Y") & @CR) Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
magician13134 Posted May 31, 2007 Author Share Posted May 31, 2007 $tPoint = DllStructCreate("int X; int Y") DllCall("User32.dll", "int", "GetCursorPos", "ptr", DllStructGetPtr($tPoint)) ConsoleWrite("Cursor X position: " & DllStructGetData($tPoint, "X") & @CR) ConsoleWrite("Cursor Y position: " & DllStructGetData($tPoint, "Y") & @CR) Hmmm.... I just get this no matter what: Cursor X position: 0 Cursor Y position: 0 Visit Magic Soft Inc. for some of my software Link to comment Share on other sites More sharing options...
PaulIA Posted May 31, 2007 Share Posted May 31, 2007 Hmmm.... I just get this no matter what:Cursor X position: 0Cursor Y position: 0Need latest version of AutoIt and make sure your mouse isn't in upper left hand corner of the screen. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
magician13134 Posted June 1, 2007 Author Share Posted June 1, 2007 I do and it's not... oh well, I found a couple other example on the forums Visit Magic Soft Inc. for some of my software Link to comment Share on other sites More sharing options...
PaulIA Posted June 1, 2007 Share Posted June 1, 2007 I do and it's not... oh well, I found a couple other example on the forumsIf you're not getting the right results from these 4 lines of code, one of the following is true:1. You don't have the latest production version of AutoIt2. You mangled the original script when you copied it3. You're mouse is in the upper left hand corner of your screen4. Some other really n00b thing that I haven't thought of yetYou pick. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
magician13134 Posted June 1, 2007 Author Share Posted June 1, 2007 If you're not getting the right results from these 4 lines of code, one of the following is true:1. You don't have the latest production version of AutoIt2. You mangled the original script when you copied it3. You're mouse is in the upper left hand corner of your screen4. Some other really n00b thing that I haven't thought of yetYou pick. Uhhhh... NUMBER 1! I PICK NUMBER 1! Ok... sorry about that. It works... now can someone explain why? What exactly it all does? Visit Magic Soft Inc. for some of my software Link to comment Share on other sites More sharing options...
PaulIA Posted June 1, 2007 Share Posted June 1, 2007 Uhhhh... NUMBER 1! I PICK NUMBER 1! Ok... sorry about that. It works... now can someone explain why? What exactly it all does?NP. The MSDN link for GetCursorPos looks like this: BOOL GetCursorPos(LPPOINT lpPoint);So we know that the function returns a BOOL value (which is just an integer), takes a pointer to a POINT structure as input and is defined in User32.dll. If you look on MSDN, a POINT structure looks like this: struct tagPOINT { LONG x; LONG y; } So, back to the code that I gave you: $tPoint = DllStructCreate("int X; int Y") DllCall("User32.dll", "int", "GetCursorPos", "ptr", DllStructGetPtr($tPoint)) ConsoleWrite("Cursor X position: " & DllStructGetData($tPoint, "X") & @CR) ConsoleWrite("Cursor Y position: " & DllStructGetData($tPoint, "Y") & @CR) So, after using DllStructCreate to build a POINT structure, we call DllCall with the following: 1. The Dll where GetCursorPos is defined (User32.dll) 2. The return type expected (BOOL = "int") 3. The name of the Dll function (GetCursorPos) 4. A pointer to our POINT structure When called, GetCursorPos get's the global cursor position and places it in our POINT structure, using the pointer that we passed. On return, we use DllStructGetData to extract the X and Y positions. Simple right? Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 1, 2007 Share Posted June 1, 2007 (edited) Uhhhh... NUMBER 1! I PICK NUMBER 1! Ok... sorry about that. It works... now can someone explain why? What exactly it all does? Not a DLL-type myself, but I'll take a shot at it for the educational value: $tPoint = DllStructCreate("int X; int Y") DllCall("User32.dll", "int", "GetCursorPos", "ptr", DllStructGetPtr($tPoint)) ConsoleWrite("Cursor X position: " & DllStructGetData($tPoint, "X") & @CR) ConsoleWrite("Cursor Y position: " & DllStructGetData($tPoint, "Y") & @CR) First you reserve some space in memory for various values. This will be the "structure". It can contain lots of different type of values, but in this case simply reserves memory space for two integers to be called "X" and "Y". The pointer to their memory space is saved as $tPoint. Next you call the User32.dll and pass it parameters as specified by it's code (completely different from dll to dll). Of the parameters, the first is most confusing to me. Integer is obviously meant by "int", but what is that for, return code? The second parameter is easy. "GetCursorPos" is a pretty plain-language verb telling the .dll what to do. Third one seems to only tell what type the fourth is - it's a pointer ("ptr") to the memory structure we want the answer put in. And fourthly, the actual pointer that tells it where in memory to put our answer. The two lines after that that take advantage of the names given our structure elements "X" and "Y" to read out their values. I just expended everything I know about .dll's, and I know it aint much, but we can keep learning from there... Edit: PaulIA! Where's the fun in us dummies figuring it out if you smart people are just going to give away the answers like that! Edited June 1, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PaulIA Posted June 1, 2007 Share Posted June 1, 2007 Not a DLL-type myself, but I'll take a shot at it for the educational value: $tPoint = DllStructCreate("int X; int Y") DllCall("User32.dll", "int", "GetCursorPos", "ptr", DllStructGetPtr($tPoint)) ConsoleWrite("Cursor X position: " & DllStructGetData($tPoint, "X") & @CR) ConsoleWrite("Cursor Y position: " & DllStructGetData($tPoint, "Y") & @CR) First you reserve some space in memory for various values. This will be the "structure". It can contain lots of different type of values, but in this case simply reserves memory space for two integers to be called "X" and "Y". The pointer to their memory space is saved as $tPoint. Next you call the User32.dll and pass it parameters as specified by it's code (completely different from dll to dll). Of the parameters, the first is most confusing to me. Integer is obviously meant by "int", but what is that for, return code? The second parameter is easy. "GetCursorPos" is a pretty plain-language verb telling the .dll what to do. Third one seems to only tell what type the fourth is - it's a pointer ("ptr") to the memory structure we want the answer put in. And fourthly, the actual pointer that tells it where in memory to put our answer. The two lines after that that take advantage of the names given our structure elements "X" and "Y" to read out their values. I just expended everything I know about .dll's, and I know it aint much, but we can keep learning from there... Edit: PaulIA! Where's the fun in us dummies figuring it out if you smart people are just going to give away the answers like that! Dlls? Fun? What are YOU drinking (and where do I get some)? "GetCursorPos" a verb? Well, more like the name of a function inside the Dll itself. It's like calling a UDF in AutoIt. Each one has it's own name, return type and parameter list. When you use DllCall, it loads the Dll, finds the function entry point, calls the function with the parameters that you supply and then returns the results. Yes, Jon is a genius. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 1, 2007 Share Posted June 1, 2007 Dlls? Fun? What are YOU drinking (and where do I get some)? "GetCursorPos" a verb? Well, more like the name of a function inside the Dll itself. It's like calling a UDF in AutoIt. Each one has it's own name, return type and parameter list. When you use DllCall, it loads the Dll, finds the function entry point, calls the function with the parameters that you supply and then returns the results. Yes, Jon is a genius. Did the BOOL (= "int") return go anywhere? Or would that be captured by: $iRetCode = DllCall("User32.dll", "int", ...) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PaulIA Posted June 1, 2007 Share Posted June 1, 2007 Did the BOOL (= "int") return go anywhere? Or would that be captured by: $iRetCode = DllCall("User32.dll", "int", ...)oÝ÷ Ù¹bOêº^!ò0jÉ÷öÛ(¬ò#]«Þ¸µéâ·è¥êëzË¥µÈ^rH§«¢+ØÀÌØíÑA½¥¹Ðô±±MÑÉÕÑ ÉÑ ÅÕ½Ðí¥¹Ð`쥹ÐdÅÕ½Ðì¤(ÀÌØíIÍÕ±Ðô±± ±° ÅÕ½ÐíUÍÈÌȹ±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíÑ ÕÉͽÉA½ÌÅÕ½Ðì°ÅÕ½ÐíÁÑÈÅÕ½Ðì°±±MÑÉÕÑÑAÑÈ ÀÌØíÑA½¥¹Ð¤¤) ½¹Í½±]É¥Ñ ÅÕ½ÐíIÑÕɸÉÍձи¸¸èÅÕ½ÐìµÀìÀÌØíIÍÕ±ÑlÁtµÀì H¤) ½¹Í½±]É¥Ñ ÅÕ½Ðí ÕÉͽÈ`Á½Í¥Ñ¥½¸èÅÕ½ÐìµÀì±±MÑÉÕÑÑÑ ÀÌØíÑA½¥¹Ð°ÅÕ½Ðí`ÅÕ½Ð줵Àì H¤) ½¹Í½±]É¥Ñ ÅÕ½Ðí ÕÉͽÈdÁ½Í¥Ñ¥½¸èÅÕ½ÐìµÀì±±MÑÉÕÑÑÑ ÀÌØíÑA½¥¹Ð°ÅÕ½ÐídÅÕ½Ð줵Àì H¤ A 1 means it worked and a 0 means you did something really bad. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 1, 2007 Share Posted June 1, 2007 Thanks! I used 'ta couldn't spell DLL, now I own 'em. Thanks to PaulIA! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
magician13134 Posted June 10, 2007 Author Share Posted June 10, 2007 (edited) Hey, can I ask for help with one more issue? I want to user user32's GetWindowRect... any idea how? I've tried using the help file and searching the forums... this is what I've got, but it always returns 0, so I know it's wrong... $win = WinGetHandle("") $str = "int;ubyte;uint;char" $a = DllStructCreate($str) $dll = DllCall("user32.dll", DllStructGetPtr($a), "GetWindowRect", "hwnd", $win) MsgBox(0, "", $int) Edited June 10, 2007 by magician13134 Visit Magic Soft Inc. for some of my software Link to comment Share on other sites More sharing options...
PaulIA Posted June 10, 2007 Share Posted June 10, 2007 Hey, can I ask for help with one more issue? I want to user user32's GetWindowRect... any idea how? I've tried using the help file and searching the forums... this is what I've got, but it always returns 0, so I know it's wrong... $win = WinGetHandle("") $str = "int;ubyte;uint;char" $a = DllStructCreate($str) $dll = DllCall("user32.dll", DllStructGetPtr($a), "GetWindowRect", "hwnd", $win) MsgBox(0, "", $int)Defined in the A3LWinAPI.au3 module of Auto3Lib. Download a copy and save yourself a lot of grief. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
magician13134 Posted June 11, 2007 Author Share Posted June 11, 2007 I've tried that and it doesn't work. I get errors for 99% of them... I have the LATEST installed and I did everything just as it said... but it just doesn't work... (I'm talking about Auto3Lib) Visit Magic Soft Inc. for some of my software Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now