Writing a Screensaver
-
So, I got a little bored and decided to create a desktop locker through the screensaver function of windows. I'm running XP and Dev C++ 4.9.9.2 and Dev is causing my problem. Other places I've checked said i would need to link "comctl32.lib" which I can't seem to locate on my computer or the internet for download. Incase it would be of any use I'll post my program code.
#include <iostream>
#include <windows.h>
#include <scrnsave.h>unsigned char new1;
using namespace std;LONG WINAPI ScreenSaverProc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)
{
// Handles screen saver messages
switch(message)
{
case WM_CREATE:
// Creation of the screen saver window
return 0;
case WM_ERASEBKGND:
// Erases the screen saver background
return 0;
case WM_TIMER:
uTimer = SetTimer(hwnd, 1, 1000, NULL);
// Handles the timer
return 0;
case WM_DESTROY:
KillTimer(hwnd, uTimer);
// Cleans up the screen saver window
PostQuitMessage(0);
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;
}I receive an error with the "uTimer = SetTimer(hwnd, 1, 1000, NULL);" line of code, but I'm assuming that its linked to the comctl32.lib considering I read scrnsave.h requires it; also the code compiles but does not work without the uTimer line.
-
So, I got a little bored and decided to create a desktop locker through the screensaver function of windows. I'm running XP and Dev C++ 4.9.9.2 and Dev is causing my problem. Other places I've checked said i would need to link "comctl32.lib" which I can't seem to locate on my computer or the internet for download. Incase it would be of any use I'll post my program code.
#include <iostream>
#include <windows.h>
#include <scrnsave.h>unsigned char new1;
using namespace std;LONG WINAPI ScreenSaverProc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)
{
// Handles screen saver messages
switch(message)
{
case WM_CREATE:
// Creation of the screen saver window
return 0;
case WM_ERASEBKGND:
// Erases the screen saver background
return 0;
case WM_TIMER:
uTimer = SetTimer(hwnd, 1, 1000, NULL);
// Handles the timer
return 0;
case WM_DESTROY:
KillTimer(hwnd, uTimer);
// Cleans up the screen saver window
PostQuitMessage(0);
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;
}I receive an error with the "uTimer = SetTimer(hwnd, 1, 1000, NULL);" line of code, but I'm assuming that its linked to the comctl32.lib considering I read scrnsave.h requires it; also the code compiles but does not work without the uTimer line.
Suposedly comctl32.lib comes with Microsoft's Platform SDK (you can download that from the MS site), i checked on my system and it sits in "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib" (yes, yes, i am still using VS2003, so sue me :) ), so the platform SDK thing seems to be right. No idea if you can use that with Dev C++ or not...
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
-
So, I got a little bored and decided to create a desktop locker through the screensaver function of windows. I'm running XP and Dev C++ 4.9.9.2 and Dev is causing my problem. Other places I've checked said i would need to link "comctl32.lib" which I can't seem to locate on my computer or the internet for download. Incase it would be of any use I'll post my program code.
#include <iostream>
#include <windows.h>
#include <scrnsave.h>unsigned char new1;
using namespace std;LONG WINAPI ScreenSaverProc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam)
{
// Handles screen saver messages
switch(message)
{
case WM_CREATE:
// Creation of the screen saver window
return 0;
case WM_ERASEBKGND:
// Erases the screen saver background
return 0;
case WM_TIMER:
uTimer = SetTimer(hwnd, 1, 1000, NULL);
// Handles the timer
return 0;
case WM_DESTROY:
KillTimer(hwnd, uTimer);
// Cleans up the screen saver window
PostQuitMessage(0);
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;
}I receive an error with the "uTimer = SetTimer(hwnd, 1, 1000, NULL);" line of code, but I'm assuming that its linked to the comctl32.lib considering I read scrnsave.h requires it; also the code compiles but does not work without the uTimer line.
SetTimer is linked in via user32.dll, not the common controls library. Do you have any of the Windows Platform SDKs installed? (I'm not sure what Dev C++ comes with as far as built-in libraries...)
Adam Maras | Software Developer Microsoft Certified Professional Developer
-
SetTimer is linked in via user32.dll, not the common controls library. Do you have any of the Windows Platform SDKs installed? (I'm not sure what Dev C++ comes with as far as built-in libraries...)
Adam Maras | Software Developer Microsoft Certified Professional Developer
No I don't have the SDK platforms, I have VS2008 on another computer or older harddrive somewhere but I have no idea which one and don't exactly prefer using VS over Dev.