End Google Ads 201810 - BS.net 01 --> Hi everybody
i'm in very bad situation cause i can't find a way to get url of a current tab in Chrome...
i found a part of code but it doesn't work anyway ....
[DllImport("user32")]
static extern IntPtr GetForegroundWindow();

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
static extern IntPtr SendMessage(IntPtr hWnd, Int32 Msg,
IntPtr wParam, StringBuilder lParam);

[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindowEx(IntPtr parentHandle,
IntPtr childAfter, string className, IntPtr windowTitle);

//c po sur elle marche po xD
private const int WM_GETTEXT = 0x000D;

public static string getChromeURL()
{
uint MAX_PATH = 255;
IntPtr hChrome, hAddressBox;
hChrome = GetForegroundWindow();

hAddressBox = FindWindowEx(hChrome, IntPtr.Zero,
"Chrome_AutocompleteEditView", IntPtr.Zero);

StringBuilder sb = new StringBuilder(256);

SendMessage(hAddressBox, WM_GETTEXT, (IntPtr)MAX_PATH, sb);

string s = sb.ToString().Trim(new Char[] { ' ', '\0', '\n' });
return s;
}
i don't know what i messed in this code . but it doesn't work for me
so please HELP ME .............