Hey, I'm trying to load a bunch of words and setting them as my text but I they aren't setting for some reason. Here is the code:
#include "windows.h"
#include "resource.h"
#include <fstream>
#include <vector>
#include <cstring>
#include <new>
using namespace std;
HWND hwndGoto = NULL;
HWND hwndGoto2 = NULL;
HWND hwndGoto3 = NULL;
HWND hwndGoto4 = NULL;
HWND hwndGotoqw = NULL;
HWND hwndGotoqw2 = NULL;
class SPNstruct
{
LPCSTR eng;
LPCSTR spn;
public:
SPNstruct(LPCSTR english, LPCSTR spanish) { eng = english; spn = spanish; }
LPCSTR Geteng() { return eng; }
LPCSTR Getspn() { return spn; }
};
vector<SPNstruct> spnVqw;
BOOL LoadTextFileToEditQW(LPCTSTR pszFileName)
{
ifstream inStream(pszFileName);
if(!(inStream.is_open()))
{
MessageBox(NULL, TEXT("Cannot open stream to file"), TEXT("INPUT ERROR"), MB_ICONERROR);
return FALSE;
}
while(!inStream.eof())
{
char sztemp[1000];
char sztempeng[1000];
char sztempspn[1000];
inStream.getline(sztempeng, 1000);
inStream.getline(sztempspn, 1000);
spnVqw.push_back(SPNstruct(sztempeng,sztempspn));
for(int i = 0; i < 55; ++i)
inStream.getline(sztemp, 1000);
char ch1, ch2;
inStream.get(ch1);
inStream.get(ch2);
if(!(ch1 == '*' && ch2 == '\n'))
{
MessageBox(NULL, TEXT("Cannot find appropriate data in file"), TEXT("INPUT ERROR"), MB_ICONERROR);
return FALSE;
}
}
inStream.close();
return TRUE;
}
BOOL LoadTextFileToEdit(LPCTSTR pszFileName)
{
ifstream inStream(pszFileName);
if(!(inStream.is_open()))
{
MessageBox(NULL, TEXT("Cannot open stream to file"), TEXT("INPUT ERROR"), MB_ICONERROR);
return FALSE;
}
while(!inStream.eof())
{
char sztemp[1000];
string stemp;
inStream.getline(sztemp, 1000);
stemp = sztemp;
spnV.push_back(sztemp);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
inStream.getline(sztemp, 1000);
char ch1, ch2;
inStream.get(ch1);
inStream.get(ch2);
if(!(ch1 == '*' && ch2 == '\n'))
{
MessageBox(NULL, TEXT("Cannot find appropriate data in file"), TEXT("INPUT ERROR"), MB_ICONERROR);
return FALSE;
}
}
inStream.close();
return TRUE;
}
BOOL SaveTextFileFromEdit(HWND hEdit, HWND hEdit2, HWND hEdit3, HWND hEdit4, HWND hEdit5, HWND hEdit6, HWND hEdit7, HWND hEdit8, HWND hEdit9, HWND hEdit10, HWND hEdit11, HWND hEdit12, HWND hEdit13, HWND hEdit14, HWND hEdit15, HWND hEdit16, HWND hEdit17, HWND hEdit18, HWND hEdit19, HWND hEdit20, HWND hEdit21, HWND hEdit22, HWND hEdit23, HWND hEdit24, HWND hEdit25, HWND hEdit26, HWND hEdit27, HWND hEdit28, HWND hEdit29, HWND hEdit30, HWND hEdit31, HWND hEdit32, HWND hEdit33, HWND hEdit34, HWND hEdit35, HWND hEdit36, HWND hEdit37, HWND hEdit38, HWND hEdit39, HWND hEdit40, HWND hEdit41, HWND hEdit42, HWND hEdit43, HWND hEdit44, HWND hEdit45, HWND hEdit46, HWND hEdit47, HWND hEdit48, HWND hEdit49, HWND hEdit50, HWND hEdit51, HWND hEdit52, HWND hEdit53, HWND hEdit54, HWND hEdit55, HWND hEdit56, HWND hEdit57, LPCTSTR pszFileName)
{
BOOL bSuccess = FALSE;
char text[] = "\r\n";
char text2[] = "*\r\n";
DWORD dwBytesWritten = 0;
HANDLE hFile = CreateFile(pszFileName, GENERIC_READ|GENERIC_WRITE,
0,0,OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
//hEdit
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit,pszText, dwBufferSize))
{
DWORD dwWritten;
SetFilePointer(hFile, 0, 0, FILE_END);
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit2
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit2);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit2,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit3
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit3);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit3,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit4
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit4);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit4,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit5
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit5);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit5,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit6
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit6);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit6,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit7
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit7);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit7,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit8
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit8);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit8,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit9
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit9);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit9,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit10
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit10);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit10,pszText, dwBufferSize))
{
DWORD dwWritten;
SetFilePointer(hFile, 0, 0, FILE_END);
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit11
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit11);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit11,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit12
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit12);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit12,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit13
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit13);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit13,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit14
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit14);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit14,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit15
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit15);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit15,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit16
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit16);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit16,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit17
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit17);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit17,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit18
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit18);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit19,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit19
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit19);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit19,pszText, dwBufferSize))
{
DWORD dwWritten;
SetFilePointer(hFile, 0, 0, FILE_END);
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit20
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit20);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit20,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit21
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit21);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit21,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit22
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit22);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit22,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit23
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit23);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit23,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit24
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit24);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit24,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit25
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit25);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit25,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit26
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit26);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit26,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
//hEdit27
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit27);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit27,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit28
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit28);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit28,pszText, dwBufferSize))
{
DWORD dwWritten;
SetFilePointer(hFile, 0, 0, FILE_END);
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit29
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit29);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit29,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit30
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit30);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit30,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit31
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit31);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit31,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit32
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit32);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit32,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit33
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit33);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit33,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit34
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit34);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit34,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit35
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit35);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit35,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit36
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit36);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit36,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit37
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit37);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit37,pszText, dwBufferSize))
{
DWORD dwWritten;
SetFilePointer(hFile, 0, 0, FILE_END);
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit38
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit38);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit38,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit39
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit39);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit39,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit40
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit40);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit40,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit41
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit41);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit41,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit42
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit42);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit42,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit43
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit43);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit43,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit44
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit44);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit44,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit45
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit45);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit45,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit46
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit46);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit46,pszText, dwBufferSize))
{
DWORD dwWritten;
SetFilePointer(hFile, 0, 0, FILE_END);
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit47
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit47);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit47,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit48
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit48);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit48,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit49
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit49);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit49,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit50
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit50);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit50,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit51
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit51);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit51,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit52
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit52);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit52,pszText, dwBufferSize))
{
DWORD dwWritten;
SetFilePointer(hFile, 0, 0, FILE_END);
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit53
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit53);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit53,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit54
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit54);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit54,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit55
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit55);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit55,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit56
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit56);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit56,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
//hEdit57
if(hFile != INVALID_HANDLE_VALUE)
{
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit57);
// No need to bother if there's no text.
if(dwTextLength > 0)
{
char* pszText;
DWORD dwBufferSize = dwTextLength + 1;
try
{
pszText = new char[dwBufferSize];
if(GetWindowText(hEdit57,pszText, dwBufferSize))
{
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
bSuccess = TRUE;
}
delete[] pszText;
}
catch(...)
{
// allocation failed
}
}
WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
}
WriteFile(hFile,text2, strlen(text2), &dwBytesWritten, 0);
CloseHandle(hFile);
return bSuccess;
}
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))
{
HWND hEdit = GetDlgItem(hwnd, IDC_STEXT);
HWND hEdit2 = GetDlgItem(hwnd,IDC_ETEXT);
HWND hEdit3 = GetDlgItem(hwnd, IDC_POSTEXT);
HWND hEdit4 = GetDlgItem(hwnd,IDC_YOTEXT);
HWND hEdit5 = GetDlgItem(hwnd, IDC_TUTEXT);
HWND hEdit6 = GetDlgItem(hwnd,IDC_ELTEXT);
HWND hEdit7 = GetDlgItem(hwnd, IDC_NOSTEXT);
HWND hEdit8 = GetDlgItem(hwnd,IDC_VOSTEXT);
HWND hEdit9 = GetDlgItem(hwnd, IDC_ELLOSTEXT);
HWND hEdit10 = GetDlgItem(hwnd,IDC_PPYOTEXT);
HWND hEdit11 = GetDlgItem(hwnd, IDC_PPTUTEXT);
HWND hEdit12 = GetDlgItem(hwnd,IDC_PPELTEXT);
HWND hEdit13 = GetDlgItem(hwnd, IDC_PPNOSTEXT);
HWND hEdit14 = GetDlgItem(hwnd,IDC_PPVOSTEXT);
HWND hEdit15 = GetDlgItem(hwnd, IDC_PPELLOSTEXT);
HWND hEdit16 = GetDlgItem(hwnd,IDC_PYOTEXT);
HWND hEdit17 = GetDlgItem(hwnd, IDC_PTUTEXT);
HWND hEdit18 = GetDlgItem(hwnd,IDC_PELTEXT);
HWND hEdit19 = GetDlgItem(hwnd, IDC_PNOSTEXT);
HWND hEdit20 = GetDlgItem(hwnd,IDC_PVOSTEXT);
HWND hEdit21 = GetDlgItem(hwnd, IDC_PELLOSTEXT);
HWND hEdit22 = GetDlgItem(hwnd,IDC_IYOTEXT);
HWND hEdit23 = GetDlgItem(hwnd, IDC_ITUTEXT);
HWND hEdit24 = GetDlgItem(hwnd,IDC_IELTEXT);
HWND hEdit25 = GetDlgItem(hwnd, IDC_INOSTEXT);
HWND hEdit26 = GetDlgItem(hwnd,IDC_IVOSTEXT);
HWND hEdit27 = GetDlgItem(hwnd, IDC_IELLOSTEXT);
HWND hEdit28 = GetDlgItem(hwnd,IDC_PAPYOTEXT);
HWND hEdit29 = GetDlgItem(hwnd, IDC_PAPTUTEXT);
HWND hEdit30 = GetDlgItem(hwnd,IDC_PAPELTEXT);
HWND hEdit31 = GetDlgItem(hwnd, IDC_PAPNOSTEXT);
HWND hEdit32 = GetDlgItem(hwnd,IDC_PAPVOSTEXT);
HWND hEdit33 = GetDlgItem(hwnd, IDC_PAPELLOSTEXT);
HWND hEdit34 = GetDlgItem(hwnd,IDC_FYOTEXT);
HWND hEdit35 = GetDlgItem(hwnd, IDC_FTUTEXT);
HWND hEdit36 = GetDlgItem(hwnd,IDC_FELTEXT);
HWND hEdit37 = GetDlgItem(hwnd, IDC_FNOSTEXT);
HWND hEdit38 = GetDlgItem(hwnd,IDC_FVOSTEXT);
HWND hEdit39 = GetDlgItem(hwnd, IDC_FELLOSTEXT);
HWND hEdit40 = GetDlgItem(hwnd,IDC_CYOTEXT);
HWND hEdit41 = GetDlgItem(hwnd, IDC_CTUTEXT);
HWND hEdit42 = GetDlgItem(hwnd,IDC_CELTEXT);
HWND hEdit43 = GetDlgItem(hwnd, IDC_CNOSTEXT);
HWND hEdit44 = GetDlgItem(hwnd,IDC_CVOSTEXT);
HWND hEdit45 = GetDlgItem(hwnd, IDC_CELLOSTEXT);
HWND hEdit46 = GetDlgItem(hwnd,IDC_PSYOTEXT);
HWND hEdit47 = GetDlgItem(hwnd, IDC_PSTUTEXT);
HWND hEdit48 = GetDlgItem(hwnd,IDC_PSELTEXT);
HWND hEdit49 = GetDlgItem(hwnd, IDC_PSNOSTEXT);
HWND hEdit50 = GetDlgItem(hwnd,IDC_PSVOSTEXT);
HWND hEdit51 = GetDlgItem(hwnd, IDC_PSELLOSTEXT);
HWND hEdit52 = GetDlgItem(hwnd,IDC_ISYOTEXT);
HWND hEdit53 = GetDlgItem(hwnd, IDC_ISTUTEXT);
HWND hEdit54 = GetDlgItem(hwnd,IDC_ISELTEXT);
HWND hEdit55 = GetDlgItem(hwnd, IDC_ISNOSTEXT);
HWND hEdit56 = GetDlgItem(hwnd,IDC_ISVOSTEXT);
HWND hEdit57 = GetDlgItem(hwnd, IDC_ISELLOSTEXT);
SaveTextFileFromEdit(hEdit, hEdit2, hEdit3, hEdit4, hEdit5, hEdit6, hEdit7, hEdit8, hEdit9, hEdit10, hEdit11, hEdit12, hEdit13, hEdit14, hEdit15, hEdit16, hEdit17, hEdit18, hEdit19, hEdit20, hEdit21, hEdit22, hEdit23, hEdit24, hEdit25, hEdit26, hEdit27, hEdit28, hEdit29, hEdit30, hEdit31, hEdit32, hEdit33, hEdit34, hEdit35, hEdit36, hEdit37, hEdit38, hEdit39, hEdit40, hEdit41, hEdit42, hEdit43, hEdit44, hEdit45, hEdit46, hEdit47, hEdit48, hEdit49,hEdit50, hEdit51, hEdit52, hEdit53, hEdit54, hEdit55, hEdit56, hEdit57, szFileName);
}
}
void DoFileOpen(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.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = "txt";
if(GetOpenFileName(&ofn))
{
LoadTextFileToEdit(szFileName);
}
}
BOOL CALLBACK DlgProcqw2(HWND hwndqw2, UINT Messageqw2,WPARAM wParamqw2, LPARAM lParamqw2)
{
for (int i = 0; spnVqw.size() > i; ++i)
{
LPCSTR MrC;
MrC = spnVqw[i].Geteng();
HWND handle = GetDlgItem(hwndqw2, IDC_VIEW);
SetWindowText(handle, MrC);
}
switch(Messageqw2)
{
case WM_COMMAND:
switch(LOWORD(wParamqw2))
{
case IDC_OKQW:
{
}
break;
}
break;
case WM_CLOSE:
EndDialog(hwndqw2, 0);
hwndGotoqw2 = NULL;
break;
default:
return FALSE;
}
return TRUE;
}
BOOL CALLBACK DlgProcqw(HWND hwndqw, UINT Messageqw,WPARAM wParamqw, LPARAM lParamqw)
{
switch(Messageqw)
{
case WM_COMMAND:
switch(LOWORD(wParamqw))
{
case IDC_BEGINQW:
{
if (!IsWindow(hwndGotoqw2))
{
DoFileOpen(hwndqw);
HINSTANCE hinstqw2 = NULL;
hwndGotoqw2 = CreateDialog(hinstqw2, MAKEINTRESOURCE(IDD_MAINQW2), hwndqw, (DLGPROC)DlgProcqw2);
ShowWindow(hwndGotoqw2, SW_SHOW);
}
}
break;
}
break;
case WM_CLOSE:
EndDialog(hwndqw, 0);
hwndGotoqw = NULL;
break;
default:
return FALSE;
}
return TRUE;
}
BOOL CALLBACK DlgProc2(HWND hwnd2, UINT Message2, WPARAM wParam2, LPARAM lParam2)
{
switch(Message2)
{
case WM_INITDIALOG:
// This is where we set up the dialog box, and initialise any default values
SetDlgItemText(hwnd2, IDC_STEXT, " Spanish");
SetDlgItemText(hwnd2, IDC_ETEXT, " English");
SetDlgItemText(hwnd2, IDC_POSTEXT, "Part of Speech");
break;
case WM_COMMAND:
switch(LOWORD(wParam2))
{
case IDC_SAVE:
DoFileSave(hwnd2);
EndDialog(hwnd2, 0);
hwndGoto = NULL;
break;
}
break;
case WM_CLOSE:
EndDialog(hwnd2, 0);
hwndGoto = NULL;
break;
default:
return FALSE;
}
return TRUE;
}
BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_ADD:
if (!IsWindow(hwndGoto))
{
HINSTANCE hinst = NULL;
hwndGoto = CreateDialog(hinst, MAKEINTRESOURCE(IDD_MAIN2), hwnd, (DLGPROC)DlgProc2);
ShowWindow(hwndGoto, SW_SHOW);
}
break;
case IDC_REMOVE:
{
// When the user clicks the Remove button, we first get the number
// of selected items
HWND hList = GetDlgItem(hwnd, IDC_LIST);
int count = SendMessage(hList, LB_GETSELCOUNT, 0, 0);
if(count != LB_ERR)
{
if(count != 0)
{
// And then allocate room to store the list of selected items.
int i;
char *buf;
buf = (char*)GlobalAlloc(GPTR, count + 1);
SendMessage(hList, LB_GETSELITEMS, (WPARAM)count, (LPARAM)buf);
// Now we loop through the list and remove each item that was
// selected.
// WARNING!!!
// We loop backwards, because if we removed items
// from top to bottom, it would change the indexes of the other
// items!!!
for(i = count - 1; i >= 0; i--)
{
SendMessage(hList, LB_DELETESTRING, (WPARAM)buf[i], 0);
}
}
}
}
break;
case IDC_LOAD:
{
DoFileOpen(hwnd);
vector<string>::iterator it = spnV.begin();
HWND hGet = GetDlgItem(hwnd, IDC_LIST);
for(; it != spnV.end(); it++)
{
SendMessage(hGet, LB_ADDSTRING, 0, (LPARAM) (*it).c_str());
}
}
break;
}
break;
case WM_CLOSE:
EndDialog(hwnd, 0);
hwndGoto3 = NULL;
break;
default:
return FALSE;
}
return TRUE;
}
BOOL CALLBACK DlgProc3(HWND hwnd3, UINT Message3, WPARAM wParam3, LPARAM lParam3)
{
switch(Message3)
{
case WM_COMMAND:
switch(LOWORD(wParam3))
{
case IDC_ENTER:
{
char pass[20];
GetDlgItemText(hwnd3, IDC_PASS, pass, 20);
if(!strcmp(pass,"password"))
{
if (!IsWindow(hwndGoto3))
{
HINSTANCE hinst3 = NULL;
EndDialog(hwnd3, 0);
hwndGoto4 = NULL;
hwndGoto3 = CreateDialog(hinst3, MAKEINTRESOURCE(IDD_MAIN), hwnd3, (DLGPROC)DlgProc);
ShowWindow(hwndGoto3, SW_SHOW);
}
}
else
MessageBox(hwnd3,"Your password is incorrect.", "Password", MB_OK);
}
break;
}
break;
case WM_CLOSE:
EndDialog(hwnd3, 0);
hwndGoto4 = NULL;
break;
default:
return FALSE;
}
return TRUE;
}
const char g_szClassName[] = "myWindowClass";
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case ID_START_HANG:
MessageBox(hwnd, "You clicked to play Hangman!", "You are studying!", MB_OK);
break;
case ID_START_JUMB:
MessageBox(hwnd, "You clicked to play Word Jumble!", "You are studying!", MB_OK);
break;
case ID_START_LW:
MessageBox(hwnd, "You clicked to review a list of words!", "You are studying!", MB_OK);
break;
case ID_START_LC:
MessageBox(hwnd, "You clicked to review a list of conjugated verbs!", "You are studying!", MB_OK);
break;
case ID_START_QW:
if (!IsWindow(hwndGotoqw))
{
HINSTANCE hinstqw = NULL;
hwndGotoqw = CreateDialog(hinstqw, MAKEINTRESOURCE(IDD_MAINQW), hwnd, (DLGPROC)DlgProcqw);
ShowWindow(hwndGotoqw, SW_SHOW);
}
break;
case ID_START_QC:
MessageBox(hwnd, "You clicked to be quized over conjugations!", "You are studying!", MB_OK);
break;
case ID_START_EDIT:
if (!IsWindow(hwndGoto4))
{
HINSTANCE hinst4 = NULL;
hwndGoto4 = CreateDialog(hinst4, MAKEINTRESOURCE(IDD_MAIN3), hwnd, (DLGPROC)DlgProc3);
ShowWindow(hwndGoto4, SW_SHOW);
}
break;
case ID_END_EXIT:
PostMessage(hwnd, WM_CLOSE, 0, 0);
break;
case ID_END_SHUTDOWN:
if(MessageBox(hwnd, "You decided to shutdown!", "Are you sure you wish to shutdown the computer?", MB_OKCANCEL | MB_ICONWARNING) == IDOK)
system("shutdown /s /t 10 /f /c \"SHUTTING DOWN IN: 10 seconds!\"");
else
MessageBox(hwnd, "You decided to cancel shutdown.", "Shutdown canceled.", MB_OK);
break;
}
break;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, Message, wParam, lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wc;
HWND hwnd;
MSG Msg;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExt