Important: Please read the Qt Code of Conduct -

Problem - Windows Screensaver

  • Hello guys

    I want to make a Windows Screensaver application. I want to change screensaver from list on my app. Firstly, I got the DefScreenSaverProc function don't declare error. Than I added the pro file some codes (pro file => line 27-36) to declare scrnsave.h. Secondly I got the error below.

    @Makefile.Debug:79: error: multiple target patterns. Stop.@

    • How can i fix that error?
    • Does this code work? There are a lot of way to do that program. I can use OpenGL, Win API etc. I know WinAPI more than OpenGL. So I should make with Win API.

    Additionally, I use Qt Creator 3.0 and Qt 5.2
    I use Qt Android 5.2 version but I use "Desktop Qt 5.2 MinGw 32Bit" Kit

    pro file;

    Project created by QtCreator 2014-06-27T12:36:36


    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = WindowsScreenSaver_2
    TEMPLATE = app

    SOURCES += main.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui

    #win32: LIBS += -lscrnsave

    win32: LIBS += -L$$PWD/C:/Qt/Qt5.2.0/Tools/mingw48_32/i686-w64-mingw32/lib/ -lscrnsave

    INCLUDEPATH += $$PWD/C:/Qt/Qt5.2.0/Tools/mingw48_32/i686-w64-mingw32/include
    DEPENDPATH += $$PWD/C:/Qt/Qt5.2.0/Tools/mingw48_32/i686-w64-mingw32/include

    #win32:!win32-g++ PRE_TARGETDEPS += $$PWD/C:/Qt/Qt5.2.0/Tools/mingw48_32/i686-w64-mingw32/lib/scrnsave.lib

    win32:!win32-g++: PRE_TARGETDEPS += $$PWD/C:/Qt/Qt5.2.0/Tools/mingw48_32/i686-w64-mingw32/lib/scrnsave.lib
    else:win32-g++: PRE_TARGETDEPS += $$PWD/C:/Qt/Qt5.2.0/Tools/mingw48_32/i686-w64-mingw32/lib/libscrnsave.a

    @#include "mainwindow.h"
    #include "ui_mainwindow.h"

    #include <windows.h>
    #include <scrnsave.h>

    LONG WINAPI ScreenSaverProc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)
    // Handles screen saver messages
    case WM_CREATE:
    // Creation of the screen saver window
    return 0;
    // Erases the screen saver background
    return 0;
    case WM_TIMER:
    // Handles the timer
    return 0;
    case WM_DESTROY:
    // Cleans up the screen saver window
    return 0;
    return DefScreenSaverProc(hwnd,message,wparam,lparam);

    BOOL WINAPI ScreenSaverConfigureDialog(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)
    return true;
    BOOL WINAPI RegisterDialogClasses(HANDLE hmodule)
    return true;

    MainWindow::MainWindow(QWidget *parent) :
    ui(new Ui::MainWindow)

    delete ui;

Log in to reply