VelvetElvis Posted September 20, 2010 Share Posted September 20, 2010 Is AdlibUnregister automatically called or assumed on appiication exit? My script uses AdlibRegister to call a routine that determines if the app has run longer than n minutes and kills it if necessary. Is it necessary to explicitly call AdlibUnregister before terminating the app? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted September 20, 2010 Share Posted September 20, 2010 I don't understand what you mean. If the process isn't running then how is it supposed to do anything? You mind writing the question another way? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
VelvetElvis Posted September 20, 2010 Author Share Posted September 20, 2010 I don't understand what you mean. If the process isn't running then how is it supposed to do anything? You mind writing the question another way?Sorry if I wasn't clear. Let me try again.I used AdlibRegister at the beginning of my app. The function it points to checks every 60 seconds to see how long the app has been running. If it's been running more than a specified number of minutes, then the function kills the app.Must I use AdlibUNregister before I exit my application, to unregister this function? Sorry if that isn't clear enough. I'm concerned about invoking some Windows routine that remains active after my scrip terminates, which of course I don't want to do.Hope that explains it a bit better. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted September 20, 2010 Share Posted September 20, 2010 (edited) Oh right. Windows actually cleans up pretty much all the handles and stuff that belongs to a process, so even if AdlibRegister uses some timer or something (hard to say as the source isn't available) Windows would do it for you. So you can do as you want here. If you're a person that likes things to be tidy then add it. It's just 1 line anyway. If you want to go to bed 5 seconds earlier today, () then skip it! As a guideline: If you should "clean up" after yourself, it's noted so in the helpfile. Edit: Or that is my opinion anyway, I have only been here 1 year more that you What has you been doing these 2 years? Edited September 20, 2010 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
wakillon Posted September 20, 2010 Share Posted September 20, 2010 As you can see in the helpfileExampleAdlibRegister("MyAdlib");...ExitFunc MyAdlib() ;... execution must be non blocking, avoid ...Wait(), MsgBox(), InputBox() functions If WinActive("Error") Then ;... EndIfEndFuncNo "AdlibUnRegister" ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
VelvetElvis Posted September 21, 2010 Author Share Posted September 21, 2010 As you can see in the helpfileNo "AdlibUnRegister" ! Thank you. I guess AdlibUnregister is _only_ required when reassigning Adlib within the same script. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted September 21, 2010 Share Posted September 21, 2010 Thank you. I guess AdlibUnregister is _only_ required when reassigning Adlib within the same script.No then you would just AdlibRegister the function again. AdlibUnregister is only for when you want it to stop. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
BrewManNH Posted September 21, 2010 Share Posted September 21, 2010 Thank you. I guess AdlibUnregister is _only_ required when reassigning Adlib within the same script.As the help file says, Adlib can register more than one function at a time, reregistering the same function using AdlibRegister would just change the time. So, you don't need to unregister it, unless as Admiral said, you need it to stop being called automatically.Several Adlib functions can be registered. Re-registering an already existing Adlib function will update it with a new time. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator 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