I am currently writing a program in C# which enables the user to search google for...stuff.
This is what happens:
Application Runs > Normal Search --> Normal Search Form Launches, with a browser within it.
Picture Search --> Picture Search Form Launches, with a browser within it.
Now after a lot of problems, I figured out how to get the picture search to work, like this:
public void LaunchImageSearch(string keyword)
{
ImageResultsWindow ImageResults = new ImageResultsWindow();
System.Object nullObject = 0;
string str = "";
System.Object nullObjStr = str;
Cursor.Current = Cursors.WaitCursor;
axWebBrowser1.Navigate("http://images.google.co.uk/images?q=" + keyword + "&hl=en", ref nullObject, ref nullObjStr, ref nullObjStr, ref nullObjStr);
}
//edit: there is a *plus* before and after the keyword string...for some reason the forum cuts it out
private void imageSearchButton_Click(object sender, System.EventArgs e)
{
ImageResultsWindow ImageResults = new ImageResultsWindow();
ImageResults.Show();
ImageResults.LaunchImageSearch(imageSearchBox.Text);
this.WindowState = FormWindowState.Minimized;
}
But when I try and attempt to do this with my normal search, where the browser is navigated to the regular Google search bar, it doesn't do anything! Any ideas on this one? Is it possible to search string directly through the URL?
Another wee problem is the notify icon. I want it to be possible to minimize the program to the system tray, and it's worked...but this occurs.
http://show.imagehosting.us/show/1234810/0/nouser_1234/T0_-1_1234810.JPG
It opens it three times! Here is the code:
NotifyIcon double click...
private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)
{
Show();
WindowState = FormWindowState.Normal;
}
Form Resize...
private void Form1_Resize(object sender, System.EventArgs e)
{
if (FormWindowState.Minimized == WindowState)
Hide();
}