Your code worked for me. You might want to be sure your hWnd is actually there when you call this function and not 0x00000000. You also might want to set through your program and see if it has a problem with one of your calls in that function.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com
// Display the Open dialog box.
if (!GetOpenFileName(&ofn))
{
MessageBox(hWnd,"User was click the cancel button","Test",MB_OK);
}
else
{
MessageBox(hWnd,ofn.lpstrFile,ofn.lpstrFile,MB_OK);
}
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com
char szFile[260]; // buffer for file name
strcpy(szFile,"");
And I would change to
Code:
if (!GetOpenFileName(&ofn))
{
MessageBox(hWnd,"User was click the cancel button","Test",MB_OK);
}
else
{
MessageBox(hWnd,ofn.lpstrFile,ofn.lpstrFile,MB_OK);
}
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com
Clears out your buffer. With Win2000 for some reason, I dont know, if that is not cleared out it doesn't work. With Win98 it worked, it was just full of NULL chars, and was messy.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com
Umm I guess you could if you wanted to. But I would think that strcpy would be overall a little bit faster. But either way will get you the same thing.
I noticed that with any of the MSDN examples I saw that it did not show NULL the buffer before hand. I dunno why.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com