C# and .NET FOLDERID - c#

How do I use Windows Vista's FOLDERID API in order to retrieve filepaths for "known folders" such as System or Windows? I've seen some APIs but I don't know how to import them properly. And yes, I know this is a very newbie question, but I spent a half hour googling and couldn't find the answer; I'd also appreciate a way to find an answer to questions like this in the future. :-)
Edit 1: So apparently the relevant functions are included inside of a DLL, and not any "proper" C# class/library that can be imported. The pinvoke syntax might work, although I was hoping for an OOP interface, not a function. Will test.
Edit 2: So I am very new to C# and don't know what a managed interface is. System.Environment.GetFolderPath is perfect.

Take a look at PInvoke SHGetKnownFolderPath
There's also a managed API:
Environment.GetFolderPath
but it doesn't contain all the folders.

This morning I read about Vista Bridge. It may help.
"Many of you don’t know about the Vista Bridge sample library, what can it do or even where you can find it. Let’s start with the basics; i.e. definitions. Vista Bridge is a sample library that contains managed wrappers for a number of Windows Vista APIs that are not exposed in the .NET Framework. The wrappers include common Open and Save file dialogs and new Vista advanced task dialogs. So, where to download it? There are three ways to obtain the sample library. It’s included in both the Windows SDK for Windows Vista Update and in the newer Window SDK for Windows Server 2008 and .Net Framework 3.5; or a third option is to download the Vista Bridge sample library which is part of the Windows SDK Cross Technology samples. I recommend downloading the Windows SDK for Windows Server 2008 and .Net Framework 3.5, but if you don’t have the network bandwidth or just want the samples, then the last option should be the most suitable.
..."

Related

Determine who has a file open using C# - is there a way now?

I need to be able to check who has a file open using C#. I found a few people asked this question before but they were all a long time ago with the latest being in 2012. I was wondering if, in the last 5 years, has Microsoft added this ability to .net or maybe someone came out with a nuget package that is capable.
Here is the latest answer I found
You can use windows internal function NTQuerySystemInformation with undocumented parameter SystemHandleInformation for it. I don't know about c# implementation, but I know delphy code for it, and vb6 code. Check this links, it will help you to make your c# implementation.
Delphi - get what files are opened by an application
https://forum.sysinternals.com/topic14546.html
As far as I know, the standard library still does not have suitable functions for this. There is a popular question about this: https://stackoverflow.com/a/937558/5665527.
Also, if you want to know who opened the file remotely - net file function may be useful (which is accessible via cmd). I believe that there are similar WinAPI functions on MSDN that could be implemented in a similar way.

Windows Spell Checking Service: Is there additional information available?

I've found that Windows has a spell checking service (see https://msdn.microsoft.com/en-us/library/windows/desktop/hh869748(v=vs.85).aspx). I'm not finding much about this at the moment.
Does anyone have more information on this library?
Specifically:
Are there .NET bindings available (it appears to a COM lib)?
Are there examples available?
Which operating systems are supported?
Are any Microsoft applications using this lib?
Are any third party applications using this lib?
Only COM
Examples (for C++)
"The Spell Checking API is available beginning with the Windows 8 or Windows Server 2012" - in you article
Using in github
Upd: For another OS version you may use: http://www.crawler-lib.net/nhunspell

Create Excel file in Universal Windows App or in Window Store App

I am learning to develop universal windows 10 app using visual studio 2015. I want to implement a function to create an Excel file then write data in this excel file, in my app. I try to develop it in C# adding reference Microsoft.Office.Interop.Excel.
Generate Error: Missing compiler required member System.Runtime.InteropServices.LCIDConversionAttribute
Search this error and find windows store apps doesn't support Microsoft.Office.Interop.Excel.
I am not able to create Excel file. I do not want to use any commercial library (like syncfusion) for this.
How Can I create Excel file in Universal Windows App or in Window storeApp? Please request to tell me any solution.
Thanks
You will not be able to use the Excel interop libraries in a Windows 10 Universal App. The interop is only available on Windows Desktop, and also requires a dependency on another software (Excel) to be installed on the machine. Both of those are somewhat against the spirit (and more importantly, the technology) of the Universal app.
That being said: If all you need is to generate a file (rather than display it), the general solution is to use something like the OpenXML SDK, which also has the advantage of not requiring Excel on the running machine. Admittedly, the OpenXML SDK doesn't look like it's available for the Universal platform either (see here), but you may find a 3rd-party component that is. Or, if you are OK with requiring internet connectivity, you could create a web service that you send data to, and that processes it and creates the file on your behalf (quite a common pattern, with the additional advantage of protecting your intellectual property behind your own web server). The Interop libraries are much more about automating user actions, are were initially build more for use with VBA/VSTO/COM add-ins, where the interactivity was very much part of the experience. If all you're doing is using the Interop to drive the creation of documents, OpenXML would be the better way to go.
Hope this helps!

Face detection for C# in ASP.NET

I'm looking for a specific form of facial recognition. I want to detect where all the faces are located (and that's all) on an image of students in a class-picture.
So in other words, I'm not trying to compare two faces and see if they match either.
How can I do this in C#? I can't seem to find any open-source projects on NuGet regarding this, and I've looked on CodePlex too.
My personal preference for any Computer Vision related needs is to use http://opencv.willowgarage.com/wiki/ , however, it isn't natively made for C#.
However, after a quick Google search, I found http://www.emgu.com/wiki/index.php/Main_Page which says "Emgu CV is a cross platform .Net wrapper to the Intel OpenCV image processing library. Allowing OpenCV functions to be called from .NET compatible languages such as C#, VB, VC++, IronPython etc. The wrapper can be compiled in Mono and run on Linux / Mac OS X."
Now that Face has retired since it was purchased by Facebook, I use Sky Biometry, which has a C# .NET API and is free.
It's cloud based and obviously requires an Internet connection, but who cares.
I recommend checking FaceRecognition.Net (https://github.com/takuya-takeuchi/FaceRecognitionDotNet) that is base on Face Recognition (https://github.com/ageitgey/face_recognition) that is implemented in Python. Both are Open Source with MIT license.
Another option is Cognitive Services – Face that is from Microsoft and you can use it from Azure directly or from a local Docker. Here you can find more about it: https://learn.microsoft.com/en-us/azure/cognitive-services/face/

Smartcard API in C# that's Linux Friendly

I currently have a project that operates in Windows using P/Invokes to call the Smartcard API; however, since I've now open-sourced the project and put it on Google Code, I'd be interested in making it work for Linux peeps on Mono.
The blockade to doing that however, is the smartcard code; I have absolutely zero familiarity with talking to smartcards under Linux and Google searches haven't revealed anything enlightening.
Well, I found my answer; PCSC-lite implements the entire WinSCard API in a compatible format, so all I've needed to do is bundle a small .exe.config with the program so that mono will replace the DllImport for WinSCard.dll with pcsclite.so.1 at runtime and everything works out of the box.
I think PCSC is what youre are looking for. Haven't used it because I don't have to deal with Mono/Linux, though I can't give you any details about it.

Categories