cheeseslice Posted October 5, 2007 Share Posted October 5, 2007 hi, I have only really started using autoit properly over the past week or so, I am learning it quickly enough but I was hoping that someone could either give me a quick crash course in dll's or point me towards a tutotial. The dll I want to use is the user32.dll (http://msdn2.microsoft.com/en-us/library/ms633532.aspx) The problem is I don't know how to put the information from msdn into the dllcall function. I have been messing about with a test script just to try and lock the window but I'm not getting anywhere with it. From the msdn am I right in thinking that the return value will be: int and the type will be: str. Paramater will be LSFW_LOCK ? I really like to understand this. #include <GUIConstants.au3> $testWindow=guiCreate("test",200,200,200,200) GUISetState(@SW_SHOW,$testWindow) while 1 $guiMsg = GUIGetMsg() Switch $guiMsg case $GUI_EVENT_CLOSE Exit EndSwitch WEnd DllCall("user32.dll","int","uLockCode","str", "LSFW_LOCK") Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 5, 2007 Moderators Share Posted October 5, 2007 Func _LockSetFGWin($nLock = 0) Local Const $LSFW_LOCK = 1 Local Const $LSFW_ULOCK = 2 If $nLock Then $nLock = $LSFW_LOCK Else $nLock = $LSFW_ULOCK EndIf Local $aDLLLock = DllCall("USER32.DLL", "int", "LockSetForegroundWindow", "uint", $nLock) If IsArray($aDLLLock) And $aDLLLock[0] > 0 Then Return 1 Return SetError(1, 0, 0) EndFunc[ Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
cheeseslice Posted October 5, 2007 Author Share Posted October 5, 2007 Func _LockSetFGWin($nLock = 0) Local Const $LSFW_LOCK = 1 Local Const $LSFW_ULOCK = 2 If $nLock Then $nLock = $LSFW_LOCK Else $nLock = $LSFW_ULOCK EndIf Local $aDLLLock = DllCall("USER32.DLL", "int", "LockSetForegroundWindow", "uint", $nLock) If IsArray($aDLLLock) And $aDLLLock[0] > 0 Then Return 1 Return SetError(1, 0, 0) EndFunc[ sorry to be a nusance but could you explain this to me. I can't get it to work for the test window I'm trying it on. thanks for replying so quickly Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 5, 2007 Moderators Share Posted October 5, 2007 sorry to be a nusance but could you explain this to me. I can't get it to work for the test window I'm trying it on.thanks for replying so quicklyWhat test window? It disables or enables the ability of being able to set a foreground window._LockSetFGWin(1) To Disable_LockSetFGWin() To Enable Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Zedna Posted October 5, 2007 Share Posted October 5, 2007 Look here for informations/examples about DllCall Resources UDF  ResourcesEx UDF  AutoIt Forum Search Link to comment Share on other sites More sharing options...
cheeseslice Posted October 5, 2007 Author Share Posted October 5, 2007 (edited) What test window? It disables or enables the ability of being able to set a foreground window._LockSetFGWin(1) To Disable_LockSetFGWin() To Enablewhat i want to do is set my gui as the active window and then lock it so that nothing else can affect it. I'm currently using a loop something like:while 1if winexists("mygui") = 1 and winexists("my messsagebox") = 0 thenif winnotactive("mygui") then winactive("mygui")winsetontop("mygui","",1)endifelse if winexists("mygui") =1 and winexists("my messagebox") = 1 thenwinsetontop("mygui","",0)if winnotactive ("my messagebox") then winactive("my messagebox")winsetontop("my messagebox")endifendifwend(there are probably a few mistakes in there, i just did that to give you an idea of what i'm trying to do) winsetontop is causing a few problems becuase it keeps the gui window on top of message boxes that i need the user to interact with even when i change the winsetontop flags.i was reading a few posts and using this dll to lock the window is supposed to do exactly what i am looking for. Edited October 5, 2007 by cheeseslice Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 5, 2007 Moderators Share Posted October 5, 2007 i was reading a few posts and using this dll to lock the window is supposed to do exactly what i am looking for.That's what I don't understand... you are not "locking" this window... you are "locking" them all so to speak. There is no parameter for you to send the handle of a specific window for this function.You might be better off using the dllcall for your message box and just send the hwnd of your GUI to the message box that way (so it has the same on top style). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
cheeseslice Posted October 5, 2007 Author Share Posted October 5, 2007 That's what I don't understand... you are not "locking" this window... you are "locking" them all so to speak. There is no parameter for you to send the handle of a specific window for this function.You might be better off using the dllcall for your message box and just send the hwnd of your GUI to the message box that way (so it has the same on top style).i knew it was too good to be true!!! i'll have a go at what you suggested. my loop isn't working at the minute so i'll have to work that out again now.thanks for the help 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