I want to add function to my program to turn monitor off in Qt. I added this popular Winapi code from internet:
void MainWindow::on_Start_TurnOffMonitor_clicked()
{
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);
}
but while compiling I'm geting error:
mainwindow.obj:-1: error: LNK2019: unresolved external symbol __imp__SendMessageW@16 referenced in function "private: void __thiscall MainWindow::on_Start_TurnOffMonitor_clicked(void)" (?on_Start_TurnOffMonitor_clicked@MainWindow@@AAEXXZ)
How could I fix it?