Jump to content
  • Advertisement
Sign in to follow this  
M-374 LX

[Win32] Problem with custom Open File box

This topic is 3541 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was making a custom "Open File" dialog box to include some additional controls. But I got a graphical problem. Check this image: http://img148.imageshack.us/img148/3214/problemgh6.png

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by M-374 LX
I was making a custom "Open File" dialog box to include some additional controls.
But I got a graphical problem.

Check this image: http://img148.imageshack.us/img148/3214/problemgh6.png
Yep, that's a problem alright. Looks like you're not erasing the background of the dialog box.

Can we see your code? And a full screenshot, it's hard to see with just that.

Share this post


Link to post
Share on other sites
I used a resource script, with this code:
IDD_DIALOG1 DIALOG DISCARDABLE  0, 0, 283, 18
style WS_CHILD
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "Change",ID_CHANGE,229,1,50,12
LTEXT "Encoding: ",IDC_STATIC,7,0,35,8
END


In C++, a function to open an Open File dialog:

OPENFILENAME ofnTemp;

ofnTemp.lStructSize = sizeof( OPENFILENAME );
ofnTemp.hwndOwner = hwnd;
ofnTemp.hInstance = hInst;
ofnTemp.lpstrFilter = "*.txt";
ofnTemp.lpstrCustomFilter = NULL;
ofnTemp.nMaxCustFilter = 0;
ofnTemp.nFilterIndex = 1;
ofnTemp.lpstrInitialDir = NULL;
ofnTemp.lpstrFile = (LPSTR)folder;
ofnTemp.nMaxFile = 300;
ofnTemp.lpstrFileTitle = NULL;
ofnTemp.nMaxFileTitle = 0;
ofnTemp.lpstrTitle = title;
ofnTemp.Flags = OFN_HIDEREADONLY|OFN_EXPLORER|OFN_ENABLEHOOK|OFN_ENABLETEMPLATE|OFN_NOCHANGEDIR|OFN_NOVALIDATE;
ofnTemp.nFileOffset = 0;
ofnTemp.nFileExtension = 0;
ofnTemp.lpstrDefExt = "*";
ofnTemp.lCustData = 0L;
ofnTemp.lpfnHook = OFNHookProc;
ofnTemp.lpTemplateName = MAKEINTRESOURCE(IDD_DIALOG1);

if( GetOpenFileName( &ofnTemp ) != TRUE ) return true;

return false;


The callback function OFNHookProc has just a "return true".

Here is a full screenshot: http://img244.imageshack.us/img244/2180/problemum9.png

Share this post


Link to post
Share on other sites
Quote:
Original post by M-374 LX
The callback function OFNHookProc has just a "return true".
From the Documentation:
Quote:
The hook procedure returns FALSE to pass a message to the default dialog box procedure or TRUE to discard the message.
If you discard all the messages, the main dialog proc won't process them so the window won't get updated correctly. You want to return false, not true.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!