Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

SendKeys using ScanCodes for Citrix

0.00/5 (No votes)
4 Jan 2012 1  
A modified version of Sendkeys to allow sending of Keys to Citrix

Introduction

Your proboly here becasue you are tring to automate login or someother Citrix process and found that the .net Sendkeys does not work with Citrix, or at least the TAB and ENTER keys don't.

Background

I searched high a low as to why I could not send TAB and Enter to Citrix when I found this codeproject artical. http://www.codeproject.com/KB/system/keyboard.aspx. According to posts on the net no application has used ScanCodes for input since 1998 and I guess becasue of this Microsoft never but them in SendKeys. Anyways I reflected the MS sendkeys Class and added the ability to send ScanCodes. The Artical above had both Make and Break Scan Codes. Not sure the difference but Make works for Citrix.

Using the code

Add the SendKeysPlus Code to you Project and then Call SendKeysPlus.SendWait like you normoly would but tell what ScanCodeMode to Use. ScanCodeMode of None will work like normal SendKeys.

    ' Just like when using the Normal SendKeys the Application Must have focus When Called
    SendKeysPlus.SendWait("Username{TAB}Password{ENTER}",SendKeysPlus.ScanCodeModes.Make)
        

Points of Interest

I am not certain why Citrix is using scancode other then its a way they can send extended normoly none valid keystrokes to the Citrix Server.

History

Keep a running update of any changes or improvements you've made here.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here