LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

FileSelectPopup () does not respond to "FakeKeystroke()" or SDK "keybd_event()".

I'm trying to create a "timed" version of FileSelectPopup, which will offer a file-name to the user, and if there is no response after a short time period (10 seconds or so), the FileSelectPopup returns with the offered file-name. Since many of our tests run overnight, unattended, this would be a great way to place test data into different file locations in the absence of user-intervention... Yet, if the test is running in attended-mode, the user can place their own filename/location inside the popup as they normally would.

I figured that one easy way to do this was to use the FakeKeystroke () CVI library function inside a separate thread fired off just before the FakeKeystroke () function
(using the "Enter" key to dismiss the popup) that does the key-press while the modal dialog box is open. I'm finding that this doesn't work for this particular modal dialog box.

Another tactic I tried is the Windows SDK function "keybd_event". but again FileSelectPopup does not respond.

Right now I am about to build my own FileSelectPopup using the Windows "GetOpenFileName" function. Seems to me this is overkill, though...

So tell me, what do you think I'm doing wrong?

Thanks for any help from anybody...

DAB
--
To whom it may concern: My alias is also my nickname, I've had it since I was a (very) skinny basketball-playing teen. OK, so I've got a 38 inch waist now, but my hometown friends haven't shaken that appellation for me. I trust that you will someday be OK with that alias, as I have been with that nickname.
0 Kudos
Message 1 of 2
(3,340 Views)
Hello

I think what might be happening is that the filepopup window does not have focus, thats why it seems that the fake keystroke function is not responding.

So you can try one of the SDK functions that brings the window in the front or you can just post a close message to the window to shut it down.

So something like

#include //include this as the very first
//include to avoid compiler errors.
//Have some timeout code here for your thread

hWindow=FindWindow(NULL,"");
if (hWindow)
{
PostMessage(hWindow,WM_CLOSE,0,0);
}

I hope this helps

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 2
(3,340 Views)