loki1982 Posted August 13, 2008 Share Posted August 13, 2008 I am just starting to get into using .dll files and need a little direction. I started looking at the _ispressed function to try to learn how to use a dll Ok I started looking at misc.au3 and found the function _ispressed. It makes a dllcall to user32.dll. I downloaded a .dll function viewer so that I could see all the available functions. I follow the code and see that the function used is getasynckeystate function. So far Im following it but then this is where I get confused. How do I know how to use the function? Is there a guide, or a program that shows me how to use the dll function? Or am I totally confused on what I am supposed to be doing? For example if I want to use the function getactivewindow is user32.dll where would I begin? Link to comment Share on other sites More sharing options...
cppman Posted August 13, 2008 Share Posted August 13, 2008 (edited) I am just starting to get into using .dll files and need a little direction. I started looking at the _ispressed function to try to learn how to use a dll Ok I started looking at misc.au3 and found the function _ispressed. It makes a dllcall to user32.dll. I downloaded a .dll function viewer so that I could see all the available functions. I follow the code and see that the function used is getasynckeystate function. So far Im following it but then this is where I get confused. How do I know how to use the function? Is there a guide, or a program that shows me how to use the dll function? Or am I totally confused on what I am supposed to be doing? For example if I want to use the function getactivewindow is user32.dll where would I begin?You need to lookup the reference to the function you are trying to call (whether it be a DLL from the Windows API or some other library). Here's a link to the documentation on the function you are trying to call: http://msdn.microsoft.com/en-us/library/ms646292(VS.85).aspx Func _GetActiveWindow() $nRet = DllCall("user32.dll", "HWND", "GetActiveWindow") return $nRet[0] EndFunc $hWnd = GUICreate("test", 640, 480) GUISetState() if ($hWnd == _GetActiveWindow()) Then MsgBox(0, "", "Hey, my main window is on top. Sweet.") EndIf Edited August 13, 2008 by cppman Miva OS Project Link to comment Share on other sites More sharing options...
loki1982 Posted August 13, 2008 Author Share Posted August 13, 2008 You need to lookup the reference to the function you are trying to call (whether it be a DLL from the Windows API or some other library). Here's a link to the documentation on the function you are trying to call: http://msdn.microsoft.com/en-us/library/ms646292(VS.85).aspx Func _GetActiveWindow() $nRet = DllCall("user32.dll", "HWND", "GetActiveWindow") return $nRet[0] EndFunc $hWnd = GUICreate("test", 640, 480) GUISetState() if ($hWnd == _GetActiveWindow()) Then MsgBox(0, "", "Hey, my main window is on top. Sweet.") EndIf Thanks. You helped me a bunch. I think I can get it figured out now. the msdn site is what I needed. Really appreciate it. Link to comment Share on other sites More sharing options...
TehWhale Posted August 13, 2008 Share Posted August 13, 2008 Thanks. You helped me a bunch. I think I can get it figured out now. the msdn site is what I needed. Really appreciate it.To get the active window you can also use: WinGetTitle("") Link to comment Share on other sites More sharing options...
loki1982 Posted August 13, 2008 Author Share Posted August 13, 2008 To get the active window you can also use: WinGetTitle("") Yeah I was just using that function as an example. I know there is a mouse move function already but I wanted to try to make my own dll call as a test so I did the following Func _MS($x,$y) $test = dllcall("user32.dll","int","SetCursorPos","int",$x,"int",$y) return $test _MS(200,200) and it worked. Im so excited, feel like I have a whole new set of command to test out now ; ) Link to comment Share on other sites More sharing options...
cppman Posted August 13, 2008 Share Posted August 13, 2008 Yeah I was just using that function as an example. I know there is a mouse move function already but I wanted to try to make my own dll call as a test so I did the following Func _MS($x,$y) $test = dllcall("user32.dll","int","SetCursorPos","int",$x,"int",$y) return $test _MS(200,200) and it worked. Im so excited, feel like I have a whole new set of command to test out now ; )Yeah, but it gets boring pretty quickly. Miva OS Project 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