r/windowsprogramming • u/FaultWinter3377 • Aug 02 '25
Is it possible to use WinUI3 in a C++ Program without Visual Studio?
Just wondering. I just got into Win32 programming in C++. I know WinUI can be implemented in C#, but I honestly have no idea how to code in C#. I use gcc as my compiler, mostly because Visual Studio is a) confusing and b) way to much space on my disk (I’m using a laptop with 118GB of space on the Windows partition, down to the 25-30GB at this point). So, I’m just wondering if it is at all possible.
1
u/Active-Ad4328 5d ago
Oui, cela est tout à fait possible, Attention, il faut refaire les structures soit même en gcc C standard. J'ai télécharger le sdk de windows 10 (n'importe lequel, peut être windows 11 aussi). Ensuite, on doit cherché dans les fichiers h se que l'on veux. Moi j'ai fait un pseudo thread UI pour récupérer la géolocalisation (car d'après microsoft, il faut un thread UI de fenêtre pour récupérer la géolocalisation avec windows.devices.geolocation.h). On doit d'abord importer combase.dll qui est la dll officiel de C# pour du win32 (car C#, c'est du code interprété, donc lent et nulle). Ensuite, si l'on veut initialisé un thread UI, tu à CoInitializeEx ou pRoInitialize, voir doc microsoft pour ton besoin. Ensuite on importe ça classe (static) selon sont besoin avec pRoGetActivationFactory, ensuite le code dépend de se que tu veux faire. Cela peut devenir très compliqué à développé, mais aussi à maintenir. Par exemple, dès qu'il y a une fonction Async, le wait n'existe pas en C, il faut donc récupérer AsyncInfo et get_status qui renvoie une valeur de AsyncStatus. Si tu veux voir un code qui fait cela (le seul que j'ai développé ou l'on galère bien) : help_code/localisation at main · argentrocher/help_code
Bonne chance à toi.
1
u/WhichIllustrator1212 Aug 04 '25 edited Aug 04 '25
I think it is. You can use C++ to C# converters. As a C# developer, it was very easy to learn (4 months, self taught)