char *GUIGetText( gui_window *wnd, gui_ctl_id id ) { LONG length; char *text; gui_control_class control_class; HWND hwnd; gui_ctl_idx choice; if( !GUIGetControlClass( wnd, id, &control_class ) ) { return( NULL ); } switch( control_class ) { case GUI_LISTBOX : choice = GUIGetCurrSelect( wnd, id ); if( choice == -1 ) { return( NULL ); } return( GUIGetListItem( wnd, id, choice ) ); default : hwnd = _wpi_getdlgitem( wnd->hwnd, id ); if( hwnd == NULLHANDLE ) { return( NULL ); } length = _wpi_getwindowtextlength( hwnd ); if( length > 0 ) { text = (char *)GUIMemAlloc( length + 1 ); if( text != NULL ) { _wpi_getwindowtext( hwnd, (LPSTR)text, length + 1 ); switch( control_class ) { case GUI_PUSH_BUTTON: case GUI_DEFPUSH_BUTTON: case GUI_RADIO_BUTTON: case GUI_CHECK_BOX: case GUI_STATIC: case GUI_GROUPBOX: _wpi_menutext2win( text ); break; } } return( text ); } return( NULL ); } }
size_t GUIGetWindowTextLength( gui_window *wnd ) { return( _wpi_getwindowtextlength( GUIGetParentFrameHWND( wnd ) ) ); }