I was making a function to save info and it doesn't work. It's
actually made up of 2 functions. I've eliminated my problems down to
the second function and can't figure out what to do. Here is the
function:
void DoFileSave(HWND hwnd)
{
OPENFILENAME ofn;
char szFileName[MAX_PATH] = "";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*
\0";
ofn.lpstrFile = szFileName;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "txt";
ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY |
OFN_OVERWRITEPROMPT;
if(GetSaveFileName(&ofn))
{
int i, a;
char etxt[100];
i = SendMessage(IDC_LIST, LB_GETCOUNT, 0, 0); //gets the number of
items in listbox
for (a=0; a<i; a++)
{
SendMessage(IDC_LIST, LB_GETTEXT, a, etxt[a]); //get all text
}
HWND hEdit = GetDlgItem(hwnd, etxt[a]);
SaveTextFileFromListBox(hEdit, szFileName);
}
}
Here are the errors I get:
error C2275: 'HWND' : illegal use of this type as an expression
error C2146: syntax error : missing ';' before identifier 'hEdit'
error C2065: 'hEdit' : undeclared identifier
error C2065: 'hEdit' : undeclared identifier