|
Professional Programmer
Join Date: Oct 2005
Location: United States
Posts: 447
Rep Power: 4 
|
Thank you very much, grumpy.
I have this code now:
if(GetOpenFileName(&ofn)) { strcpy(Buffer, szFileName); return Buffer[MAX_PATH]; // MessageBox(0, Buffer, 0, 0); // SendMessage(GetDlgItem(hwnd, IDC_EDITBOX_TEXT), LB_ADDSTRING, 0, (LPARAM)"test"); }
case IDB_BROWSEBUTTON: { switch (HIWORD(wParam)) { case BN_CLICKED: { Buffer[MAX_PATH] = DoFileOpen(hWnd); SendMessage(GetDlgItem(hWnd, IDC_EDITBOX_TEXT), LB_ADDSTRING, 0, (LPARAM)Buffer); // MessageBox(0, Buffer, 0, 0); } break; } break; } break;
The MessageBox() in the second code example displays the path that I select in my browse function. If I change IDC_EDITBOX_TEXT to IDC_LISTBOX_TEXT, the message is received just fine. It displays the path in the listbox. This is fine, this is wonderful, this is dandy, but this is not what I want. I want to put the string into my editbox, and for some reason, SendMessage() fails on doing this. (I think)
Here is my editbox code:
hWndEditBox = CreateWindow( "EDIT", "<type a file name here>", WS_VISIBLE | WS_CHILD | WS_BORDER, 10, 10, 700, 30, hWnd, (HMENU)IDC_EDITBOX_TEXT, (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE), NULL); HFONT AhFont = (HFONT)GetStockObject( DEFAULT_GUI_FONT ); SendMessage( hWndEditBox, WM_SETFONT, (WPARAM)AhFont, TRUE );
What am I doing wrong here?
Thanks again.
|