PDA

View Full Version : No DialogEx.Close


Guy Danneels
10-20-2008, 04:14 PM
Hi all,

when I use this code, the Office program does open the file,
but the Dialog won't close...
I'm I doing something wrong?

File.Open("C:\\TOOLS\\EigenTEKST.rtf", "", SW_SHOWNORMAL);
Result = DialogEx.Close(0);

HMMurdock
10-20-2008, 07:09 PM
I could be wrong, as I don't have the latest version yet, but I believe that DialogEx.Close is used for a Dialog Windows that is created by a DialogEX function.

I wouldn't expect it to have any effect at all on a regular window.

Dermot
10-21-2008, 03:34 AM
Confirmed here. I think the problem is that the dialog loses focus and once that happens, no more code is executed. This focus problem was reported in another thread.

RizlaUK
10-21-2008, 05:10 AM
i had found a bug in the dialog, but in all my tests i could always close the dialog window and useing the code like below

File.Open("AutoPlay\\Docs\\-20070416.log", "", SW_SHOWNORMAL);
Result = DialogEx.Close(0);

it opens the log file and the dialog closes with no problems

Dermot, you have confirmed this bug but it works fine for me, on what system did you test, i tested on Vista home premium

below is the apz i used to test

RizlaUK
10-21-2008, 05:19 AM
scrap that, i changed the code to

File.Open("AutoPlay\\Docs\\-20070416.log", "", SW_SHOWNORMAL);
Application.Sleep(1000)
Result = DialogEx.Close(0);
result = Dialog.Message("Notice", "Your message here.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);


and now it dose not close the dialog at all, but the message dialog dose show ok, so the code is still getting executed, its the DialogEx.Close that is not executeing if the dialog loses focus, i will report this as a seprate bug

HMMurdock
10-21-2008, 06:49 AM
Ahhh... I misunderstood the question... I thought he was trying to use the DioalogEX.Close to close the window with the RTF file. (instead of the Dialog that had the "open" button for the RTF file)

Seems, smarter people than I, are already on the case.... carry on gentlemen.

Guy Danneels
10-21-2008, 05:28 PM
Hello guys,
thanks for the thinking and efforts.

Very strange... it works when I take another file to open, like:

File.Open("AutoPlay\\Docs\\Letters.TXT", "", SW_SHOWNORMAL);
Result = DialogEx.Close(0);

(Here the file is opened by f.e. Editpad Lite)


It does NOT work when Office (=Word) opens a file, as in my first example.

RizlaUK
10-21-2008, 07:35 PM
yes, it worked for me useing notepad, but if there is a delay and the dialog loses focus before the close command then it fails, notepad and editpad both load quicker than word so the File.Open is executed faster and it jumps right on to the close command before it loses focus, simulate a lodeing delay with Application.Sleep and it will fail.

Mark
10-21-2008, 07:58 PM
Hi Everyone,

This is he result of a bug in the dialog code that is causing problems when the dialog looses focus.

We're on the case and hopefully we'll have a fix out for everyone shortly.

Thanks for your patience.