C
C#11mo 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
Angius11mo 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
diedenieded11mo 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
Angius11mo 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
diedenieded11mo ago
The minimal APIs are part of ASP right?
Angius
Angius11mo ago
ye Just use dotnet new web to create the project, dotnet run to run it, and see what it does
diedenieded
diedenieded11mo ago
I'll try that in the morning, thanks
arion
arion11mo 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
diedenieded11mo ago
Thanks, I'll look into the library and the fallbacks you are using
Accord
Accord11mo 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
More Posts
❔ What is the best OCR engine for .NET?I was searching for the best OCR engine that could convert image to text or pdfsearchable..So, what ✅ Cannot figure out resolve issuehttps://github.com/mekasu0124/Diary I have attempted to resolve the issues in my 3 axaml pages. `/✅ How to resolve CS9017 when trying passing captured arguments by primary constructor to base class?I am using C# 12. The base class: ```csharp public class DbExtension(IOptionsMonitor<AppConfig> app❔ System.BadImageFormatException: Cannot load a reference assembly for execution.Hello, I'm trying to debug this exception in my C# app. I've tried solutions from stack overflow -❔ Suppressing ASP0001: AuthorizationMiddleware is incorrectly configuredI am hosting a Blazor server app and a Web API in the same ASP.NET project, and I have set up my rou❔ Spreadsheet option for a dict / class? (visual studio)I finally set a bunch of stuff up and their working correctly, huzah! Now, i have a dictionary that❔ Constant string value for discriminator using SwashbuckleI've spent hours Googling around and testing. I have a simple table-per-hierarchy pattern going on. ❔ Entity Framework 7 model property as enum is giving conflicts when running migrationI'm trying to create a many to many "pivot" model where it haves 2 fields "GroupId" and "Subscriptio❔ Is there a way to make this neater?``` public void AddTags(string tag) { Tags?.Add(tag); Tags = Tags; } ❔ Is it Possible to Consume a Queue Message by Multiple Consumers ( RabbitMQ & MassTransit ) ?Hi friends, I'm working on a project using `Microservices` architecture, I have `AuthService`, `Exp