-
API Help
HI, I need a little assistance. I use this code.
Code:
[System.Runtime.InteropServices.DllImport("user32", EntryPoint = "FindWindowA")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[System.Runtime.InteropServices.DllImport("user32", EntryPoint = "FindWindowExA")]
private static extern IntPtr FindWindowEx(IntPtr hWnd1, IntPtr hWnd2, string lpsz1, string lpsz2);
[System.Runtime.InteropServices.DllImport("user32")]
private static extern IntPtr ShowWindow(IntPtr hwnd, int nCmdShow);
[System.Runtime.InteropServices.DllImport("user32", EntryPoint = "SetWindowTextA")]
private static extern bool SetWindowText(IntPtr hWnd, string lpString);
[System.Runtime.InteropServices.DllImport("user32")]
private static extern int EnableWindow(IntPtr hWnd, bool bEnable);
[System.Runtime.InteropServices.DllImport("user32", EntryPoint = "GetWindowTextA")]
private static extern int GetWindowText(IntPtr hWnd, string lpString, int nMaxCount);
[System.Runtime.InteropServices.DllImport("user32", EntryPoint = "SendMessageA")]
private static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam);
private const int WM_LBUTTONDOWN = 513;
private const int WM_LBUTTONUP = 514;
private const int SW_HIDE = 0;
private const int SW_SHOW = 5;
private const int SW_MINIMIZE = 6;
private const int SW_MAXIMIZE = 3;
private const int SW_RESTORE = 9;
public static void EnableTaskBar()
{
IntPtr Taskbar;
Taskbar = FindWindow("TfrmWinDowse", null);
EnableWindow(Taskbar, true);
}
To enable or disable A window. Now I want to take it one step further. How do I make an item like a check box, enabled or disabled. So if there was a check box or a button on a window, any window how could I enable/Disable it.
-
Re: API Help
You can get the handle of the child window (which in your case is a checkbox) using FindWindowEx.
Take a look at the following
FindWindowEX On MSDN
FindWindowEx API in C#
-
Re: API Help