PDA

View Full Version : [SOLVED:] A get around for computer autolock!



agarwaldvk
09-09-2008, 03:39 PM
Hi Everybody

Because, as a company policy, all the computers are supposed to auto-lock themselves if there is no activity that is registered by the computer for a specifed length of time. This is very annoying when I am running some of my Excel VBA based applications that run for extended periods of time with the VBE closed. The reason is that once the computer auto-locks itself and and I subsequently enter the password and log back in to the system, I cannot get back to the Excel application. The only way that I can get back to the Excel application is by interrupting the VBA code which activates the VBE and the program can then only be continued from within the VBE.

This is something I do not want to happen, for two (2) reasons :-
1. that I am led to believe (but I haven't got any hard evidence to prove it to be correct or otherwise) that with the VBE activate, the VBA programs run a lot slower and
2. that the status bar can now not be made visible during the running of the program. It is important that the status bar is visible for the whole duration that these VBA based applications are running since they convey important messages to the user.

Does anyone has any suggestions as to what can I do to make the computer register some activity so that the auto-lock doesn't get activated. For example, would making a different cell show or selecting a cell through VBA count as some activity or does it need to be manually done by the user for the computer to register it as a physical activity?

Any suggestions please! This is driving me crazy and apparently there can be no exceptions to this company policy with reference to the Network Security.


Thanks in advance.


Best regards


Deepak Agarwal

Oorang
09-12-2008, 08:52 AM
Hi Deepak,
With respect, circumventing system security might not be the best way to go here. Perhaps it would be best to look for ways that will make the program work better under the existing environment. Perhaps you could post the code?

malik641
09-12-2008, 02:05 PM
You can get around the part where you're having trouble with re-activating Excel by adding a 'DoEvents' line somewhere in your code...but it could how it effects your code's functionality (depending on what you're doing).

I'm with Oorang here. Trying to "trick" the security is basically against IT Policy.

Can you post the code?

Mavyak
09-12-2008, 02:11 PM
I know when I have lengthy Access processes running and want to go to lunch I can't hit Ctrl-Alt-Del to lock my computer because it stops my code from processing. However, If I hit the Windows key plus the letter "L", it sends it straight into Locked mode. But when I come back and log back in, my process is still running or complete, but it doesn't get interrupted.

agarwaldvk
09-13-2008, 02:59 AM
Hi Everybody

I think you all have missed the essential point here - the idea is not to circumvent the restrictions imposed. This restriction is generally and globally imposed on one and all. However exceptions are made on an individual basis to this policy given ones circumstances. I have already applied for my case to be considered as an exception. It just takes a while for things to get implemented in a large organisation such as ours. And further, this is not going to wreck havoc as no attempt is made to access the inaccessible part of the network by doing what I am looking at doing. I am not trying to access some part of the network that I already do not have access to.


and apparently there can be no exceptions to this company policy with reference to the Network Security What I meant by the statement in my original post was that without rhyme or reason, there can be no exception just because someone does not like it. However, given proper justification, it can be looked into and exception granted if found acceptable to the Network Security authorities.

It is a trifle discomforting to see people carrying this kind of preconceived notions - but I can relate to that given that we hear all kinds of bad activities that people indulge in all the time. However, please be assured I have no such sinister intents.

Given the above explanation, I am sure some of you will appreciate the genuineness of the request. Notwithstanding the above, should any or all of you still feel that you cannot offer any assistance, then of course you are more than welcome. I can understand your stand - whether or not I agree with your position is another matter.

The idea is to be able to get back to the application without having to interrupt the code.

In anticipation

Best regards


Deepak

Bob Phillips
09-13-2008, 03:19 AM
I have to agree with the OP here, there seems nothing sinister or untoward in what they are trying to do. By letting the computer get on with stuff, they can do something more productive.

Mavyak gave you one option, but if that doesn't work, maybe you can intersperse your code with an time procedure (see OnTime) that writes to a cell on the activesheet. Couple this will DoEvents, and that may be enough to register activity.

Paul_Hossler
09-13-2008, 07:07 AM
Assuming that they monitor mouse and KB to determine activity (similar to knowing when to start a screen saver), I'm guessing just writing to a cell with VBA won't prevent lockout since you most likely does that already.

It might be possible to simulate user activity with a prog that moves the mouse:

http://www.torrez.org/projects/XuMouse.zip


Paul

Carl A
09-13-2008, 07:41 AM
Use the OnTime to call this at the interval required.

The keyboard driver?s interrupt handler calls the keybd_event function.
To the system it is the same as pressing a key.

This is also a more reliable way to simulate keystrokes as opposed to sendkeys.


Option Explicit

Const VK_D = 68
Const VK_O = 79
Const VK_I = 73
Const VK_T = 84
Const KEYEVENTF_EXTENDEDKEY = &H1
Const KEYEVENTF_KEYUP = &H2
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)


Sub showActivity()
keybd_event VK_D, 0, 0, 0 ' press D
keybd_event VK_D, 0, KEYEVENTF_KEYUP, 0 ' release D
keybd_event VK_O, 0, 0, 0 ' press O
keybd_event VK_O, 0, KEYEVENTF_KEYUP, 0 ' release O
keybd_event VK_I, 0, 0, 0 ' press I
keybd_event VK_I, 0, KEYEVENTF_KEYUP, 0 ' release I
keybd_event VK_T, 0, 0, 0 ' press T
keybd_event VK_T, 0, KEYEVENTF_KEYUP, 0 ' release T
End Sub

malik641
09-13-2008, 09:11 PM
I do believe the intent is harmless. I just think that their IT department will not like the fact that they can avoid the AutoLock feature they have implemented.

I have the same issue at my job, except I don't have any code running to interrupt. I just wanted to do it because it annoyed me at first. I tried using some kind of MoveMouse procedure in hopes for the system to register that the mouse was moving. It didn't go through well.

I like Carl's suggestion. Let's see how well it works! :)

agarwaldvk
09-13-2008, 11:39 PM
Everyone

Thanks for believing that I am not trying to do anything sinister and suggesting some probable solutions. Greatly appreciated.

CarlA
Your suggestion solution is what I am looking at implementing on Tuesday. I am not at work tomorrow and I don't have the file at home.

A couple of questions though :-

1. Wouldn't it be required to have this onTime method inside the innermost loop since I want it to be repeatedly called if the procedure inside the innermost loop takes more than say 10 minutes.

2. Having done that, do I just need to specify the "schedule" parameter with the "Now() + 10 minutes" (obviously appropriately coded) or do I also need to specify the latest time as well.

3. Do I need to first have the "DoEvents" statement before the onTime method statement to yield the control the Windows system for the onTime method to execute or this happens by itself?

The reasons that I ask these are as follows :-

The required processing is to be done for 24 months for each of the 7 states in each of the 2 worksheets - that is why it takes so long to complete. The processing time for each month progressively increases since it has to look back as the processed data for all the months prior to the month being processed. Hence, at the start, the processing time may not exceed 10 mins but as we get to the month number 15 and beyond it might start to take around and over 10 minutes.

Now,if I did as above, in those instances where the procedure in the the innermost loop completes in less than 10 minutes, what would happen to the the unexecuted onTime method procedure that was set to run at the expiration of the 10 minute period? Would it get executed when the elapsed time reaches 10 minutes or it doesn't get executed at all - not that it will make a world of a differnece because all I am intending to do in the onTime method procedure is press and release the say "Start/Menu/Windows" key.


Thanks, in anticipation.


Best regards


Deepak

mdmackillop
09-14-2008, 02:25 AM
Have you tried Windows Task Scheduler to perform tasks outwith Excel?

Bob Phillips
09-14-2008, 03:12 AM
I do believe the intent is harmless. I just think that their IT department will not like the fact that they can avoid the AutoLock feature they have implemented.

I would say that as he has asked for dispensation, as and when he gets the negative response, then he backs off, until then, run with it. He will then have some evidence of the benefit of allowing him the dispensation.

malik641
09-14-2008, 04:45 PM
I would say that as he has asked for dispensation, as and when he gets the negative response, then he backs off, until then, run with it. He will then have some evidence of the benefit of allowing him the dispensation. Yeah, you have a good point. Deepak might as well just run with it for now. If they do give him a hard time hopefully they'll ease-up once they see the benefits he had gained.

agarwaldvk
09-14-2008, 07:55 PM
XLD, MALIK641

I don't quite get what are you all trying to say in your last posts. Is there something I am supposed to or not supposed to be doing or have done? Have I said or done something that I shouldn't have. I really don't get it.

If I have, please be assured that it must have occurred inadvertently, no hurt intended at all. I hence seek pardon from all those that may have been offended inadvertently.


Best regards


Deepak

Bob Phillips
09-15-2008, 12:34 AM
Deepak,

No, we are not suggesting you have stepped out of line at all, or that you should do anything other than what you have done. My post was mor along the lines of a rationale for the approach you have taken, and some backup arguments.

What we are suggesting is that you implement the suggested solution, and run with it for now.

Meanwhile, you have applied for dispensation, and as and when IT respond. If they respond negatively, you can go back to them and tell them how it has allowed you to not have to sit in front of the monitor making sure it didn't autolock, and explain how it allows you to be more productive at no real risk to security, and ask if that changes matters. If they still say no, then I think that you have no choice but to remove it, otherwise that would constitute deliberate flouting of the decision

agarwaldvk
09-15-2008, 03:51 AM
XLD

That's okay then. I was a bit confused myself not knowing what has happened. Now that I understand, I am a trifle relieved.

Thanks again for everyone's help!


Best regards


Deepak

Spock
03-09-2017, 10:51 AM
Believe it or not, on our systems (which are insanely secure with timeouts, lockouts, power saves etc) if you open a video - ANY video - in VLC media player, and pause it, the PC will NEVER lock. Try it.

Paul_Hossler
03-09-2017, 11:39 AM
Welcome to VBAexpress

Good input, but that post is more than 8 years old so I doubt there's much interest in it anymore

However, it does point out the issue with people not marking their threads SOLVED

SamT
03-09-2017, 12:06 PM
Write code that, On Unlock, activates the Excel Window.


The processing time for each month progressively increases since it has to look back as the processed data for all the months prior to the month being processed.
Stick that data in arrays and have Excel use those instead of referencing the worksheets. Many times faster.

Write code that when Windows unlocks, the Excel Window is Activated