Click here to Skip to main content
15,915,093 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# Application - SQL Syntax Problem Pin
PIEBALDconsult14-Sep-13 17:17
mvePIEBALDconsult14-Sep-13 17:17 
GeneralRe: C# Application - SQL Syntax Problem Pin
Member 1026694315-Sep-13 11:03
Member 1026694315-Sep-13 11:03 
AnswerRe: C# Application - SQL Syntax Problem Pin
Dave Kreskowiak14-Sep-13 19:12
mveDave Kreskowiak14-Sep-13 19:12 
QuestionGet the value of RepositoryItemPictureEdit in GridControl Pin
nhanlaptrinh14-Sep-13 9:26
nhanlaptrinh14-Sep-13 9:26 
AnswerRe: Get the value of RepositoryItemPictureEdit in GridControl Pin
Richard MacCutchan14-Sep-13 21:45
mveRichard MacCutchan14-Sep-13 21:45 
QuestionDLLIMPORT - SENDMESSAGE Pin
M Riaz Bashir14-Sep-13 5:01
M Riaz Bashir14-Sep-13 5:01 
AnswerRe: DLLIMPORT - SENDMESSAGE Pin
Richard MacCutchan14-Sep-13 5:42
mveRichard MacCutchan14-Sep-13 5:42 
AnswerRe: DLLIMPORT - SENDMESSAGE Pin
TnTinMn14-Sep-13 8:39
TnTinMn14-Sep-13 8:39 
Give these definitions a try.
C#
[DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, [MarshalAs(UnmanagedType.LPStr)] StringBuilder lParam);

[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, string windowTitle);


The reason for the FindWindowEx is so that you can find the child window that contains the text. If you use the MainWindowHandle, you will retrieve the window title. You need to find the child window whose class name is "Edit".

Also give the string builder an ample initial size. The default size is 16 characters.

I will leave it to you to write the logic to compare the returned number of characters against the stringbuilder's "Capacity" property to determine if you got all the text. If returned length is Capacity -1, there may be more text that you did not retrieve.

C#
Process[] processes = Process.GetProcessesByName("notepad");
foreach (Process p in processes)
{
    string myGotWindow = p.MainWindowTitle;
    IntPtr pEditWindow = FindWindowEx(p.MainWindowHandle, IntPtr.Zero, "Edit", null);

    const uint WM_GETTEXT = 0x0D;
    StringBuilder sb =  new StringBuilder(1000);
    IntPtr retVal = SendMessage(pEditWindow, WM_GETTEXT, (IntPtr)sb.Capacity, sb);
    textBox1.Text = sb.ToString();
}

QuestionHelp Regarding Source Code Of Meshack Pin
Caiser Mahmood13-Sep-13 23:34
Caiser Mahmood13-Sep-13 23:34 
AnswerRe: Help Regarding Source Code Of Meshack Pin
Abhinav S14-Sep-13 0:51
Abhinav S14-Sep-13 0:51 
GeneralRe: Help Regarding Source Code Of Meshack Pin
Richard MacCutchan14-Sep-13 1:17
mveRichard MacCutchan14-Sep-13 1:17 
QuestionHow can I change "zoom" value in print preview dialog ? Pin
babak1413-Sep-13 21:51
babak1413-Sep-13 21:51 
AnswerRe: How can I change "zoom" value in print preview dialog ? Pin
Abhinav S13-Sep-13 22:18
Abhinav S13-Sep-13 22:18 
GeneralRe: How can I change "zoom" value in print preview dialog ? Pin
babak1413-Sep-13 22:30
babak1413-Sep-13 22:30 
QuestionHow can I maximize print preview dialog ? Pin
babak1413-Sep-13 21:46
babak1413-Sep-13 21:46 
Questionembedding external application into from panel Pin
eng.iris13-Sep-13 13:11
eng.iris13-Sep-13 13:11 
AnswerRe: embedding external application into from panel Pin
BillWoodruff13-Sep-13 16:25
professionalBillWoodruff13-Sep-13 16:25 
GeneralRe: embedding external application into from panel Pin
eng.iris13-Sep-13 17:14
eng.iris13-Sep-13 17:14 
Questionproblem with time field in MySQL Pin
Jassim Rahma13-Sep-13 12:24
Jassim Rahma13-Sep-13 12:24 
AnswerRe: problem with time field in MySQL Pin
Midnight Ahri13-Sep-13 14:02
Midnight Ahri13-Sep-13 14:02 
AnswerRe: problem with time field in MySQL Pin
Richard MacCutchan13-Sep-13 22:32
mveRichard MacCutchan13-Sep-13 22:32 
GeneralRe: problem with time field in MySQL Pin
Jassim Rahma14-Sep-13 10:15
Jassim Rahma14-Sep-13 10:15 
GeneralRe: problem with time field in MySQL Pin
Jassim Rahma14-Sep-13 10:28
Jassim Rahma14-Sep-13 10:28 
GeneralRe: problem with time field in MySQL Pin
Richard MacCutchan14-Sep-13 21:05
mveRichard MacCutchan14-Sep-13 21:05 
AnswerRe: problem with time field in MySQL Pin
Richard Deeming16-Sep-13 2:12
mveRichard Deeming16-Sep-13 2: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.