Best way to disable a file in Windows File Explorer? - c++

I am working on a virtual file system on windows in C++,
I am currently looking for a Windows API to make a file visible but not accessible in Windows 7 and Higher,
Picture example
the best option I could found is to use FILE_ATTRIBUTE_OFFLINE attribute,
but this solution implies to have the windows [X] grey overlay on files,
Offline Files
I already found this related post explaining the issue of file explorer multiple access if I hook the behavior at kernel side :
Keep windows trying to read a file,
is there an other way to look at the problem I omited, or a better option ?

Related

Reproduce local video file using XAML and C++

I am currently making a Windows Universal App starting with an Kinect SDK application called CameraFrames. It's a rather complex app but I am having trouble with playing a video from my local files.
To do this, in one of the main windows of my app I insert a MediaPlayerElement in XAML:
<MediaPlayerElement x:Name="_MediaPlayerElement" AreTransportControlsEnabled="True" HorizontalAlignment="Stretch" Grid.Row="0"/>
As shown in the captur above. Below the XAML file I have a cpp file and a header file. I tried searching on the web for a solution to my problem but couldn't find any. It's my first time using XAML thus I don't know how to connect the different objects that I put on my UI to actual code. The ideal result would be to have the ability to choose from my computer which video file I want to reproduce and then display it on this MediaPlayerElement.
You should set the Source property of your MediaPlayerElement.
If you want to do that in code, use MediaSource.CreateFromStorageFile or CreateFromStream method to create the media source.
Also, UWP apps run in isolated containers. By design, they can’t access files from arbitrary location of your hard drive. Read this article for more info.

Clipboard not found in UWP

I'm currently working on a project consisting of one program which tracks faces (which we got from https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/BasicFaceTracking), which is a Windows Universal App and our program, which is supposed to get the number of faces recognized and reacting appropriately.
I thought about copying the number of faces detected by the facetracking program to the clipboard and just reading it from the program.
The problem I have (which might actually be really simple) is that I can't seem to get to the Clipboard Class from within the UWP app.
Using OpenClipboard(NULL) or similar but I always get the error that the IDentifier is not found, no mater which header I include or not...
Can anyone give me a clue what to do? Or maybe a better alternative to transfer that one tiny int from one program to the other?
Thanks in advance.
janine
For UWP applications you should use Clipboard class.
OpenClipboard is an old Win32 API that is only available to desktop applications as mentioned at corresponding MSDN page:
Minimum supported client Windows 2000 Professional [desktop apps only]

Qt Single Application file opened

I am making an Qt Application.
And I have 2 problems that kind hard for me to figure out :
I create my own file type for my application document, so let say "something.ap". I want my OSes (Windows and Mac, maybe linux), when double click those file on file explorer, it will open using my application. How to implement this on Qt in easy way? On Windows I saw we need to edit the registry, but if there is a good way that will be best thing. And I don't have idea on Mac and Linux.
Related to number one. When I already open my "something.ap", and then I double click the same file ("something.ap"), I won't my application open again on new instance. So the behavior I want is to check if already file opened, it will raise the window of the application. I saw there is QtSingleApplication, but when I check the repository on gitorous can not be access.
Thank you for any help, and sorry if you can't understand my English.
You need to register mime type. check this
Singleton application is available here. It's not maintained any more :P. You can download source as zip or clone the git repository.

How to access the picture file on iPod/iPhone?

When I connect the iPod (or iPhone) to the Windows PC,
it look like an USB drive, but I can't open a file on it because I can't know the correct file path.
I was also unable to drop the file to my application because the drag source does not have CF_HDROP.
Some applications can open a file on iPod, but it was a copy on the local temp folder.
screenshot http://img862.imageshack.us/img862/5396/ipodx.png
My question is ..
How can I directly (programmatically) open and read the picture file on iPod?
If I double click on it (or right click and select Preview menu),
it launches Windows Photo Viewer -- it is not my default picture viewer.
Can I change the file (.PNG) association to other application?
What's the viewer application's requirement to be a default viewer for files on ipod?
Applications that do that use Picture Transfer Protocol (PTP). On Windows Microsoft implements many interfaces as part of Windows Image Acquisition (WIA). Read more here: http://msdn.microsoft.com/en-us/library/ms630344(v=VS.85).aspx
http://support.microsoft.com/kb/307859 or manually edit registry at HKEY_CLASSES_ROOT\.png
Try the iPhoneBrowser program. It should give you a fair idea of the path.
From everything I've read I don't think Apple gives you access to the file system on the iPhone / iTouch / iPad; they want you to use iTunes to transfer files back and forth. I believe the Android and Windows Phone environments have similar restrictions. (If you "jailbreak" or "root" your device that's obviously a different story, which is why many such utilities explicitly state they only work on rooted devices.)
In part, this is a security precaution: if it were possible to directly access the file system on the mobile device it would be that much easier for someone to plant malware on your phone or PDA.
For this reason, updates to the various mobile OSes frequently include changes to (1) make jailbreaking more difficult and/or (2) close the loopholes that allow software like the iPhoneBrowser to work.
Some of the portable music players that use (Windows) Media Player have similar limitations. For example, I had a Sansa m100 (I think) where I could just drag files to the device and the playlist would automatically get updated; on at least some of the newer models (eg the c200) you have to use Media Player to download content. Which to me is annoying since there doesn't seem to be a way to use Media Player to delete content from the device.
There probably are APIs to do this sort of thing, but I would guess they're somewhat specific to the platform you're using -- ie I don't think you're going to be able to just use CreateFile() or something like that.

Change Windows Mobile 6.1 Theme Programmatically

I am trying to figure out the proper procedure for applying a new tsk based theme file in windows mobile 6.1.
I have tried working off of the page http://www.pocketpcdn.com/articles/changetodaytheme.html But this only changes the background, not the system colors for things such as the top and bottom bars on the screen.
wceload.exe seems to work perfectly for some tsk's and partially for others.
Does anyone know more about tsk files and applying them programmatically in Windows Mobile 6.1?
My application is an open source application, the code is avail;able via read only svn, feel free to check it out # google code
I ended up finding a solution, I don't think it is a universal solution though.
Calling "\Windows\cusTSK.exe \Windows\ThemeName.tsk" changes the top and bottom bars, but does not change all apsects of the theme... so calling wceload.exe and then calling cuTSK.exe in that order seems to be able to change the theme using all tsk files that I have tested.
The cusTSK.exe binary does not exist on the Windows Mobile 6.1 Professional emulator image that you can download from msdn, so I think that this file that exists on custom roms and HTC made devices, that is why I do not think this is a universal solution, but it works for my purposes