Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / GetOpenFileName filter only works in C++, not in DBP

Author
Message
AndrewT
12
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 11th Apr 2009 23:49
So I'm trying to make some simple commands to provide open and save file dialogs in DBP. However I'm having a bit of trouble getting the dialog's filter to work. If I set the filter from the plugin itself like this:



then it works fine. However if I make the filter a command parameter, letting the user set the filter it doesn't work.

For instance let's say I have this in DBP:



And then in the plugin I'll have this ('filter' is the command parameter):



And the filter doesn't work. In the corner of the dialog box rather
than seeing "DirectX Object File (.x)" and having only .x files appear, the filter box shows "DirectX Object File (.x)\0*.x\0".

Anyone ideas?

i like orange
IanM
Retired Moderator
16
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 11th Apr 2009 23:57
The '\0' gets translated into a null byte in C++. In DBPro it's just two characters.

What I'd suggest is that you pick another character that can be typed and can't be used in a filename (eg | ) and use that in your DBPro command. Then in the plug-in function, copy the string to a buffer and replace the character you chose with a null byte, and ensure that the buffer is properly terminated with two null bytes.

AndrewT
12
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 11th Apr 2009 23:59 Edited at: 12th Apr 2009 00:00
Ahhh, I had a feeling it had something to do with that. Thanks for the quick reply.

i like orange

Login to post a reply

Server time is: 2019-06-19 11:03:18
Your offset time is: 2019-06-19 11:03:18