Is it possible to make a Windows screensaver without Scrnsave.lib? - c++

I coded a Windows screensaver using C++/WinAPIs some time ago but now when I try it on Windows 8 at a logon screen (when no users are yet logged in) it doesn't seem to work. It is clearly a bug in Windows 8, because when I reboot the system my screensaver begins to work just fine. (Note that this behavior never happened on any previous version of Windows.)
What happens is that when the screensaver starts, the screen turns black and nothing happens after that moment. Obviously I can't debug it with the Visual Studio, so I added a trace statement into the first line where it should begin executing in WM_CREATE in ScreenSaverProc() but that line never gets called when the screensaver hangs up like I described above.
This tells me that some initialization code hangs up before the WM_CREATE message is sent, but to fix that I do not have access to that code because Microsoft's tutorial on WinAPI screensavers instructs to link to Scrnsave.lib (or ScrnsavW.lib in my case.)
So I was wondering, is there any way to build a WinAPI screensaver without using Scrnsave.lib?

Related

Understanding and managing c++ program crash handling in windows

I have a c++ program compiled with MinGW which links to libmicrohttpd to run a webserver. It normally functions correctly, but I am trying to do some robustness testing and for my current test I have tried to disable the network interface. This results in the program crashing with the dialog box: "MyProgram.exe has stopped working - A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available."
Rather than debug the program and potentially its dependencies, for my purposes, it would be fine if it would just crash silently without making the dialog box (I have another component that is meant to restart it). Is this possible to do via some sort of manifest or Windows API call?
It turns out there is a Windows API function called SetErrorMode. Passing the parameter SEM_NOGPFAULTERRORBOX will prevent the error dialog from being displayed on a crash.
There is also the RegisterApplicationRestart function which can be used to have Windows restart an application in the event of a crash (or other configurable reasons).

C++ application that uses Qt libraries stops working when screen saver starts

I have a C++ application that uses some Qt libraries.
The application works fine until the screen saver pops up and starts.
After that if I quit from screen saver the application crashes and I have to re-start it again. I have tested the application on Windows 7 and XP and this happens on both.
Is there anything I can change in the code so this does not happen?
Luca Carlon give you good and fairly popular advice -- use debugger. In your case, you can get a lot of information about debugging from official documentation.
When you run debug of your program, you must replay situation when your program falls: you must manually start screensaver, or hurry up screensaver to start.
When your program fails -- get back-trace, and try to understand, what was wrong.

How can I get more info from a crash error in windows 7?

The problem
There seems to be a problem with my application, because it crashes unexpectedly. I'm trying to solve the problem, but I have the following problem:
On Windows 7, when the application crashes, instead of getting some useful information about the crash, the following window appears:
The question
Is it possible to make Windows (7) show some actual useful information? Like a stack trace? Memory dump? A weird error code? Anything? I highly doubt Microsoft can help me here... in fact, checking for a solution to the problem never found a solution for any application, I don't know why this window even exists.
I remember that on Windows XP, there was that Error report window, and somewhere there was a link to another window which actually displayed some information.
What I tried
I tried to handle application crashes myself, using signal handling. However signal handling using MinGW seems to be pretty broken: writing to a null pointer should send a SIGSEGV signal, but the program crashed. Looking up on the internet, I found this thread which led me to believe that signal handling may be broken.
Using GDB with multiple threads is giving me a lot of trouble, since there is some time-sensitive stuff being done.
Other note(s)
I am working on Windows 7 (obviously), using the MinGW compiler suite, Eclipse IDE.
when this window appears, don't click Cancel. About 1 or 2 minutes later it will become another window that allow you choose a specified compiler(on my computer it's visual studio 2010) and debug.

How can I disable the Program Compatibility Assistant for my program in C++/Win32?

When my application exits, the Windows "Program Compatibility Assistant" appears. I want to not have that window appear when my application terminates.
This is the solution by my problem http://msdn.microsoft.com/en-us/library/dd371711(v=vs.85).aspx
I added custom manifest.
If you're seeing this dialog, one of two things can be happening:
Your program was detected as an installer, and Windows is offering to elevate the installer for you. There's little you can do about this, because this elevation check is heuristically determined by the filename. If your program contains "setup", "instal" (yes, a single l), or a few others in it's filename, the dialog will appear, and there's nothing you can do about it.
EDIT: Apparently there might be a way around this... see comments.
Alternately, you could be calling some API that is deprecated for the current version of Windows, or calling some API incorrectly, triggering compatibility heuristics. If this is the case, you just have to find the place in your program which is triggering the heuristic. You can use the Application Compatibility Toolkit (ACT) to determine what's triggering the dialog, IIRC.
There's no way to just "disable" this dialog -- you have to fix what's triggering it in the first place to make it go away.

Break point hangs DirectX-based program in full screen mode

I started making a game, I have a global class that reads in a csv file, loads two direct x surfaces, and creates the background.
the surfaces are a tile sheet and the other the background created from the tiles. the background surface does no work, after instillation I check it and if null a message box appears. It always shows the message box.
I tried setting break points to see if the values are read in corectly fron the csv file but the program will not run. a box appears in the task bar, the program goes full screen but the screen goes black and does not show the message box and can only be stopped by ctrl,alt,del.
No matter were I put the break point even if it is in a different source file this happens. does anyone know why ?
p.s it is not a multi thread application.
Edit:
I am using visual studio 2005 and direct x 9.c
With directshow, it can be bothering to debug in full screen : if you really have to do it, I suggest either using a second screen (this way, you can debug on your screen 1 while your program runs in full screen on your screen2).
If this doesn't work, you'll have to use remote debugging (i.e. run the programm on a computer and debug on another).
Most probably, what happens is that your debug point is triggerred, but your screen is held by directshow and thus visual can't be displayed. Thus your programm is actually blocked by visual, it doesn't answer to anything (as the event loop is blocked by the debugger)
In order, I would:
run in windowed mode
run in dual screen with your debugger on other screen
try to setup remote debug (good luck)
maybe use the old good way to debug with printf / traces (log4cpp e.g.)
In visual studio, if your project is not configured in debug mode (and instead is configured as release) you will not be able to debug, so any breakpoints you set will be ignored. This could possibly be the problem.
forced it in windowed mode , you may modified or hook the application