C
C#16mo ago
diedenieded

✅ Opinions on Node.js + C++ vs C# for app that accesses the win32 API

Hello all. I'm working on an app that can control the volume of applications through a web interface, and I'm having a hard time deciding what backend stack I should use. As written in the title, I'm deciding between using Node.js to handle the web stuff and C++ via Node's C++ addons to handle the win32 stuff, or do handle both tasks in C# (and ASP.NET?). I've come up with some pros and cons for each approach. Node + C++: + Plenty of win32 examples and documentation on the C++ side + Plenty of web examples and documentation on the Node.js side + About 40% of the API required for the app for win32 already implemented in C++ + I'm familiar with JavaScript - Complexity in Node/C++ interoperability - Zero knowledge and experience with Node's C++ addons - Not very good at C++ C#: ++ Less complexity (?) as win32 and web stuff are handled on the same codebase + Willing to learn C# if necessary - I'm new to C# - I have not found any documentation or code samples for win32 in C# - Plenty of questions Here are the questions about using C#: - Does C# natively support win32 API / Core Audio? From the scraps of documentation and examples I've seen, it seems that you have to use some sort of wrapper to be able to use the Core Audio API. There's no point in using C# if this is the case, but I'm open to thoughts. - If it does support it natively, please help me by linking me to some related documentation. All the Google searches I've done lead to examples that are done in C++. - Are the terms C# and .NET interchangeable for doing Google searches? - What is ASP.NET, and will I need it? The app is expected to serve a static page, and most of the communication will be done through WebSockets. I'm glad to answer any additional questions you may have that are going to help me decide between the two choices, and I'm thankful for any input on this topic. The app is also in a very early stage, so suggestions for radical changes (etc. using Python) are also welcome. Thanks in advance.
9 Replies
Angius
Angius16mo ago
* I believe CoreAudio is only exposed to C++, if you wanted to use it with C# you'd need either a wrapper, or to PInvoke all of it. It seems, though, someone already made a wrapper: https://github.com/morphx666/CoreAudio * Yes, for the most part you can treat C# and .NET as two parts of the same whole/interchangeable terms. Kinda like Javascript and Node. * ASP.NET is a web framework, encompassing everything from SSR and APIs, to WASM-based SPAs Also, I see there's an official source generator for generating whatever Win32 wrappers you might need: https://github.com/microsoft/CsWin32 At least at a glance, haven't used it
diedenieded
diedeniededOP16mo ago
PInvoke seems like the way to go. Also, do you need ASP.NET to serve static web pages and talk to them via WebSockets, or is it doable in plain .NET? Thanks, I'll take a look at this.
Angius
Angius16mo ago
You could use a HttpListener, but ASP makes it so much easier You could use Minimal APIs for example, to just serve static files and set up the ws connection If you're familiar with Express, it's similar
diedenieded
diedeniededOP16mo ago
The minimal APIs are part of ASP right?
Angius
Angius16mo ago
ye Just use dotnet new web to create the project, dotnet run to run it, and see what it does
diedenieded
diedeniededOP16mo ago
I'll try that in the morning, thanks
arion
arion16mo ago
CoreAudio is nice since it allows you to set up callbacks to have a reactive ui for audio changes. You don't necessarily need to go the PInvoke route since the CoreAudio lib that ZZZZZZZZZZZZZZZZZZZZZZZZZ recommended is licensed under MIT 1 issue I consistently have gripes with in CoreAudio itself is the misleading "DisplayName" property The normal Windows VolumeMixer doesn't use that but rather a series of fallbacks for the process which is not exposed via an api from what I could tell. Some of the fallbacks i used in my program include - That dreaded display name property (if not null) - process.MainWindowTitle (if not null) - The process' FileDescription (if not ProcessName)
diedenieded
diedeniededOP16mo ago
Thanks, I'll look into the library and the fallbacks you are using
Accord
Accord16mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server