Click here to Skip to main content
16,008,299 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to load file to webbrowser control from richtextbox ? Pin
BeiJing200827-Jul-04 17:22
BeiJing200827-Jul-04 17:22 
GeneralRe: How to load file to webbrowser control from richtextbox ? Pin
Heath Stewart27-Jul-04 17:57
protectorHeath Stewart27-Jul-04 17:57 
GeneralRe: How to load file to webbrowser control from richtextbox ? Pin
BeiJing200827-Jul-04 19:26
BeiJing200827-Jul-04 19:26 
GeneralRe: How to load file to webbrowser control from richtextbox ? Pin
BeiJing200827-Jul-04 19:42
BeiJing200827-Jul-04 19:42 
GeneralRe: How to load file to webbrowser control from richtextbox ? Pin
Heath Stewart28-Jul-04 3:53
protectorHeath Stewart28-Jul-04 3:53 
GeneralRe: How to load file to webbrowser control from richtextbox ? Pin
BeiJing200827-Jul-04 20:31
BeiJing200827-Jul-04 20:31 
GeneralRe: How to load file to webbrowser control from richtextbox ? Pin
Heath Stewart28-Jul-04 4:00
protectorHeath Stewart28-Jul-04 4:00 
GeneralSendInput Citrix Alt and Ctrl Keys Pin
Gregory Webb26-Jul-04 4:26
Gregory Webb26-Jul-04 4:26 
I need to either send a Ctrl + K or Alt key combos to walk through the menu of a Citrix Application. Sendkeys does not work. Keybd_event does not work. I can't get SendInput to work at all.

Using Keybd_event I created a app that sent a alt key with no Keyup. I can open any program and it responds as if I have the alt key deppressed except Citrix apps. I can press the Alt key on the keyboard and it works fine.

Will SendInput solve my problem? If so what am I doing wrong?

namespace SendInputTest
{
public struct INPUT
{
public int type;
public KEYBDINPUT ki;
}

public struct KEYBDINPUT
{
public ushort wVK;
public ushort wScan;
public uint dwFlags;
public uint time;
public IntPtr dwExtraInfo;
}

public class Form1 : System.Windows.Forms.Form
{

[DllImport("User32")]
private static extern int SetForegroundWindow(int hwnd);


[DllImport("User32")]
private static extern int FindWindow(string ipClass, string ipWindowName);

[ DllImport("user32.dll") ]

static extern int GetForegroundWindow();

[ DllImport("user32.dll") ]

static extern int GetWindowText(int hWnd, StringBuilder text, int count);

const int nChars = 256;

[ DllImport("user32.dll", SetLastError=true) ]
public static extern int SendInput(int nInputs, ref INPUT[] pInputs, int cbSize);

[ DllImport("user32.dll") ]
public static extern int GetMessageExtraInfo();

[ DllImport("user32.dll", SetLastError=true) ]
public static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, uint dwExtraInfo );

const int KEYEVENTF_KEYUP = 0x0002;
const int KEYEVENTF_SCANCODE = 0x0008;
const int INPUT_KEYBOARD = 1;




private void button1_Click(object sender, System.EventArgs e)
{
int hWND = 0;
int handle =0;
hWND = FindWindow(null,@"Untitled - Notepad");

do
{
handle = GetForegroundWindow();
SetForegroundWindow(hWND);
}while (hWND != handle);


unsafe
{
int rs = 0;

INPUT[] input = new INPUT[1];

input[0].type = INPUT_KEYBOARD;
input[0].ki.wVK = 0x41;
input[0].ki.wScan = 0;
input[0].ki.dwFlags = 0;
input[0].ki.time = 0;
input[0].ki.dwExtraInfo = IntPtr.Zero;
System.Threading.Thread.Sleep(2000);
rs = SendInput(1, ref input, sizeof(INPUT));


input[0].ki.dwFlags = KEYEVENTF_KEYUP;
rs = SendInput(1, ref input, sizeof(INPUT));


}



}
}

GeneralRe: SendInput Citrix Alt and Ctrl Keys Pin
Heath Stewart26-Jul-04 11:26
protectorHeath Stewart26-Jul-04 11:26 
GeneralRe: SendInput Citrix Alt and Ctrl Keys Pin
GTWebb27-Jul-04 2:23
GTWebb27-Jul-04 2:23 
GeneralRe: SendInput Citrix Alt and Ctrl Keys Pin
Heath Stewart27-Jul-04 4:03
protectorHeath Stewart27-Jul-04 4:03 
GeneralRe: SendInput Citrix Alt and Ctrl Keys Pin
GTWebb28-Jul-04 4:25
GTWebb28-Jul-04 4:25 
GeneralRe: SendInput Citrix Alt and Ctrl Keys Pin
Heath Stewart28-Jul-04 4:43
protectorHeath Stewart28-Jul-04 4:43 
GeneralRe: SendInput Citrix Alt and Ctrl Keys Pin
GTWebb28-Jul-04 13:18
GTWebb28-Jul-04 13:18 
GeneralFull Screen Notification. Pin
LokiSD26-Jul-04 2:22
LokiSD26-Jul-04 2:22 
GeneralRe: Full Screen Notification. Pin
Heath Stewart26-Jul-04 10:39
protectorHeath Stewart26-Jul-04 10:39 
Generaladd item to Outlooks contactmenu Pin
Stephan Wright26-Jul-04 1:41
Stephan Wright26-Jul-04 1:41 
GeneralRe: add item to Outlooks contactmenu Pin
Heath Stewart26-Jul-04 10:54
protectorHeath Stewart26-Jul-04 10:54 
GeneralRe: add item to Outlooks contactmenu Pin
Stephan Wright26-Jul-04 12:45
Stephan Wright26-Jul-04 12:45 
GeneralRe: add item to Outlooks contactmenu Pin
Heath Stewart26-Jul-04 13:38
protectorHeath Stewart26-Jul-04 13:38 
GeneralRe: add item to Outlooks contactmenu Pin
Heath Stewart26-Jul-04 19:01
protectorHeath Stewart26-Jul-04 19:01 
GeneralCustom ListView - XP theme Pin
Andy H26-Jul-04 1:06
Andy H26-Jul-04 1:06 
GeneralRe: Custom ListView - XP theme Pin
Heath Stewart26-Jul-04 11:21
protectorHeath Stewart26-Jul-04 11:21 
GeneralCustom ListView - XP theme Pin
Andy H26-Jul-04 1:06
Andy H26-Jul-04 1:06 
GeneralDrawing Control Pin
blankg25-Jul-04 23:47
blankg25-Jul-04 23:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.