Click here to Skip to main content
15,893,564 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to copy files in a folder tree into a single folder Pin
Krishnaraj Barvathaya B5-Mar-08 5:48
Krishnaraj Barvathaya B5-Mar-08 5:48 
GeneralRe: How to copy files in a folder tree into a single folder Pin
Anthony Mushrow5-Mar-08 6:03
professionalAnthony Mushrow5-Mar-08 6:03 
GeneralRe: How to copy files in a folder tree into a single folder Pin
pmarfleet5-Mar-08 8:32
pmarfleet5-Mar-08 8:32 
GeneralRe: How to copy files in a folder tree into a single folder Pin
Pete O'Hanlon5-Mar-08 1:32
mvePete O'Hanlon5-Mar-08 1:32 
GeneralUnable to access SQL Reports in C#.Net windows application Pin
Vinay Babu4-Mar-08 23:20
Vinay Babu4-Mar-08 23:20 
GeneralRe: Unable to access SQL Reports in C#.Net windows application Pin
pmarfleet5-Mar-08 1:27
pmarfleet5-Mar-08 1:27 
GeneralRe: Unable to access SQL Reports in C#.Net windows application Pin
Paul Conrad5-Mar-08 4:32
professionalPaul Conrad5-Mar-08 4:32 
QuestionHow do I write to another window through a C# form [modified] Pin
Deresen4-Mar-08 23:07
Deresen4-Mar-08 23:07 
Hello everyone,

I'm making a program, but I'm (obviously) stuck with a problem.

I want to write a message to the current topscreen through a C# application.
For instance: when you open Microsoft Word and you type 'hello' it will double the word like this 'hheelllloo'.

The application allready knows when a key is pushed, now the only thing that will have to be done is write a message to the current top window (like word or notepad or whatever window is open and where you are typing in).
I guess that this is possible with something like PostMessage and GetTopWindow. But it won't work. Can anybody tell me what I'm doing wrong? Or can someone tell me what will work?

Thank you allready.


This is what I have:
[DllImport("user32.dll")]
public static extern int GetTopWindow(int hwnd);
[DllImport("user32.dll")]
public static extern int PostMessage(int hWnd, uint Msg, int wParam, uint lParam);

//..code
const int VK_KEY = 0x41;
const int WM_CHAR = 0x0102;

int WindowToFind = GetTopWindow(0);
Console.WriteLine(WindowToFind);
int result = PostMessage(WindowToFind, WM_CHAR, VK_KEY, 0);
Console.WriteLine(result);


The output for result is always 1.
The output for WindowToFind is different, sometimes it gives the same value at different windows. Sometimes a different value. One of the outcome of WindowToFind is 131138




edit:
Allright... finaly I found out the anwser to my problem (after hours of searching :P).

I just had to use the SendKeys class.
   SendKeys.SendWait("<value>");
</value>


modified on Wednesday, March 5, 2008 5:42 AM

AnswerRe: How do I write to another window through a C# form Pin
V.4-Mar-08 23:48
professionalV.4-Mar-08 23:48 
GeneralBackgroundworker in .NET1.1 [modified] Pin
SPanicker*4-Mar-08 22:58
SPanicker*4-Mar-08 22:58 
GeneralRe: Backgroundworker in .NET1.1 Pin
N a v a n e e t h4-Mar-08 23:38
N a v a n e e t h4-Mar-08 23:38 
GeneralRe: Backgroundworker in .NET1.1 Pin
SPanicker*6-Mar-08 2:07
SPanicker*6-Mar-08 2:07 
Generalstandard controls graphical properties Pin
cignox14-Mar-08 22:57
cignox14-Mar-08 22:57 
GeneralAdding Contact in ACtive directory and reflecting it in Exchange server. Pin
amitcoder834-Mar-08 22:45
amitcoder834-Mar-08 22:45 
QuestionHow to monitor opened serial port by C# Pin
Digital Hyper4-Mar-08 22:39
Digital Hyper4-Mar-08 22:39 
AnswerRe: How to monitor opened serial port by C# Pin
Luc Pattyn5-Mar-08 6:12
sitebuilderLuc Pattyn5-Mar-08 6:12 
QuestionHow to call VC++ ActiveX.exe in C# with ASP.Net Pin
Parvesh K Bansal4-Mar-08 22:06
Parvesh K Bansal4-Mar-08 22:06 
GeneralSerial Port communication Pin
t_nedelchev4-Mar-08 21:17
t_nedelchev4-Mar-08 21:17 
GeneralRe: Serial Port communication - Repost! Pin
DaveyM694-Mar-08 22:29
professionalDaveyM694-Mar-08 22:29 
GeneralRe: Serial Port communication Pin
Bekjong4-Mar-08 22:30
Bekjong4-Mar-08 22:30 
GeneralRe: Serial Port communication Pin
Himansu Sekhar Nayak2-Aug-08 1:03
Himansu Sekhar Nayak2-Aug-08 1:03 
QuestionHow to overload assignment operator in C# Pin
bankey10104-Mar-08 20:10
bankey10104-Mar-08 20:10 
AnswerRe: How to overload assignment operator in C# Pin
Giorgi Dalakishvili4-Mar-08 20:17
mentorGiorgi Dalakishvili4-Mar-08 20:17 
AnswerRe: How to overload assignment operator in C# Pin
SPanicker*4-Mar-08 23:12
SPanicker*4-Mar-08 23:12 
AnswerRe: How to overload assignment operator in C# Pin
Luc Pattyn5-Mar-08 6:19
sitebuilderLuc Pattyn5-Mar-08 6:19 

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.