WinExec (Win10 shutdown & 'drive not ready')

Just starting out? Need help? Post your questions and find answers here.
User avatar
Michael Vogel
Addict
Addict
Posts: 2666
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

WinExec (Win10 shutdown & 'drive not ready')

Post by Michael Vogel »

Introduction
Since all the office computers have been updated to windows 10, sometimes the shutdown process shows and old looking dialog, which tells me that the (usb) drive is not ready. This happens just in around 1 of 20 cases and has to do with my purebasic written menu which was started from the usb memory stick and stays in the background.
I did some testing and added a callback routine to catch WM_QUERYENDSESSION now to end as quick as possible, but with no change. I believe now, that the usb drive gets disconnected and the active (default) drive still leads to the (now missing) drive letter...

So I'd like to check if the active drive will stay on 'C:' and how it could get manipulated. In earlier (DOS) days, there was a difference between the current directory (CD path) and the active drive (E:), purebasic has SetCurrentDirectory which combines these two actions...


And where is the question?
Maybe someone is able to tell me, why the following WinExec does not show a dialog when started? The compiled test.exe should be placed in the directory "C:\Somewhere" and copied onto the USB memory stick (for instance "E:\").

Code: Select all

If CountProgramParameters()
	OpenWindow(0,0,0,0,0,"")
	Repeat
	Until WindowEvent()=#Null
	MessageRequester(ProgramFilename(),ProgramParameter())
Else
	Path.s="C:\Somewhere\"
	SetCurrentDirectory(Path)
	WinExec_(#DOUBLEQUOTE$+"test.exe"+#DOUBLEQUOTE$+" "+#DOUBLEQUOTE$+"No Path"+#DOUBLEQUOTE$,#SW_SHOWNORMAL)
	Delay(100)
	WinExec_(#DOUBLEQUOTE$+Path+"test.exe"+#DOUBLEQUOTE$+" "+#DOUBLEQUOTE$+"Path"+#DOUBLEQUOTE$,#SW_SHOWNORMAL)
	Delay(100)
EndIf