|
-
Feb 24th, 2002, 11:09 AM
#1
Thread Starter
Lively Member
Open File
Can Anyone tell me whats wrong with this code because it just crashes the program.
TCHAR sFilePath[MAX_PATH] = {NULL};
TCHAR sFileName[STRING_LENGTH];
DWORD dwFilePathSize;
TCHAR sFilter[STRING_LENGTH] = {"Bitmap \0 *.bmp \0 \0"};
OPENFILENAME OpenFile;
LPITEMIDLIST pSelectedFolder;
DWORD dwFileExtension;
DWORD dwFileOffset;
OpenFile.lStructSize = sizeof(OPENFILENAME);
OpenFile.lpstrFilter = sFilter;
OpenFile.hwndOwner = NULL;
OpenFile.nFilterIndex = 0;
OpenFile.lpstrFileTitle = sFileName;
OpenFile.nMaxFileTitle = sizeof(sFileName) - 1;
OpenFile.lpstrInitialDir = NULL;
OpenFile.lpstrFile = sFilePath;
OpenFile.nMaxFile = MAX_PATH;
OpenFile.nFileOffset = strlen(sFilePath);
GetOpenFileName(&OpenFile);
"Let's all join forces, rule with an iron hand...and prove to all the world, metal rules the land..."
-- Judas Priest
My email is [email protected]
-
Feb 25th, 2002, 11:06 AM
#2
TCHAR sFilter[STRING_LENGTH] = "Bitmap\0*.bmp\0";
would be correct. May be the error, may not, I don't know.
In any case you should first ZeroMemory the complete struct:
ZeroMemory(&OpenFile, sizeof(OpenFile));
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.
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
|