Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SendInput Function
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
SendInput Function
Miscellaneous
Thread ID:
00814808
Message ID:
00814808
Views:
241
I am having FoxPro (version 7) create an Internet Explorer com object and web sight connection. When the connection is made a login screen comes up requesting a user name and password. Because I can't see the underlying HTML code for this pop-up screen, I can't get the I.E. object text box names to send the user name and password to. Therefore, I must use the Win32API SendInput function to simulate keystrokes in the pop-up window. However, from the “West-Winds” Internet site Rick Strahl correctly informed me that, “You can't send FoxPro arrays to API functions as they are not in the right format.” He suggested I use the STRUCT class developed by Christof Lange to handle the sending of complex structures to Windows API’s. However, every time I use that class I get a return code of zero. I retrieved extended error information about the return code which says, “The parameter is incorrect.”

Below is my implementation of the STRUCT class. Until I can get the SendInput function to work right I am only including one input keyboard event in order to make the code as simple as possible for testing.

SET CLASSLIB TO STRUCT, WINSTRUCT ADDITIVE

PUBLIC goStruct, gcStruct, gn1, gn2

DECLARE INTEGER SendInput IN USER32.dll ;
INTEGER NumberOfElementsInArray, ;
STRING @gcStruct, ;
INTEGER InputSizeOfASingleInputArrayStructure

goStruct = CREATEOBJECT('KeyboardInput')
goStruct.dwType = 1
goStruct.wVk = 59 && Press the “S” key
goStruct.wScan = 0
goStruct.dwFlags = 0
goStruct.dwTime = 0
goStruct.dwExtraInfo = 0

gcStruct = goStruct.GetString()
gn2 = goStruct.SizeOf()

oIE = CREATEOBJECT("InternetExplorer.Application")
oIE.Visible = .T.
oIE.Navigate("https://mailbox.zionsbank.com/webmailbox")

WAIT WINDOW 'Make sure that the Zions Bank logon screen appears' TIMEOUT 5

gn1 = SendInput(1, @gcStruct, gn2)

WAIT WINDOW LTRIM(STR(gn1,10,0)) && Display the result of SendInput API.

RETURN .T.


DEFINE CLASS KeyboardInput as Struct
dwType = 0
wVk = 0
wScan = 0
dwFlags = 0
dwTime = 0
dwExtraInfo = 0
cMembers = 'l:dwType, w:wVk, w:wScan, l:dwFlags, l:dwTime, pul:dwExtraInfo'
ENDDEFINE

Can anyone see what I am doing wrong?

Thank you for your help!!
Brent L. Hackett
Next
Reply
Map
View

Click here to load this message in the networking platform