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.

Dark GDK / Image loading dialog won't work

Author
Message
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 13th Apr 2009 21:35
These two lines are kicking my ass:



g_sImgLoad is a char* that stores the result of the function vdOpenFilDialog(), which is used to browse Windows for a file.

The second line writes a 1 or a 0 to the clipboard, depending on whether the file exists or not. For some reason, I always get 0 on the clipboard, even though when I paste the filename into Windows, it shows me the image.

What's the problem here?

Thanks.
TheGroggyOne
15
Years of Service
User Offline
Joined: 11th Apr 2009
Location:
Posted: 14th Apr 2009 01:11
Check to see what g_sImgLoad is before sending it to dbFileExist().
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 14th Apr 2009 17:13
As I said, I tried g_sImgLoad in Windows and it showed me the file. I also checked it in the debugger and it appeared to be fine.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 15th Apr 2009 09:04
If the string that your file open dialog returns contains backslashes as separators, then replace them with double slashes before you pass them to dbFileExist.

I will test this a bit more when I get home from work, because dbFileExist sometimes returned zero on first try and one on the second try which is rather strange. However, backslashes will surely be a problem.
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 15th Apr 2009 09:19
Quote: "If the string that your file open dialog returns contains backslashes as separators, then replace them with double slashes before you pass them to dbFileExist."


You only require double backslashes when writing string literals to prevent escaping of the string when you actually want to write a backslash character; Once it's in a string then it doesn't matter.

Also I think Zoto has now fixed the issue, nice of him to post notifying us .

Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 15th Apr 2009 14:44
Quote: "Also I think Zoto has now fixed the issue, nice of him to post notifying us"


I was just getting to that!

Contrary to what I thought (thanks to Benjamin), the problem was that I was passing a pointer back from the dialog function. Silly me.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 15th Apr 2009 19:35
Quote: "You only require double backslashes when writing string literals to prevent escaping of the string "


My experience is that if I pass a simple backslash-separated path to any file handling function, it does not work. Maybe it's only on my system but it really matters.

Anyway, I'm glad that the issue is solved.

Login to post a reply

Server time is: 2024-09-30 23:21:16
Your offset time is: 2024-09-30 23:21:16