Hi,
I was creating a Gui for one of my classes and I hit a major bump. I am trying to take words from a text file and just display it in the text box. I know how to read files, what I don't know is how to change the information in the text box. Where can I put the code so that when the gui isn't doing anything the program searches through the file, and sends a message to update the text box.
help would be greatly appreciated.
Chris
My code looks like this
//---------------------------------------------------------------------------
wchar_t *ComboBoxItems = L"Sri Lanka"; //holds the text
string Combo;
HWND Handle = NULL; // Specify a handle as null
HWND hWnd; //specify another handle this will be used in the dialog box
LRESULT CALLBACK DlgProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); //Function
//which handles requests for the dialog box
ifstream file;
int input_position = 0;
//---------------------------------------------------------------------------
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DLGFIRST),
hWnd, reinterpret_cast<DLGPROC>(DlgProc));
return FALSE;
}
//---------------------------------------------------------------------------
LRESULT CALLBACK DlgProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
file >> Combo;
SendDlgItemMessage(hWnd, WM_COMMAND, IDC_EDIT1, NULL, NULL);
HWND hWndPrincipal;
switch(Msg)
{
case WM_INITDIALOG:
hWndPrincipal = GetDlgItem(hWndDlg, IDC_EDIT1);
SetWindowText(hWndPrincipal, ComboBoxItems);
//ComboBoxItems = L"Hello";
return TRUE;
case WM_COMMAND:
switch(wParam)
{
case IDQUIT:
EndDialog(hWndDlg, 0);
return TRUE;
}
break;
}
return FALSE;