JasonLpz
Jan 28th, 2003, 02:57 PM
How can i show the open, save, and color dialog?
I know to get the open i used
void OpenF(HWND hwnd,char *vFilen)
{
OPENFILENAME ofn;
char szFileName1[MAX_PATH] = "";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW
ofn.hwndOwner = hwnd;
ofn.lpstrTitle = "Open";
ofn.lpstrFilter = "Ini File (*.ini)\0*.txt\0All Files (*.*)\0*.*\0";
ofn.lpstrFile = szFileName1;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = "ini";
if(GetOpenFileName(&ofn))
{
vFilen = szFileName1;
// Do something usefull with the filename stored in szFileName1
}
}
But i get a cancel error. How do i do this so i can intercept the cancel error and how do i show the save and color alos thanks in advance
I know to get the open i used
void OpenF(HWND hwnd,char *vFilen)
{
OPENFILENAME ofn;
char szFileName1[MAX_PATH] = "";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW
ofn.hwndOwner = hwnd;
ofn.lpstrTitle = "Open";
ofn.lpstrFilter = "Ini File (*.ini)\0*.txt\0All Files (*.*)\0*.*\0";
ofn.lpstrFile = szFileName1;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = "ini";
if(GetOpenFileName(&ofn))
{
vFilen = szFileName1;
// Do something usefull with the filename stored in szFileName1
}
}
But i get a cancel error. How do i do this so i can intercept the cancel error and how do i show the save and color alos thanks in advance