I'm trying to write a C# code that handles file uploading automaticly. The follow I need to implement is to choose a file from an open file dialog:
I managed to find the window using users32.dll FindWindow() method.
But i have no idea how to set the input if the dialog and approve the chosen file (choose a file & press OK).
My Code so far:
[DllImport("user32.dll")]
public static extern int FindWindow(string lpClassName, string lpWindowName);
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_CLOSE = 0xF060;
public const int WM_SETTEXT = 0x000C;
private void ChooseFile()
{
// retrieve the handler of the window
int iHandle = FindWindow("#32770", "File Upload");
if (iHandle > 0)
{
//Choose File
//Press OK
}
}
Any help will be much appreciated.