hi friends,
I am trying to create a win application. Which will run in the background(System Tray).
I enter 2 parameters, 1.url(www.google.com) 2.value(1)
If the user opens the browser with url www.google.com?value=1 Then the application should give Pop-up message indicating this url has been opened with its link.
My problem is how to Check if browser is opened and if opened, has this url been opened? Any suggestions to this topic will be highly appreciated.
Loading
nithin eatePosted Aug 6, 2012, 6:28 AM
I am also looking for the same functionality. Can you provide me a code which is ideal and works fine..
Thank you in advance.
Nithin
Sam HobbsPosted Mar 1, 2011, 3:46 PM
Ibrahim ErsoyPosted Mar 1, 2011, 3:13 PM
What is your purpose? I smell bad things coming from the kitchen
Sam HobbsPosted Mar 1, 2011, 2:51 PM
Vinayak, please create a new thread (question) and describe your requirements. In the new thread, tell us if this must work for many browsers, such as IE and Firefox and others or if you need it for just IE. I think I can help you with IE, but please create a new thread. Then in the new thread when your question is answered, please check the checkbox indicating you have an answer.
VinayakPosted Mar 1, 2011, 4:27 AM
MenonPosted Jul 18, 2008, 1:33 AM
Hi Satish,
Thanks alot. I will definitely try your code.
I have found something else. That also works. That is the Microsoft Internal Library. Using that i have managed to get my requirement done. I am looking forward now if it is posssible for Mozilla also. I know its bit too much. But just try.
Again Thanks
Regards,
Sateesh ArvetiPosted Jul 15, 2008, 2:06 AM
there is no builtin functions to implement ur requirement.The solution,what i feel is create a threading's timer and check all processes which is having processname as "iexplore" and get handle for textbox(addressbar) to get its content for every second.i am pasting a sample code here.please,have a look at it.
#region Main
class Program
{
public static Timer t = null;
static void Main(string[] args)
{
System.Threading.TimerCallback timerDelegate =
new System.Threading.TimerCallback(CheckAllProcesses);
t = new System.Threading.Timer(timerDelegate, null, 0, 1000);
timerDelegate.Invoke(new object());
}
#region WIN32 API
[DllImport("user32.dll", EntryPoint = "SendMessage")]
private static extern int SendMessage(IntPtr hwnd, int msg, int wParam, StringBuilder sb);
[DllImport("user32.dll", EntryPoint = "FindWindow")]
private static extern IntPtr FindWindow(string _ClassName, string _WindowName);
[DllImport("user32.dll", EntryPoint = "FindWindowEx")]
private static extern IntPtr FindWindowEx(IntPtr _Parent, int _ChildAfter, string _ClassName, string _WindowName);
public const int WM_GETTEXTLENGTH = 0x000E;
public const int WM_GETTEXT = 0x000D;
#endregion
private static void CheckAllProcesses(object temp)
{
int length = 100;
foreach (Process p in Process.GetProcesses())
{
if (p.ProcessName == "iexplore")
{
IntPtr worker = FindWindowEx(p.MainWindowHandle, 0, "WorkerW", null);
IntPtr toolbar = FindWindowEx(worker, 0, "rebarwindow32", null);
IntPtr comboboxex = FindWindowEx(toolbar, 0, "comboboxex32", null);
IntPtr combo = FindWindowEx(comboboxex, 0, "ComboBox", null);
IntPtr edit = FindWindowEx(combo, 0, "Edit", null);
StringBuilder sb = new StringBuilder(length + 1);
SendMessage(edit, WM_GETTEXT, length + 1, sb);
if (sb.ToString().ToLower().IndexOf("google.com") != -1)
{
Console.WriteLine(sb.ToString());
if (sb.ToString().IndexOf("?") != -1)
{
string parm = sb.ToString().Substring(sb.ToString().IndexOf("?") + 1);
Console.WriteLine(parm);
}
}
}
}
Console.ReadLine();
}
}
#endregion