by kvnsmnsn » 25 Oct 2010 22:51
If I'm being overly naive just let me know.
<ailurophobe> said that "WndSearch.cpp" has "a message map that tells which messages correspond to which actions," but as I said in the last post, when I set a breakpoint in his suspected method CSearchWnd::OnSearchSearch(), and another breakpoint in CQuerySearch::ToG2Packet(), and ran the program, execution got to "ToG2Packet()" before it got to "OnSearchSearch(). (In fact I don't think it ever got to "OnSearchSearch()". On the other hand, file "CtrlHomeSearch.cpp" _also_ has a message map, and I noticed right away that as soon as I pressed "Search" on the GUI, CHomeSearchCtrl::Search() got called, so I think CHomeSearchCtrl::Search() is the method I want.
So I added another boolean parameter that, if true, causes a "SetWindowText" to a predefined value (actually "abc def" right now), before it does the normal processing it does, and then I went to CHomeSearchCtrl::OnCreate() and added a line at the end that said "Search( true, true);", and added a "false" parameter as a second argument to the two other places in the code where "Search()" was called.
I was hoping that this would result in the predefined value being searched for, and having the results of the search displayed on the GUI when it came up. Unfortunately that didn't happen; the ordinary GUI that has always come up still came up. Does anybody have any idea why the plan I've described didn't work?
I'm appending the parts of "CtrlHomeSearch.cpp" that I changed.
Kevin S
#########################################################################################
..........<snip>..........
int CHomeSearchCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if ( CWnd::OnCreate( lpCreateStruct ) == -1 ) return -1;
CRect rc( 0, 0, 0, 0 );
if ( ! m_wndText.Create( WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_GROUP|WS_VSCROLL|CBS_AUTOHSCROLL|CBS_DROPDOWN,
rc, this, IDC_SEARCH_TEXT ) ) return -1;
if ( ! m_wndSchema.Create( WS_CHILD|WS_VISIBLE|WS_TABSTOP, rc, this, IDC_SCHEMAS ) )
return -1;
m_wndSchema.SetDroppedWidth( SCHEMA_WIDTH );
LoadString( m_wndSchema.m_sNoSchemaText, IDS_SEARCH_PANEL_AFT );
m_wndSchema.Load( Settings.Search.LastSchemaURI );
m_wndSearch.Create( rc, this, IDC_SEARCH_START, WS_TABSTOP | BS_DEFPUSHBUTTON );
m_wndSearch.SetHandCursor( TRUE );
m_wndAdvanced.Create( rc, this, IDC_SEARCH_ADVANCED, WS_TABSTOP );
m_wndAdvanced.SetHandCursor( TRUE );
OnSkinChange( CoolInterface.m_crWindow );
FillHistory();
Search( true, true);
return 0;
}
..........<snip>..........
void CHomeSearchCtrl::Search( bool bAutostart
, bool preset)
{
CString strText( "abc def"), strURI, strEntry, strClear;
if (preset)
{ m_wndText.SetWindowText( strText);
}
m_wndText.GetWindowText( strText );
strText.TrimLeft();
strText.TrimRight();
LoadString( strClear, IDS_SEARCH_PAD_CLEAR_HISTORY );
if ( _tcscmp ( strClear , strText ) == 0 ) return;
// Check if user mistakenly pasted download link to search input box
if ( CShareazaApp::OpenURL( strText, TRUE, TRUE ) )
{
m_wndText.SetWindowText( _T("") );
return;
}
..........<snip>..........