Quote
"John Bowes" <jbowe...@comcast.nospam.net> wrote in message
news:cBSo8.109703$7b.10125654@bin7.nnrp.aus1.giganews.com...
Quote
> Thanks,
> This seems to work just fine.
> Just to make sure I understand what's going on, the key is to save the
> console window handle and it's Window/Full Screen state before using
> the Open File dialog and afterwards see if the foreground window is
> different from before. Then if it was full screen, fake an
> Alt-Enter to toggle between Window/Full Screen.
That was the idea, nothing wrong with a bit of manual control.
I used this when in a hurry unable to find which API calls would work plus
winsight kept crashing so I found a quick and dirty way ;-(
Looking at the code again I remembered there was a problem in that
normally it worked but if you moved or sized the dialog or closed without a
selection
it sometimes didn't restore to fullscreen correctly
despite indicating that the status and window were correct
Now, playing with it a little more showed pounding the window with restores
worked
so assuming it was a timing thing tried this , which seems to work
without the arm waving
maybe a wait for something would be better but this is simpler ;-)
w:=getforegroundwindow;
wasfullscreen:=isiconic(w);
d:=topendialog.create(nil);
res:= d.Execute;
if wasfullscreen then
begin
setforegroundwindow(w);
//sleep(50);
sleep(250); // just being conservative didn't see errors with 50
showwindow(w,SW_RESTORE);
//showwindow(w,SW_RESTORE); // two usually worked three always
//showwindow(w,SW_RESTORE);
end;
if res then
begin
writeln(d.filename);
exitcode:=0;
end
else
begin
writeln('dialog aborted');
exitcode:=1;
end;
d.free;
unfortunately you still have to test for fullscreen
sending a restore to a windowed dosbox makes it toggle the zoom
( NOW I fancy I saw something with isiconic not always working, but that
could be faulty memory..or dreaming about the problem after collapsing into
bed..
I didn't see any just now, just a note if you see problems)
a windowed box is
not iconic (-6,-6,x,y)
zoomed ( zoomed means normal size)
a GUIwindowed box is
not iconic (66,66,x,y);
not zoomed
a fullscreen DOSbox is
iconic (3000,3000,x,y)
not zoomed
@echo off
CONSOL~1 EXE
if errorlevel 1 goto aborted
echo okay
goto endit
:aborted
echo aborted
:endit