# Application crashing when open file dialog is opened

**URL:** <https://clarionhub.com/t/application-crashing-when-open-file-dialog-is-opened/6257>\
**Category:** questions\
**Tags:** crash, windows, c10\
**Created:** [May 21, 2023, 9:47pm UTC](https://clarionhub.com/t/application-crashing-when-open-file-dialog-is-opened/6257 "2023-05-21T21:47:47Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marc\_Brierley](https://clarionhub.com/letter_avatar_proxy/v4/letter/m/9dc877/32.png) [@Marc\_Brierley](https://clarionhub.com/u/Marc_Brierley)\
**Post date:** [May 21, 2023, 9:47pm UTC](https://clarionhub.com/t/application-crashing-when-open-file-dialog-is-opened/6257/1 "2023-05-21T21:47:47Z")

</div>

Kia Ora folks

My C10 apllication has started crashing randomly when the the file  
dialogue box pops up for users to select a csv file.

Has anyone encountered this?

Marc

---

<div class="post-metadata">

**Author:** ![seanh](https://clarionhub.com/letter_avatar_proxy/v4/letter/s/4af34b/32.png) [@seanh](https://clarionhub.com/u/seanh)\
**Post date:** [May 21, 2023, 11:32pm UTC](https://clarionhub.com/t/application-crashing-when-open-file-dialog-is-opened/6257/2 "2023-05-21T23:32:42Z")

</div>

Is there a parameter used? and is the same definition used on both sides?  
I had something like this recently that ended up being the parameter list and prototype being all out of whack.

---

<div class="post-metadata">

**Author:** ![anon51095673](https://clarionhub.com/letter_avatar_proxy/v4/letter/a/f9ae1b/32.png) [@anon51095673](https://clarionhub.com/u/anon51095673)\
**Post date:** [May 22, 2023, 6:18am UTC](https://clarionhub.com/t/application-crashing-when-open-file-dialog-is-opened/6257/3 "2023-05-22T06:18:45Z")

</div>

bonjour

if code is inside a Modal Event and it calls a windows dialog you may find it does not behave as expected. Check the help on that one its lists the events it effects and states not to call any windows dialogs.

cest la vie

---

<div class="post-metadata">

**Author:** ![MarkGoldberg](https://clarionhub.com/user_avatar/clarionhub.com/markgoldberg/32/1511_2.png) [@MarkGoldberg](https://clarionhub.com/u/MarkGoldberg)\
**Post date:** [May 22, 2023, 4:06pm UTC](https://clarionhub.com/t/application-crashing-when-open-file-dialog-is-opened/6257/4 "2023-05-22T16:06:28Z")

</div>

I hesitate to mention my experience - because I never figured out WHY it was a problem.  
It didn’t (and still doesn’t) make any sense to me.

I wrote code that would dim a window when another window on the same thread was called.  
I accomplished this by using **SYSTEM{PROP:OpenWindowHook}**  
and CREATE()ing a REGION which I made semi-transparent using the API call **SetLayeredWindowAttributes**

I had it working, and I thought it looked pretty good.  
But we found that FILEDIALOG would crash when it was turned on  
and FILEDIALOG was fine when it was turned off.

---

<div class="post-metadata">

**Author:** ![Marc\_Brierley](https://clarionhub.com/letter_avatar_proxy/v4/letter/m/9dc877/32.png) [@Marc\_Brierley](https://clarionhub.com/u/Marc_Brierley)\
**Post date:** [June 21, 2023, 5:21am UTC](https://clarionhub.com/t/application-crashing-when-open-file-dialog-is-opened/6257/5 "2023-06-21T05:21:05Z")

</div>

Hi Sean.  
Can you elaborate on what you said please? I don’t understand what you mean by ‘the same definition on both sides’.

Marc

---

<div class="post-metadata">

**Author:** ![seanh](https://clarionhub.com/letter_avatar_proxy/v4/letter/s/4af34b/32.png) [@seanh](https://clarionhub.com/u/seanh)\
**Post date:** [June 21, 2023, 5:37am UTC](https://clarionhub.com/t/application-crashing-when-open-file-dialog-is-opened/6257/6 "2023-06-21T05:37:27Z")

</div>

Sure. In my case the procedure prototype and the procedure parameters were different.  
I can’t remember exactly what went on now, but I remember just having to make them the same and that fixed my problem.  
I’ve certainly had problems in the past with that sort of thing with multi dll where the prototypes and params in different dlls were out of sync. Can cause all sorts of fun.

---

<div class="post-metadata">

**Author:** ![e\_mano\_e](https://clarionhub.com/letter_avatar_proxy/v4/letter/e/c77e96/32.png) [@e\_mano\_e](https://clarionhub.com/u/e_mano_e)\
**Post date:** [June 21, 2023, 7:35pm UTC](https://clarionhub.com/t/application-crashing-when-open-file-dialog-is-opened/6257/7 "2023-06-21T19:35:44Z")

</div>

@MarkGoldberg

_\> I wrote code that would dim a window when another window on the same thread was called._  
_\> I accomplished this by using **SYSTEM{PROP:OpenWindowHook}** _  
_\> and CREATE()ing a REGION which I made semi-transparent using the API call **SetLayeredWindowAttributes** _  
\*\> \*  
_\> I had it working, and I thought it looked pretty good._  
_\> But we found that FILEDIALOG would crash when it was turned on_  
_\> and FILEDIALOG was fine when it was turned off._

Dimming a window when another window within the same thread opens is exactly what I always wanted try to implement. I thought about this many times but didn’t find an easy way to do this.  
Are you willing to share your code?  
Maybe you could send me a small example which shows the crash.  
I would test it on my site (using Clarion 8 or Clarion 11.1).

Jens

---

<div class="post-metadata">

**Author:** ![Marc\_Brierley](https://clarionhub.com/letter_avatar_proxy/v4/letter/m/9dc877/32.png) [@Marc\_Brierley](https://clarionhub.com/u/Marc_Brierley)\
**Post date:** [June 22, 2023, 2:40am UTC](https://clarionhub.com/t/application-crashing-when-open-file-dialog-is-opened/6257/8 "2023-06-22T02:40:39Z")

</div>

I understand now.  
Everything appears fine to me.  
I’m wondering if the environment might be playing a part.  
I’ll keep looking.  
If you have any other ideas please sing out.  
Marc

---

<div class="post-metadata">

**Author:** ![Mike\_Duglas](https://clarionhub.com/user_avatar/clarionhub.com/mike_duglas/32/1061_2.png) [@Mike\_Duglas](https://clarionhub.com/u/Mike_Duglas)\
**Post date:** [June 22, 2023, 6:48am UTC](https://clarionhub.com/t/application-crashing-when-open-file-dialog-is-opened/6257/9 "2023-06-22T06:48:11Z")

</div>

> [@e\_mano\_e](#):
>
> Dimming a window when another window within the same thread opens is exactly what I always wanted try to implement.

This is an implementation using another approach:  
[test.clw](https://clarionhub.com/uploads/short-url/raE5Hln7pN2pWYjPU4lcQRv98gm.clw) (2,8 КБ)

---

<div class="post-metadata">

**Author:** ![CarlBarnes](https://clarionhub.com/user_avatar/clarionhub.com/carlbarnes/32/1859_2.png) [@CarlBarnes](https://clarionhub.com/u/CarlBarnes)\
**Post date:** [July 3, 2023, 5:10pm UTC](https://clarionhub.com/t/application-crashing-when-open-file-dialog-is-opened/6257/10 "2023-07-03T17:10:48Z")

</div>

> [@Marc\_Brierley](#):
>
> My C10 apllication has started crashing randomly when the the file dialogue box pops up for users to select a csv file.

> [@Marc\_Brierley](#):
>
> If you have any other ideas please sing out.

I’m catching up from being gone. Your original post contains no information to help solve your problem.

You should post the code you use to call the FileDialog() from your program. Often the Code has a bug, without seeing code cannot help.

Do you get a crash / exception window? Post a screen capture as it shows codes.

Check the Windows Event Viewer. It sometimes will show a logged event from the OS. This is especially useful if the program just shuts down without an exception window.

The [Common Dialogs do have a Get Last Error code](https://learn.microsoft.com/en-us/windows/win32/api/commdlg/nf-commdlg-commdlgextendederror) function that is useful when it does not display, but that’s not going to help a crash. Possibly when it is working there is an error code.

---

<div class="post-metadata">

**Author:** ![Marc\_Brierley](https://clarionhub.com/letter_avatar_proxy/v4/letter/m/9dc877/32.png) [@Marc\_Brierley](https://clarionhub.com/u/Marc_Brierley)\
**Post date:** [July 26, 2023, 10:42pm UTC](https://clarionhub.com/t/application-crashing-when-open-file-dialog-is-opened/6257/11 "2023-07-26T22:42:44Z")

</div>

Hi Carl

You’re are correct. It was a bit light on information.

Below is a crash window that pops up.

The application calls filedialog in a few places but in others it uses the DOSFileLookup control which I think calls filedialog (I’ve tried filedialogA but same issue).

This is an example of code which is calling filedialog.

```auto
LOC:DataPath = GetSetting('CWDImportFilePath','H:\')
LOC:PickScreenMessage = 'Select CWD Import File'
IF FILEDIALOGA(CLIP(LOC:PickScreenMessage),LOC:DataPath,,1010010b)
ELSE
    CLEAR(LOC:DataPath)
END

```

![image.png](https://mail.google.com/mail/u/1?ui=2&ik=c9d9c3be36&attid=0.1&permmsgid=msg-a:r-110114987449988154&th=18960802513d8ab1&view=fimg&fur=ip&sz=s0-l75-ft&attbid=ANGjdJ-bQxElZt24vuwD64Dqo3D7-DqlqW6-NgUC0mqETSvezOeYHrsPeHdHN7xWWmivRlm7p2SR0ekn_pWE1IHX6rMmkxIm9MzdOp-JMTgPR8iGjMaS1qH1oRkNPbw&disp=emb&realattid=ii_lk5wwt910)

**Nga mihi**

**Marc Brierley**

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [July 26, 2023, 10:50pm UTC](https://clarionhub.com/t/application-crashing-when-open-file-dialog-is-opened/6257/12 "2023-07-26T22:50:01Z")

</div>

Hello Marc - Your image was not properly attached. Looks like a gmail link.

---

<div class="post-metadata">

**Author:** ![CarlBarnes](https://clarionhub.com/user_avatar/clarionhub.com/carlbarnes/32/1859_2.png) [@CarlBarnes](https://clarionhub.com/u/CarlBarnes)\
**Post date:** [July 26, 2023, 11:15pm UTC](https://clarionhub.com/t/application-crashing-when-open-file-dialog-is-opened/6257/13 "2023-07-26T23:15:18Z")

</div>

> [@Marc\_Brierley](#):
>
> `IF FILEDIALOGA(CLIP(LOC:PickScreenMessage),LOC:DataPath,,1010010b)`

There are `FILE:xxx` equates to make the code more obvious what you are doing. They are in the [FileDialogA Help](https://clarion.help/doku.php?id=filedialoga_extended_file_dialog_.htm) and Equates.clw. Also in the editor will popup in Intelllisense. I think the below are the equates for `1010010b`

```auto
IF FILEDIALOGA(CLIP(LOC:PickScreenMessage),LOC:DataPath,, |
               FILE:KeepDir + FILE:LongName + FILE:CreatePrompt )

FILE:Save EQUATE(1) ! 00000001
FILE:KeepDir EQUATE(2) ! 00000010
FILE:NoError EQUATE(4) ! 00000100
FILE:Multi EQUATE(8) ! 00001000
FILE:LongName EQUATE(10H) ! 00010000
FILE:Directory EQUATE(20H) ! 00100000
FILE:CreatePrompt EQUATE(40H) ! 01000000
FILE:AddExtension EQUATE(80H) ! 10000000
                                ! 84218421

```

---

<div class="post-metadata">

**Author:** ![Bostjan\_Laba](https://clarionhub.com/user_avatar/clarionhub.com/bostjan_laba/32/2498_2.png) [@Bostjan\_Laba](https://clarionhub.com/u/Bostjan_Laba)\
**Post date:** [July 28, 2023, 1:58pm UTC](https://clarionhub.com/t/application-crashing-when-open-file-dialog-is-opened/6257/14 "2023-07-28T13:58:18Z")

</div>

Is the filedialog trying to open a mapped shared folder on the network and the app OS is windows 10 or 11?
