Recent

Author Topic: More problems file dialogs Win 7  (Read 4437 times)

BeaglePi

  • New Member
  • *
  • Posts: 32
More problems file dialogs Win 7
« on: January 10, 2019, 06:26:01 am »
Hi

I have a large program running under Windows 7 Pro.  It locks when I open a file open or save dialog.  The task manager shows that the program is running away (close to 100% usage).  It does this in the IDE with debugger, in the IDE without debugger and outside the IDE!  On every one of the dialogs.

I've got rid of a few of them by writing my own basic dialogs but it's an unsatisfactory solution.

I tried ticking the box for the old style dialog but then the main form switches instantly from the second screen to the first one, at which point it pushes the form size buttons off the edge.  So that is a bit troublesome!

I wondered whether the dialog was trying to search the network for devices or something.  I'm at a uni so there's a lot out there ...

Lo and behold, when I turned off wireless, the dialogs work fine.  So how can I stop a dialog box searching the hetwork?

Thanks!  (And I hope that this info helps some other troubled person ...)

CCRDude

  • Hero Member
  • *****
  • Posts: 596
Re: More problems file dialogs Win 7
« Reply #1 on: January 10, 2019, 07:09:44 am »
Isolate the problem!

Does this problem exist if you have the same open dialog in a stand-alone test application with nothing but a form and a button that triggers the open dialog? Compare dialog properties. If stand-alone doesn't trigger the issue, try giving the stand-alone the same filename (for testing the registry thing mentioned below).

Does your project have a manifest? Experiment in the stand-alone test with vs. without manifest.

Since the dialog are afaik wrappers around the system dialogs, do other programs show the same?

Does this happen on one machine only? Check the registry - the system dialogs store some settings (not sure where, but you'll probably find it by just searching by process name without path). Might be that during a previous use, you used the dialog to browse a network drive that is now unavailable, and it now wants to restore that location as default. See if you can avoid the problem by manually specifying a default location for the dialogs.

Use ProcMon from SysInternals to check what the dialog is doing.

BeaglePi

  • New Member
  • *
  • Posts: 32
Re: More problems file dialogs Win 7
« Reply #2 on: January 10, 2019, 09:24:45 am »
I'm working on it.

I may have been wrong about the network as it's started blocking again!

BeaglePi

  • New Member
  • *
  • Posts: 32
Re: More problems file dialogs Win 7
« Reply #3 on: February 13, 2019, 08:31:15 am »
Hi Folks

Well, I still haven't fixed my stalling when I open a file dialog.  I've attached a screen shot.

The program never gets to the last breakpoint - it's stuck in ADialog.show using all the CPU.  It will eventually unstick but then as soon as I try to change a directory or select a file it hangs again.

I tried replacing it with a Select Directory dialog and it does the same thing.

Has anybody come across this before?  I'm making no headway with it.

Thanks.

jamie

  • Hero Member
  • *****
  • Posts: 6091
Re: More problems file dialogs Win 7
« Reply #4 on: February 13, 2019, 11:24:05 pm »
Can you show a few lines on how you create the dialog and call it ?
The only true wisdom is knowing you know nothing

ASerge

  • Hero Member
  • *****
  • Posts: 2223
Re: More problems file dialogs Win 7
« Reply #5 on: February 13, 2019, 11:58:23 pm »
I'm working on it.
In new application put TOpenDialog to form and test it by context menu (Test dialog...) with different options.

BeaglePi

  • New Member
  • *
  • Posts: 32
Re: More problems file dialogs Win 7
« Reply #6 on: February 14, 2019, 12:20:24 am »
Hi Jamie

I drop the OpenDialog onto the form.

Then:

if not opendialog1.execute then
 begin
  //Deal with file name not selected
 end ;

So not a lot of room for variation!

Can I chuck a question in here: when the dialog freezes, the Task Manager shows my executable using all the cycles?  Would that happen if it were really freezing somewhere in the Windows code as my clip suggests?

Hil

BeaglePi

  • New Member
  • *
  • Posts: 32
Re: More problems file dialogs Win 7
« Reply #7 on: February 14, 2019, 02:02:39 am »
Hi ASerge

I tested my dialog in the context menu in my program and it had no problems.

SO ... I'm leaning toward wondering if I have something like a circular redraw event or something on one of my components.  I think that I'll have to burrow into my code more and look for something there - something that might be triggered by the dialog box coming up.

ASBzone

  • Hero Member
  • *****
  • Posts: 678
  • Automation leads to relaxation...
    • Free Console Utilities for Windows (and a few for Linux) from BrainWaveCC
Re: More problems file dialogs Win 7
« Reply #8 on: February 14, 2019, 02:35:07 am »
if not opendialog1.execute then
 begin
  //Deal with file name not selected
 end ;


Showing some more code might be helpful.


When did the problem begin, btw?
-ASB: https://www.BrainWaveCC.com/

Lazarus v2.2.7-ada7a90186 / FPC v3.2.3-706-gaadb53e72c
(Windows 64-bit install w/Win32 and Linux/Arm cross-compiles via FpcUpDeluxe on both instances)

My Systems: Windows 10/11 Pro x64 (Current)

BeaglePi

  • New Member
  • *
  • Posts: 32
Re: More problems file dialogs Win 7
« Reply #9 on: February 14, 2019, 04:58:49 am »
Hi ASBZone

The program used to run fine, and an older version driving a more complicated machine (two lasers instead of one), ran fine.  I can't put my finger on a specific point because I butchered and rewrote a lot of the code before it was in a state to run again.

The older version had one LazSerial, this one has two - one speaks to a laser and the other to an Arduino Mega.  BUT I kill the timers driving the serial components before calling the dialog and it makes no apparent difference. 

Umm, code ....  I think that there are 10,000 to 20,000 lines .  A lot anyway.  Until I narrow it down a bit, that's probably beyond what you want to see!  ;-)

Cyrax

  • Hero Member
  • *****
  • Posts: 836
Re: More problems file dialogs Win 7
« Reply #10 on: February 14, 2019, 01:08:38 pm »
Is your program 32-bit or 64-bit? If you are targeting 32-bit system, you probably need to compile FPC from sources (FPC trunk or FPC 3.2.x from fixes_3_2 branch) with -dTEST_WIN32_SEH flag enabled.

3.0.x series do not have 32-bit SEH exception handling capabilities at all.  Only 64-bit SEH is supported.

If program can't handle SEH exceptions correctly (it doesn't need to have to raise a exception. If there is a exception handler installed in the callee subroutine and caller doesn't have support for SEH, there is high change that stack will be corrupted) , there will be strange bugs and crashes may occur. Like you have noticed when using the dialog components. The dialog components  uses Windows COM/ActiveX interfaces to display the dialog and COM/ActiveX needs the SEH exception handling mechanism to be correctly set up.

BeaglePi

  • New Member
  • *
  • Posts: 32
Re: More problems file dialogs Win 7
« Reply #11 on: February 18, 2019, 04:29:28 am »
Sorry that I haven't replied - I've been away from computers.

However - I was having problems with serial comms.  I have posted a response in the LazSerial thread, but in short it seems that at least on my system, two LazSerial components (or the underlying synaser) do NOT cooperate.  They were freezing at intervals until I removed one component.  And now that I have only one serial component the dialogs work fine as well.

Thanks Cyrax, but at least at the moment the dialogs are working.  If they go belly-up again then I'll look at the 32/64 bit issue.

ASBzone

  • Hero Member
  • *****
  • Posts: 678
  • Automation leads to relaxation...
    • Free Console Utilities for Windows (and a few for Linux) from BrainWaveCC
Re: More problems file dialogs Win 7
« Reply #12 on: February 18, 2019, 05:25:42 am »
Thanks for following up.


Let us know if it does go crazy again.  :D
-ASB: https://www.BrainWaveCC.com/

Lazarus v2.2.7-ada7a90186 / FPC v3.2.3-706-gaadb53e72c
(Windows 64-bit install w/Win32 and Linux/Arm cross-compiles via FpcUpDeluxe on both instances)

My Systems: Windows 10/11 Pro x64 (Current)

 

TinyPortal © 2005-2018