|
-
Nov 23rd, 2001, 11:29 PM
#1
Thread Starter
Addicted Member
GetOpenFileName
Hello,
I have a program that use GetOpenFileName API to play a song. It works well until the user try to open a second song, the program bug. I run my program in debugger mode and figure out that it bug when he gets to GetOpenFileName.
Here's my code:
PHP Code:
OPENFILENAME ofn;
char szFileName[MAX_PATH] = "";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hWnd;
ofn.lpstrFilter = "Text Files (*.wav)\0*.wav\0All Files (*.*)\0*.*\0";
ofn.lpstrFile = szFileName;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;
GetOpenFileName(&ofn);
Does someone knows why it bugs?
-
Nov 25th, 2001, 01:27 PM
#2
I see some typos, but I don't see any failure that would cause it to crash the second time it runs... Maybe if you submit the whole thing...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Nov 28th, 2001, 03:32 AM
#3
Addicted Member
dim pOpenfilename as OPENFILENAME
const MAX_BUFFER_LENGTH=256
WITH pOpenfilename
.hwndOwner=hwnd
.hInstance=App.hInstance
.lpstrFile=String(MAX_BUFFER_LENGTH,0)
.nMaxFile=MAX_BUFFER_LENGTH-1
.nMaxFileTitle=MAX_BUFFER_LENGTH-1
.lstructSize=len(pOpenfilename)
end with
I think it will work
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
|