I have a set of pages which are developed with XAML for Windows 8.1 RT.
The application looks fine and works as expected but a part of the requirement is that a particular view has to be placed on the lock screen. There are no interactions required on the lock screen.
I have searched for quite some time and still no luck.
My question, is it possible to place a view on the lock screen, like possibly a widget?
If possible, what is the right approach?
Step by step instructions are really appreciated, as I am relatively new to XAML and Windows 8.1 RT.
Thanks.
Short answer: No.
You can add your application to the lock screen notifications as described in MSDN.
Apps can however change the lock screen background image, maybe that fits your needs as well.
See this sample for how to use the LockScreen API.
Related
I am developing an UWP application for an 84' Microsoft Surface Hub, and I set the sizes and positions of each element based on the size of the Hub. The problem this brings about is that I cannot view the whole app when I run it on my PC which is smaller in size. What is a good way of fixing this by making the UWP app automatically fit in the screen size, and always display in full screen? Thanks in advance.
The question is obviously too broad to get a specific answer but here are a couple of quick pointers to get you in the right direction
Adaptive layout in UWP - https://msdn.microsoft.com/en-us/windows/uwp/layout/design-and-ui-intro
RelativePanel - https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.relativepanel.aspx
Adaptive Triggers - https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.adaptivetrigger.aspx
You can also check the UWP Sample apps to see how Adaptive Layout works in practice - https://github.com/Microsoft/Windows-universal-samples
I'm trying to change Windows 8.1 (desktop) lock screen image from WPF application.
I've found solution with Windows SDK approach, but it uses runtime application as example (actually, all information I've found was regarding to WinRT apps). But I don't want to use WinRT - all I want is to use LockScreen class in plain old WPF.
After all I have managed to do this in the WPF app several times. This included:
1) manually adding <TargetPlatformVersion/>8.1</TargetPlatformVersion> into .csproj as suggested here;
2) adding references to Windows and System.Runtime.WindowsRuntime as suggested ibid;
3) following these steps to change lock screen background
Then I've faced the problem with platform - application does what it should only with x64 platform (not anyCPU). And not each time (I could not determine consistency yet).
Any way I think that I am over-complicating the solution. Does anyone have other suggestions? Is there any other simpler/cleaner way to change Windows 8.1 lock screen image via WPF application?
I need to capture the visual output (like a screenshot) of a DirectX window.
Currently, I use this approach.
But, when the window is in background, it captures whatever is in front of it.
I see that DirectX windows render even when minimized or in background, so this should be possible.
But, how? (It also needs to be fast, and it needs to work on Windows XP too, unfortunately...)
Edit: I am very busy these days... Don't worry, I'll put the bounty back if it expires.
To capture Direct3D windows that are in the background (or moved off screen), I believe you have the following options:
Inject and hook Direct3D within the target application via the link you have already posted or this more up-to-date example (EasyHook can be difficult to get setup but it does work really well) - you can always ask for help about getting it working. I have used that technique for capturing in a number of games without issues (most recently for an ambilight-clone project). The problem with this approach is your concern about game protection causing bans, however FRAPs also uses hooking to achieve this, so perhaps your concerns are exaggerated? I guess gamers being banned for a screen shot is an expensive way of finding out.
For windowed applications on Vista/Win 7 - you could inject and hook the DWM and make your capture requests through its shared surface. I have had this working on Vista, but have not finished getting it working on Windows 7, here is an example of it working for Windows 7 http://www.youtube.com/watch?v=G75WKeXqXkc. The main problem with this approach is the use of undocumented API's which could mean your application breaks without any warning upon a windows patch release - also you would have to redo the technique for each new major Windows flavour. This also does not address your need to capture in Windows XP.
Also within the DWM, there is a thumbnail API. This has limitations depending on what your trying to do. There is some information on this API along with other DWM API's here http://blogs.msdn.com/b/greg_schechter/archive/2006/09/14/753605.aspx
There are other techniques for intercepting the Direct3D calls without using EasyHook, such as substituting the various DLL's with wrappers. You will find various other game hooking/interception techniques here: http://www.gamedeception.net/
Simply bring the Direct3D application to the foreground (which I guess is undesirable in your situation) - this wouldn't work for off-screen windows unless you also move the window.
Unfortunately the only solution for Windows XP that I can think of is intercepting the Direct3D API in some form.
Just a clarification on Direct3D rendering while minimised. During my fairly limited testing on this matter I have found this to be application dependant; it is generally not recommended that rendering take place while the application is minimized (also this reference), it does continue to render while in the background however.
UPDATED: provided additional link to more up-to-date injection example for point 1.
A quick google and i found this Code Project which relates to Windows XP. I dont know if you can apply this knowledge to Windows Vista and 7??
http://www.codeproject.com/Articles/5051/Various-methods-for-capturing-the-screen
EDIT:
I found this article as well:
http://www.codeproject.com/Articles/20651/Capturing-Minimized-Window-A-Kid-s-Trick
This links off from Justins blog post here from the comments. It seems he was working on this with someone (i see thats your link about).
http://spazzarama.com/2009/02/07/screencapture-with-direct3d/
The code that you linked to (from spazzarama), which you said you were using in your project, captures the front buffer of your DirectX device. Have you tried capturing the back buffer instead? Going from the code on your linked site, you would change line 90 from
device.GetFrontBufferData(0, surface);
to
Surface backbuffer = device.GetBackBuffer(0, 0, BackBufferType.Mono);
SurfaceLoader.Save("Screenshot.bmp", ImageFileFormat.Bmp, backbuffer);
This would also involve removing lines 96-98 in your linked example. The backbuffer might be generated without the obstructing window.
EDIT
Nevermind all of that. I just realized that your linked sample code is using the window handle to define a region of the screen, and not actually doing anything with the DirectX window. Your sample code won't work around the obstruction because your region is already drawn with the other window in front of it by the time you access it.
Your best bet to salvage the application is probably to bring the DirectX window to the top of the screen before running the code to capture the image. You can use the Wind32API BringWindowToTop function to do that (http://msdn.microsoft.com/en-us/library/ms632673%28VS.85%29.aspx).
Is there a way to embed a website (that I have no control what-so-ever over) in an app for Windows Phone?
I basically just want an extremely simple app that's just the Google+ website embeded in an app for Windows Phone. I realize I can just pin the website, but it's just not the same as having a nice pretty icon on the start screen, even if it's just a mobile site in a shell.
I know a small amount of C#, so that's the language I'd prefer.
EDIT: I just found this: How to launch IE7 from a Windows Phone App?
So now my question is, how do I use this so it happens on load?
To answer your question, you can execute the code that you reference in the above link, in the constructor of your MainPage.xaml. The question is, though, why? As you stated, you know you can pin a site, but you want an icon. Are you aware that you can make the icon appear as any part of the web page you are pinning? The tile will look like the page you're on, and the view you are at when you pin. If you want it zoomed out, then zoom out, then pin. Want an image on the page to be your icon? Zoom in on that image, and pin. You have a good deal of flexibility with this, depending on the page, of course.
I'd like to make an animated desktop background for Windows 7 using DirectX. I'm using C#, SlimDX and a couple of P/Invoke imports of Windows API functions. I'm not brilliant with native Windows programming, but I've had a poke around online and I believe what I need to do is either:
1) Find the handle of the window containing the dekstop wallpaper, hook it up to a DirectX device and draw into it.
2) Make a new output window, and insert it above the desktop wallpaper but below the desktop icons.
I've tried both these, but neither seems to work. If I navigate the Window heirarchy starting from the handle returned by GetDesktopWindow(), I can go Desktop -> WorkerW -> SHELLDLL_DefView -> SysListView32. If I hook up a DirectX device to this handle, I can draw over the entire desktop, but it also covers the icons. If I create a Windows form, set its parent to SHELLDLL_DefView using SetParent() and then use SetWindowPos to play with its Z-order I can only seem to get it to go either behind the desktop wallpaper or in front of the desktop + icons.
It looks as though the desktop wallpaper is background to the folder view containing the icons, and therefore what I am trying to do cannot work. The only solution then would be to not use the desktop for icons, or to find some alternative, e.g. overwriting the desktop then overlaying a transparent window containing a view of the contents of some folder.
Does anyone have any idea of what I should be doing, or even whether what I want to do is possible? It seems you can draw to the desktop background using the GDI (as I believe the wxSnow program does), and I've seen something similar to what I want done by VLC Media Player under Windows XP with its DirectX wallpaper mode (interestingly, I can't seem to get this option enabled on my system).
Thanks!
Looks like this might not be possible. See this link:
http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/69839cec-3424-4300-9ac3-486b8c2fe492
If you need to draw some controls
between the desktop background and
desktop icons, an alternative step is
below:
Create your user control in a windows control library.
Embed the user control in an ActiveX control.
Embed the ActiveX control in a web page.
Enable active desktop and set the web page to be your desktop
background.
This can only be done in XP since
Vista doesn’t support active desktop.
Another post there suggests that you could possibly do this with the background of an explorer window - if you could get the handle of the window that constitutes it. Of course, if that's possible then it may be possible also to get the handle of the desktop window behind the icons.
Update: Well, so far the only thing I've found that could possibly "work" is just creating Bitmap files and changing the wallpaper over and over again (I suspect this would be slow, as you mentioned).
That full screen image must be resident in memory somewhere, but there may be no way to access it without some serious low-level memory hacking. I'm going to keep looking.
Update 2: This might work, but I'm not sure:
http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/4af734fb-d2c1-414b-a9f1-759b76692802
The meat of it is this:
HWND p = FindWindow("ProgMan", NULL);
HWND s = FindWindowEx(p, NULL, "SHELLDLL_DefView", NULL);
HWND dtw = FindWindowEx(s, NULL, "SysListView32", NULL);
HDC hdc = GetDC(dtw);
You're basically starting with the ProgMan window and drilling down from there to the desktop wallpaper ("SysListView32", I guess). I'm going to try this out.
Update 3: No go - the above code does get the desktop's DC, but it's above the icons so BitBlt draws over them. It's not drawing to the Screen, though, because I can draw underneath an open form without covering it, so that's progress at least.
I'm guessing that there's some window available other than "SysListView32" that is the desktop behind the icons, or there's more than one "SysListView32" window.
Update 4: I'm pretty sure something using this would work:
http://msdn.microsoft.com/en-us/library/bb761155(v=VS.85).aspx
http://msdn.microsoft.com/en-us/library/bb774742(v=VS.85).aspx
Basically, it's an API method that you call, passing in a structure which include a bitmap handle. If the call is successful, that bitmap becomes the desktop.
Does DirectX expose frames as bitmap handles (GDI-compatible), or does it only expose the DC? In my case, my animation is already an array of GDI-compatible bitmaps, so I would have no trouble using this approach. If this is the only route, and DirectX doesn't expose the bitmap handles (and I don't think they would), then for each frame you would have to create a new GDI bitmap, which would slow things down quite a bit.
Actually, there might be an easier way, although I'm not sure it would work. Once you get the handle to the actual bitmap of the wallpaper, you can select it into a device context using SelectObject, and then just use that device context as the BitBlt destination. You might have to send a repaint instruction to the desktop, though, which might trigger the icons to be repainted every time.
How about you do some work here? :)
I guess you could get quite a few frames per second by dynamically generating bitmaps and constantly setting these as the desktop background. However, this sounds unnecessarily (almost stupidly) heavy for the CPU. Update: Now that I think about it (it was late when I wrote this), the main problem with such an approach is that you need to write and read bitmaps from the hard drive every time a new frame is to be displayed. This is not feasible.
Are you really using the desktop for icons? In Windows 7 the start menu search function and the new taskbar has made me not use the desktop for icons.
Just an idea
It might be possible to alter the desktop window, by means of SendMessage(GetDesktopWindow, WM_SOME_MESSAGE, wParam, lParam), so that you can achieve what you want. I might investigate this further tomorrow (currently 3 am, local time).
I've done some animation of alpha blended windows that are always on the top of the Z-Order. One idea would be to ignore trying to modify the desktop bitmap and just draw your stuff as a layered window but manage the ZOrder somehow so it is always the bottom-most, non-desktop window (perhaps by strategically calling Form.SendToBack() or something at the right times).
Depending on what you are trying to do this may give you the same effect of animating the desktop.