How to use Winrt API's in c for creating libraries? - c

I have an existing C libraries which uses Win32 API but it is not supported in windows 8 metro store apps.
I tried calling WinRT API but failed so is there any way ican use WinRT apis in C.

Since the question although very general seems to be specifically about SHGetSpecialFolderPath() on WinRT I'll address this:
As you found out WinRT (Metro) apps run in a sandboxed environment which only supports a limited subset of the win32 api.
SHGetSpecialFolderPath is officially deprecated on MSDN and its functionality is not available to WinRT applications. The closest equivalent would be the ApplicationData class. Unfortunately calling it from C is complicated. I would recommend writing a C++ helper which your library could call into.

Related

How can I incorporate a C project in Xamarin Forms?

I have a project, written in C which I want to use in Xamarin Forms. What is the best way to use this code? Generate libraries for each platform?
What I'd prefer is to have one wrapper that I can use in shared code that doesn't have to be implemented for each platform.
Unfortunately, the way binding works is different for Android and iOS, so you would need to generate libraries for each platform.
You can read more about how that is done here for iOS and here for Android. For iOS, you can consider using Objective Sharpie which will do the most of the work for you.
Afterwards, you can simply use DependecyService to access the native platform features.

Can native C programs be used in LibGDX?

I have a program in C which i would like to call and use it in LibGDX so that i can use it both for android and desktop. So can you suggest me methods to call a C file into LibGDX?
To be clear, I believe you have an app written in Java that uses Libgdx currently, and you would like to extend that app by including a C library and making calls out to the C library from the Java application.
Libgdx does not provide any special support for third-party libraries, native or Java. You will have to use the backend platform's APIs to call out to native code (JNI, NDK, etc).
You should be able to add your library to the Android and Desktop backend projects, and access it via a Platform Interface. It is probably not possible to use the GWT-backend (unless you have a C to Javascript compiler). For iOS you would need to build your library for iOS, and then figure out how to link it into the Xamarin (or robovm) build process for your app. While I'm going to assume this is possible, I suspect neither is easy to accomplish.

Which parts of the Windows API are not accessible from ANSI C code?

Before 2000, I have been using ANSI C for Windows programming. Later I changed to C++ and MFC, then to Delphi, and nowadays I prefer C#, but I'm curious if it is still possible to use plain C to access every API of the modern editions of Windows.
For example, even COM/OLE objects can be dealt with from C.
The Windows APIs list is described here.
Most of the APIs are C-based (structures and functions). However, few are C++ based (classes):
COM+
GDI+
DirectShow
XAudio2
Volume Shadow Copy
Network Diagnostics Framework (NDF) extensible helper
DirectXMath

What is the difference between GTK and Win32 Native API in C?

I'm a beginner in C programming. I read about some tutorials and forums about creating GUI application in C. I encountered some terms like GTK, Win32 native API. They say that GTK is one of the library to use in creating GUI application. I also tried the code that create a simple window using Win32 API. What are the difference between them?
Thanks.
GTK is multi-platform tool kit for creating graphical user interfaces(GUI).
In short they provide a framework which you can use as an library for developing your UI applications.
Win32 API is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. These are restricted only for windows platform.
The language rules for c/c++ are governed by ISO standards which define what functionality every standard c/c++ implementation has to provide.Note that both of above provide some functionality that is over and above what the standard libraries provide.Basically, they provide you boiler plate framework for easy usage instead of reinventing wheels for your project.
Win32 is the "native" API for Microsoft Windows. You can only run it on Microsoft Windows.
GTK+ is also a GUI library. You can run it on multiple different platforms.
Qt and SDL are other multi-platform libraries. Like GTK+, the same GUI can be recompiled to run on multiple different platforms: Windows, Linux, MacOS, etc etc.
Gtk+ = cross-platform and very powerfull. more simple than win32. more tools you will have.
win32 = just in windows. standard windows GUI framework.
and DUDE! Gtk+ in windows is a pain in the ass. but for any othe supported platforms I reccomend Gtk+ for a widget toolkit.

CPython WPF interop

Is this possible?
Is there any thinkable way to have interop between a CPython scripting app (3rd party) and a WPF UI app?
There are plenty of ways. Both CPython and .NET support quite a few forms of IPC, which could easily be used to allow them to communicate.

Resources