Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, everybody!
I Need your Help. I develop Dll witch send string to active application (using Windows API). If I implement DLL To WINFORM this work, but in windows Service work not correct. Can not see string!
Please tell me what is the way to show message!
thanks!
Posted
Comments
Kornfeld Eliyahu Peter 22-Mar-15 9:07am    
What string?
How do you send it?
Where do you expect to see it?
Please clarify you question - probably with code details...
Member 11268440 23-Mar-15 4:30am    
Thank you for Comment!
1. Any String
2. I try SendKeys.WaitSend... And SendMessage Method Of user32.dll
3. i want to see my string on notepad blank or Word Document...


The code for Example:
GlobalData.SetForegroundWindow(GetTaskWindows()); //user32.dll implements
SendKeys.SendWait(Encoding.Default.GetString(data));

or

GlobalData.SendMessage(GetTaskWindows(), GlobalData.WM_SETTEXT, IntPtr.Zero, _
new StringBuilder(Encoding.Default.GetString(data)));

private IntPtr GetTaskWindows()
{
// Get the desktopwindow handle
IntPtr nDeshWndHandle = GlobalData.GetDesktopWindow();
// Get the first child window
IntPtr nChildHandle = GlobalData.GetForegroundWindow();

return GlobalData.FindWindowEx(nChildHandle, IntPtr.Zero , "Edit", null);
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900