Click here to Skip to main content
15,911,327 members
Home / Discussions / C#
   

C#

 
Questionoveride column header clicked behaviour Pin
swjam13-Jan-07 19:38
swjam13-Jan-07 19:38 
Questionmulti-tab Browser Pin
dsl/fahk13-Jan-07 17:16
dsl/fahk13-Jan-07 17:16 
AnswerRe: multi-tab Browser Pin
Christian Graus13-Jan-07 19:01
protectorChristian Graus13-Jan-07 19:01 
QuestionPaste clipboard value to remote application. Pin
sampath Jayasinghe13-Jan-07 15:02
sampath Jayasinghe13-Jan-07 15:02 
AnswerRe: Paste clipboard value to remote application. Pin
Luc Pattyn13-Jan-07 19:13
sitebuilderLuc Pattyn13-Jan-07 19:13 
QuestionRe: Paste clipboard value to remote application. Pin
sampath Jayasinghe14-Jan-07 12:57
sampath Jayasinghe14-Jan-07 12:57 
AnswerRe: Paste clipboard value to remote application. Pin
Luc Pattyn14-Jan-07 13:22
sitebuilderLuc Pattyn14-Jan-07 13:22 
AnswerRe: Paste clipboard value to remote application. [modified] Pin
Luc Pattyn14-Jan-07 13:25
sitebuilderLuc Pattyn14-Jan-07 13:25 
Hi Sampathg,

same message with "ignore HTML tags" !

If I understand you correctly, you have a window belonging to some fixed program (the remote desktop app), and when you click a textbox in there, then type ^V, the paste works (and
the pasted stuff probably shows up on the local and the remote PC). Thats what we all expect.

So now you want to programmatically do the same. I guess you need the handle of the textbox
and do the SendMessage stuff. Getting the handle is somewhat tricky; you first need the
handle of the form, then find the textbox in the form's hierarchy of controls.
The only way I know consists of:
- the Win32 methods EnumWindows() and EnumChildWindows()
remember every control that is or can be visible in the end is a window
remark: it can be nested, just like you can put a button in a panel in a panel in a form.
- a lot of trial and error to identify the right window from the many available
(at first type a known text in the textbox, and try to copy it sending ^C,
you should get label texts and other things you may be able to recognize

I tend to be careful with the code inside the callback method, and do as much as possible
outside it (hence the ArrayList in the example below).

FYI I once wrote:

<pre>
/// <summary>
/// delegate used for EnumWindows() callback function
/// </summary>
public delegate bool LP_EnumWindowsProc(IntPtr hWnd, int lParam);

/// <summary>
/// Gets a collection of all visible windows on the desktop.
/// </summary>
/// <returns></returns>
/// <remarks>The result may include some minimized windows too !</remarks>
public static ArrayList GetVisibleWindowHandles() {
lock(env) {
list=new ArrayList();
EnumWindows(new LP_EnumWindowsProc(CollectVisibleWindows), 0);
env.log(env.DETAIL1, "There are "+list.Count+" visible windows");
return list;
}
}

private static bool CollectVisibleWindows(IntPtr hWnd, int lParam) {
IntPtr ptr=(IntPtr)hWnd;
if (IsWindowVisible(ptr)) {
list.Add(ptr);
}
return true; // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< correction !
}

/// <summary>
/// Enumerate all windows, calling a delegate for each of them.
/// </summary>
/// <param name="ewp"></param>
/// <param name="lParam"></param>
/// <returns></returns>
[DllImport("user32.dll", CallingConvention=CallingConvention.StdCall)]
public static extern int EnumWindows(LP_EnumWindowsProc ewp, object lParam);

/// <summary>
/// Determines whether a window is visible.
/// </summary>
/// <param name="hWnd"></param>
/// <returns></returns>
[DllImport("user32.dll", CallingConvention=CallingConvention.StdCall)]
public static extern bool IsWindowVisible(IntPtr hWnd);
</pre>

Final remark:
you might want to experiment first with a very simple target program that you develop
yourself. Window handle values are system wide so your test target program could obtain
and display the handle you are interested in, just so you can check it.


Hope this helps.

Smile | :)


Luc Pattyn




-- modified at 22:43 Sunday 14th January, 2007
AnswerRe: Paste clipboard value to remote application. Pin
Luc Pattyn14-Jan-07 13:42
sitebuilderLuc Pattyn14-Jan-07 13:42 
GeneralRe: Paste clipboard value to remote application. Pin
sampath Jayasinghe14-Jan-07 17:10
sampath Jayasinghe14-Jan-07 17:10 
GeneralRe: Paste clipboard value to remote application. Pin
Luc Pattyn14-Jan-07 17:57
sitebuilderLuc Pattyn14-Jan-07 17:57 
GeneralRe: Paste clipboard value to remote application. Pin
sampath Jayasinghe15-Jan-07 16:41
sampath Jayasinghe15-Jan-07 16:41 
QuestionAutocomplete -> BindingSource -> Position change Pin
Glen Harvy13-Jan-07 14:09
Glen Harvy13-Jan-07 14:09 
QuestionSetting a default value for a datagridviewtextbox column Pin
bluewavestrider13-Jan-07 12:07
bluewavestrider13-Jan-07 12:07 
AnswerRe: Setting a default value for a datagridviewtextbox column Pin
Lisa Jorgensen13-Jan-07 15:14
Lisa Jorgensen13-Jan-07 15:14 
GeneralRe: Setting a default value for a datagridviewtextbox column Pin
bluewavestrider14-Jan-07 4:45
bluewavestrider14-Jan-07 4:45 
Questionhow to read status registers of parallel port Pin
George-Lucian13-Jan-07 11:44
George-Lucian13-Jan-07 11:44 
AnswerRe: how to read status registers of parallel port Pin
Phillip M. Hoff13-Jan-07 11:59
Phillip M. Hoff13-Jan-07 11:59 
QuestionA multithreading "best practice" question! Pin
Nader Elshehabi13-Jan-07 10:58
Nader Elshehabi13-Jan-07 10:58 
AnswerRe: A multithreading "best practice" question! Pin
Phillip M. Hoff13-Jan-07 11:38
Phillip M. Hoff13-Jan-07 11:38 
GeneralRe: A multithreading "best practice" question! Pin
Nader Elshehabi13-Jan-07 12:28
Nader Elshehabi13-Jan-07 12:28 
GeneralRe: A multithreading "best practice" question! Pin
Phillip M. Hoff13-Jan-07 14:25
Phillip M. Hoff13-Jan-07 14:25 
GeneralRe: A multithreading "best practice" question! Pin
Nader Elshehabi14-Jan-07 9:02
Nader Elshehabi14-Jan-07 9:02 
QuestionXNA requirement or Direct x 9 works fine with C#...or OpenGL Pin
Software_Specialist13-Jan-07 10:48
Software_Specialist13-Jan-07 10:48 
AnswerRe: XNA requirement or Direct x 9 works fine with C#...or OpenGL Pin
Nader Elshehabi13-Jan-07 11:12
Nader Elshehabi13-Jan-07 11:12 

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.