-
March 13th, 2014, 08:07 AM
#1
File Dialog Issues
Hi
I have a problem that I don't understand yet. Someone here might be able tell me what to look for.
The problem is related in to the open and save file dialog. I am learning the windows API for the file dialog by hacking on the Common File Dialog example written by Microsoft. My app runs fine but it crashes when I call exit or when I return from main.
The program does not crash if I display the task dialog from the example. What kind of problem am I facing? Could it be some kind of memory corruption in another part of the program or is it just a matter of calling release somewhere? Does something in the BasicFileDialog really depend on the task dialog?
The working looks like this:
Code:
void showTaskDialog () {
TASKDIALOGCONFIG taskDialogParams = { sizeof(taskDialogParams) };
taskDialogParams.dwFlags = TDF_USE_COMMAND_LINKS | TDF_ALLOW_DIALOG_CANCELLATION;
TASKDIALOG_BUTTON const buttons[] =
{
{ 0, L"OK" },
};
taskDialogParams.pButtons = buttons;
taskDialogParams.cButtons = ARRAYSIZE(buttons);
taskDialogParams.pszWindowTitle = L"OK";
int selectedId;
TaskDialogIndirect(&taskDialogParams, &selectedId, NULL, NULL);
}
void openFileDialog () {
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED|COINIT_DISABLE_OLE1DDE);
if (SUCCEEDED(hr))
{
showTaskDialog ();
BasicFileOpen();
CoUninitialize();
}
}
The code that causes the crash on exit looks like this:
Code:
void openFileDialog () {
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED|COINIT_DISABLE_OLE1DDE);
if (SUCCEEDED(hr))
{
BasicFileOpen();
CoUninitialize();
}
}
The stack trace looks like this:
Code:
Program received signal SIGSEGV, Segmentation fault.
0xfeeefeab in ?? ()
(gdb) bt
#0 0xfeeefeab in ?? ()
#1 0x74c23085 in FindGadgetFromPoint () from C:\Windows\system32\duser.dll
#2 0x74c22e7e in FindGadgetFromPoint () from C:\Windows\system32\duser.dll
#3 0x7735a604 in ntdll!RtlRemovePrivileges ()
from C:\Windows\system32\ntdll.dll
#4 0x7732a303 in ntdll!RtlRegisterWait () from C:\Windows\system32\ntdll.dll
#5 0x7732a38e in ntdll!RtlExtendMemoryBlockLookaside ()
from C:\Windows\system32\ntdll.dll
#6 0x75bed863 in KERNEL32!ExitThread () from C:\Windows\system32\kernel32.dll
#7 0x00000000 in ?? ()
The window crash reports claims that it is an access violation in ntshrui.dll
Cheers
Johan
-
March 13th, 2014, 08:30 AM
#2
Re: File Dialog Issues
1. What does BasicFileDialog have to do with your code snippet? with Visual C++?
2. Where is your main you refers to:
Originally Posted by johanm
it crashes when I call exit or when I return from main
Note that you must not call exit in Win32 application.
Last edited by VictorN; March 13th, 2014 at 08:41 AM.
Victor Nijegorodov
-
March 13th, 2014, 08:38 AM
#3
Re: File Dialog Issues
Thank you for the exit call information.
The entire example code with my two functions at the bottom is too long to post at codeguru but it is available here: https://etherpad.mozilla.org/uvyNTUwklF
-
March 13th, 2014, 08:42 AM
#4
Re: File Dialog Issues
You did not answer my questions.
Victor Nijegorodov
-
March 18th, 2014, 07:45 AM
#5
Re: File Dialog Issues
As victor pointed out.
It looks like you're trying to do something with the taskdialog (or command dialog), which is 'sort of' a more elaborate form of the messagebox.
This has nothing to do at all with the common dialog to open/save files.
-
March 20th, 2014, 04:56 AM
#6
Re: File Dialog Issues
My test doesn't show any issue.
test-basicfiledialog.zip
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|