There is an article here on Code Project that is specific to this task. It is in C++ though: Determining the Monitor's On/Off (sleep) Status
Otherwise, here is a Google Search with a number of helpful possibilities: how to get the windows monitor on/off power state api - Google Search
I stopped using VB6 a couple of decades ago, so I can not check the following for you. A 3rd option is to ask ChatGpt to write the code for you. Here is the question to ask:
Determining the Monitor's On/Off (sleep) Status using VB6
Then after asking the first question, use the following:
use POWERBROADCAST to receive notifications when the power status changes
ChatGpt can be more wrong than right. The code it generated appears to be okay and worth a try.
After Dave's comment below, I have been doing some digging and have come to the conclusion that there are no Windows APIs that support modern monitors to detect power status change.
There was a Microsoft WindowsAPICodePack
that included Monitor On
support, amongst many other things. However Microsoft pulled it and removed all traces of it.
If you want to check it out, here is the discussion: Check if display is turned off by windows power management | StackOverflow
] and following the links in the threads, points you to a copy of the original repo: GitHub - dbarros/WindowsAPICodePack: A fork of the Windows API Code Pack with additional fixes and features by yours truly.