Is it possible to send Toast notification from console application?

At first you need to declare that your program will be using winRT libraries: Right-click on your yourProject, select Unload Project Right-click on your yourProject(unavailable) and click Edit yourProject.csproj Add a new property group:<targetplatformversion>8.0</targetplatformversion> Reload project Add reference Windows from Windows > Core Now you need to add this code: using Windows.UI.Notifications; and you will … Read more

Handle CTRL+C on Win32

The following code works for me: #include <windows.h> #include <stdio.h> BOOL WINAPI consoleHandler(DWORD signal) { if (signal == CTRL_C_EVENT) printf(“Ctrl-C handled\n”); // do cleanup return TRUE; } int main() { running = TRUE; if (!SetConsoleCtrlHandler(consoleHandler, TRUE)) { printf(“\nERROR: Could not set control handler”); return 1; } while (1) { /* do work */ } return … Read more

How do I get a return value from Task.WaitAll() in a console app?

You don’t get a return value from Task.WaitAll. You only use it to wait for completion of multiple tasks and then get the return value from the tasks themselves. var task1 = GetAsync(1); var task2 = GetAsync(2); Task.WaitAll(task1, task2); var result1 = task1.Result; var result2 = task2.Result; If you only have a single Task, just … Read more