Trying to make a WPF app with different frameworks


#1

Hello,

I’m trying to make a customisable lock screen app for educational reasons (as I am a beginner). I want it to be such that I am able to use the accelerometer and other sensors to unlock “windows” and provide access to other apps. I’ve already figured out how to use winRT APIs along with normal .NET APIs in my WPF app. I was wondering if there were any low level frameworks (win32, MFC, etc) that I can use with WPF whose APIs will allow me to block access to other apps and “windows functionality” until the user enters a password or does an action. Also if I am looking in the wrong direction (with WPF) please let me know. Also general advice would be appreciated as frankly, as a beginner, I don’t really know where to start properly.

To summarize: Beginner trying to make a lockscreen app and dont know how.


#2

You’re trying to solve something that’s better solved at - and already implemented in - the OS level. Essentially, you’re describing a guest/child/other restricted account.

There’s a couple of other problems with what you’re describing, anyways:

  • If you’re inside Windows, and preventing other apps from running, you’re running afoul of “what if everybody did that?”. What would happen if Adobe decided to uninstall Gimp from the machines of those who installed Photoshop? Or Origin prevented you running games on Steam? Or some other app to block yours? Ergo, no OS utilities available for you to abuse. Then there’s the issue that you’d have to block TaskManager (to prevent the app being killed), which runs from impossible to terrible idea (or mistaken for virus).
  • (I may be wrong, but…) If you’re outside Windows, I’m not sure you could start arbitrary apps. Certainly the list would have to be curated regardless, but I’m not sure that security considerations would let you get away with it anyways. If an app wasn’t designed to work while locked (most games?), you’re out of luck; individual apps have to declare they’re interested in being there. You might be able to do some sort of plugin setup, but you’d have to write all the other apps yourself…

#3

I didn’t know it was that difficult. Could you explain the plug-in idea you mentioned. Also what if i just use the windows lock screen instead of making my own. The whole idea was to be able to unlock your laptop using the accelerometer (and other sensors) and make that customisable (have sound play when unlocked, etc). Is it possible to write an app that integrates with the current lock screen such that, say the computer is sleeping and I shake it, then it plays a sound or does some sort of function (to be used primarily with the surface pro). I’m currently trying to learn win32 to make that happen.


#4

I’m not sure what’s available in the actual lockscreen (in Windows 8, the answer is not much). Windows phone lets you do custom ones (and lets you do quite a lot), including doing a call SystemProtection.RequstScreenUnlock() (although it’s not clear from documentation whether this pops the pin/password prompt). You can play sounds and stuff. It’s not clear if the accelerometer can be polled/have events registered if the computer is sleeping (when the OS suspends…).

The plugin idea was that you could have a set of things in your app people could download/use, but you’d have to write it yourself - no getting Angry Birds that way…


#5

Wait, found it for the non-phone API. Again, I don’t know if requesting an unlock nets you the standard pin/password prompt.

There’s a workaround for calling other apps, which might net you the ability to send an email or post to facebook or something, but those other apps would have to already declare they can handle whatever it is. That is, still no starting completely arbitrary applications, and you don’t actually get to pick it (managed by user, sometimes at each call). I have no clue how this would interact with the lock screen, if it’d even be allowed.


#6

Thank you I’ll check the links out. Assuming .NET ends up providing no way of doing this, would you suggest anything using low level APIs such as from win32 or MFC? And with the whole plug-in thing, could you explain that further? Are you saying I could do everything I mentioned with this “Plug-in”?


#7

nvm the question above, the API you mentioned is actually perfect for the job. I’m just unable to use it in either a WPF app or a windows store app for some reason; do you know if there’s some reference or something I have to add to make it work? And how to add that something?


#8

No clue, sorry dude. Now it’s your turn to go hunting.


.NET Foundation Website | Blog | Projects | Code of Conduct