I'm trying to write automation to a test a web site with C#.
I'm using selenium web driver but it cannot interact with native windows. so i'm using winAPI to control a dialog window.
I am trying to automaticly upload a file by interacting with the Dialog window.
I have managed to get a handle on the window using the following code:
publicconstint WM_SYSCOMMAND = 0x0112;
publicconstint SC_CLOSE = 0xF060;
publicconstint WM_SETTEXT = 0x000C;
// retrieve the handler of the windowint iHandle = FindWindow("#32770", "File Upload");
if (iHandle >0)
//Choose File - using a string with the file path//Press OK
What I need to do next is choose the file to upload and then press OK to approve.
It seems like a little wrong thread, but with C++ I'd like this:
// After obtaining the dialog window handle, get the filename edit-window handle:
HANDLE hEdit=FindWindowEx(iHandle,NULL,"EDIT",NULL);// There should be only one edit window// Update edit control:
SetWindowText(hEdit,"full filename you need");
// Simulate OK:
// Update edit control:
SetDlgItemText(iHandle,[Edit control ID],"full filename you need");
// Simulate OK:
Obtain [Edit control ID] with Spy++, it must be a constant.
I'm trying to handle mouse wheel events in the WndProc function and wrote c++ code that works fine with one mouse that has a fly-wheel. I tried the same code with another mouse and I get endless WM_MOUSEWHEEL events when I move the mouse wheel just one notch.
Anyone know why this is happening?
You haven't posted any code or shown what any of the "extra" WM_MOUSEWHEEL events you are getting look like and unfortunately, my crystal ball is in the shop, so you might want to post that kind of information. My guess is that its something in your code, but until I see the messages or your code, I can't really give you any advice beyond that. Darn crystal ball shop, they are taking FOREVER to get my ball fixed.