UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Changing Window's Lock Screen Wallpaper    
 
   
VBStudent
post Oct 2 2016, 11:09 AM
Post#1



Posts: 48
Joined: 17-April 16



Hello all,

Is there a way we could change windows lock screen wallpaper using VBA through access? I was just curious. I am writing a little code on my access database to automatically lock my computer when it is 12PM. I was trying to change the lock screen wallpaper to a different picture showing I was at lunch. Also, how can I increase windows sleep mode timer with vb? Our computers are encrypted and we can't change the actual settings.

Thank you!
Go to the top of the page
 
jleach
post Oct 2 2016, 04:28 PM
Post#2


UtterAccess Editor
Posts: 9,801
Joined: 7-December 09
From: Staten Island, NY, USA


Took a quick look around and found this LockScreen API in the .NET System.Windows.UserProfile namespace. Haven't tried... many of the .NET classes are COM consumable by default so you may be able to do something with CreateObject and grab an instance of it. If not you could write a COM Interop wrapper for it to call from VBA (hardly trivial, but if you know .NET you should be fine, or if you want to learn it might make a nice starter project).

For the timeout, have a browse through the SystemParametersInfo documentation, which you can apparently set via the ACCESSTIMEOUT flag: https://msdn.microsoft.com/en-us/library/wi...v=vs.85%29.aspx (this one should be doable direct from VBA, though if your user credentials don't allow it currently, I highly doubt you can use this as a backdoor).

Cheers,
Go to the top of the page
 
VBStudent
post Oct 2 2016, 09:17 PM
Post#3



Posts: 48
Joined: 17-April 16



Thank you Jack!

I will try to make it work. Thank you!
Go to the top of the page
 
jleach
post Oct 2 2016, 11:08 PM
Post#4


UtterAccess Editor
Posts: 9,801
Joined: 7-December 09
From: Staten Island, NY, USA


No problem, and good luck... (for the record: I'm not sure what your general code skills are, but neither of these tasks are exactly trivial - stop back with questions if you need help).

For the lockscreen, I did try to see if I could get an instance of it with Set myObj = CreateObject("System.Windows.UserProfile.LockScreen"), but alas, it's not a COMVisible component, so you would indeed have to go the .NET COM Interop wrapper to get to it. Furthermore, because it appears that there's but a single method on that class that you need to call, I thought to whip up a quick 10-line program that would have done the job and been callable from VBA, but apparently you need the UWP (Universal Windows Platform) SDK installed for that reference, which I don't have handy.

The timeout is standard API stuff (though "standard API" stuff is not very trivial either...). Our wiki here has a half-completed article on the topic of the Windows API here: API. Additionally, we have an API category that contains a number of standard/common API declaration calls: Category:API. I don't see the SystemParametersInfo listed in there, but if you're completely unfamiliar with API programming, those examples of other things may help.

Have fun! Stop back with questions...
Go to the top of the page
 
JonSmith
post Oct 3 2016, 02:48 AM
Post#5



Posts: 3,158
Joined: 19-October 10



So as programmers we often try to find technical solutions to real life problems.

Have you considered just placing a note on your desk over the screen saying 'Out to lunch'?
Not only is it much much simpler and a more effective use of resources than trying to code a lock screen change it will, imo, work better overall because many people simply ignore lock screens now, we see them all the time and jusy filter them out so I may not even notice yours is trying to convey information to me (also not its native task). If I see a paper sign over your screen I am almost certain to read it.
Go to the top of the page
 
jleach
post Oct 3 2016, 06:08 AM
Post#6


UtterAccess Editor
Posts: 9,801
Joined: 7-December 09
From: Staten Island, NY, USA


Practically speaking, sure, but that doesn't make for a very fun learning challenge smile.gif

Cheers,
Go to the top of the page
 
JonSmith
post Oct 3 2016, 11:26 AM
Post#7



Posts: 3,158
Joined: 19-October 10



Fair point Jack, if the goal is learning and fun then sure, this might be interesting to try. If its practical I think its kind of a chocolate teapot.
Go to the top of the page
 
R_Durrer
post Oct 4 2016, 10:13 AM
Post#8



Posts: 87
Joined: 19-April 16
From: Guelph, ON, Canada


Chocolate teapot. Blinks... What an interesting analogy, or is it a metaphor? I need to remember and use it in future!
Go to the top of the page
 
JonSmith
post Oct 4 2016, 11:51 AM
Post#9



Posts: 3,158
Joined: 19-October 10



I thought that was a common saying!
Hopefully the meaning is clear, the teapot would melt when you tried to use it so it might look ok but in practice doesnt work.
Go to the top of the page
 
jleach
post Oct 4 2016, 01:04 PM
Post#10


UtterAccess Editor
Posts: 9,801
Joined: 7-December 09
From: Staten Island, NY, USA


I'd never heard it either - figured it was an across-the-pond phrase (though I did file it away for whenever it might come up handy)

I do think the programmatic solution would work though... whether or not it's practical is a whole different matter, but it would work thumbup.gif
Go to the top of the page
 
VBStudent
post Oct 4 2016, 10:39 PM
Post#11



Posts: 48
Joined: 17-April 16



Thank you Jack!

I am not very good with coding and just started a year ago. But I am half way there and almost got this thing working.

Jon,

Posting a note on the screen did actually come to my mind. LOL. I am just doing this for fun and learning.

Thank you!
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    11th December 2017 - 11:33 PM