Most likely the "device not open" message is being output when you call `.exists()` on the file, followed by your qDebug.
On Wed, Dec 6, 2017 at 6:23 PM, Emre Besirik <nome...@gmail.com> wrote: > >> On 5 Dec 2017, at 18:39, Thiago Apperantly <thiago.macie...@intel.com> wrote: >> >> On Tuesday, 5 December 2017 03:26:41 PST Emre Besirik wrote: >>> Hello list, >>> QFile fails on Windows when screen is locked with message "device not open”? >>> And it is on new QFile(“somefile.txt”) not on file.open(ReadOnly). >> >> Your analysis cannot be right. The QFile creation does not touch the file or >> even tell the operating system about the file until you try to open. There >> are >> no system calls until then. >> >> -- >> Thiago Macieira - thiago.macieira (AT) intel.com >> Software Architect - Intel Open Source Technology Center >> >> _______________________________________________ >> Interest mailing list >> Interest@qt-project.org >> http://lists.qt-project.org/mailman/listinfo/interest > > > Apparently the problem was where and by whom it was called. It was being > called from a callback funtion for EnumDisplayMonitors and when station is > locked it does not work, and it does indeed fail on new QFile(“some.txt”) > line, that I’m sure of it because the next line is > if(!file.exists()) qDebug() << “File Does not exist”; > and it outputs “device not open” before “File Does not exist”. > So it fails on new QFile(“some.txt”) > > Best Regards, > Emre Besirik > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest -- Shantanu Tushar (UTC +0530) shantanu.io _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest