Click here to Skip to main content
15,915,019 members
Home / Discussions / Windows Forms
   

Windows Forms

 
AnswerRe: findwindowex and gettext ??? Pin
Dave Kreskowiak6-Oct-08 3:21
mveDave Kreskowiak6-Oct-08 3:21 
QuestionHow to Display Owned Window without graying owner? Pin
Safdii5-Oct-08 1:28
Safdii5-Oct-08 1:28 
AnswerRe: How to Display Owned Window without graying owner? Pin
Thomas Stockwell5-Oct-08 6:07
professionalThomas Stockwell5-Oct-08 6:07 
QuestionRe: How to Display Owned Window without graying owner? [modified] Pin
Safdii6-Oct-08 23:17
Safdii6-Oct-08 23:17 
AnswerRe: How to Display Owned Window without graying owner? Pin
Thomas Stockwell10-Oct-08 4:35
professionalThomas Stockwell10-Oct-08 4:35 
QuestionHTML Editor Control & Grid Control Pin
Atlence3-Oct-08 22:40
Atlence3-Oct-08 22:40 
AnswerRe: HTML Editor Control & Grid Control Pin
Siddhartha S.5-Oct-08 17:57
Siddhartha S.5-Oct-08 17:57 
QuestionRich Text Box Font Setting Question Pin
Siddhartha S.2-Oct-08 23:00
Siddhartha S.2-Oct-08 23:00 
QuestionRe: Rich Text Box Font Setting Question Pin
led mike3-Oct-08 4:39
led mike3-Oct-08 4:39 
AnswerRe: Rich Text Box Font Setting Question Pin
Siddhartha S.5-Oct-08 17:31
Siddhartha S.5-Oct-08 17:31 
Questionhow to get text with api ??? Pin
TALHAKOSEN2-Oct-08 11:23
TALHAKOSEN2-Oct-08 11:23 
AnswerRe: how to get text with api ??? Pin
Giorgi Dalakishvili2-Oct-08 23:47
mentorGiorgi Dalakishvili2-Oct-08 23:47 
GeneralRe: how to get text with api ??? Pin
TALHAKOSEN3-Oct-08 3:04
TALHAKOSEN3-Oct-08 3:04 
GeneralRe: how to get text with api ??? Pin
Giorgi Dalakishvili3-Oct-08 3:09
mentorGiorgi Dalakishvili3-Oct-08 3:09 
GeneralRe: how to get text with api ??? Pin
TALHAKOSEN3-Oct-08 4:41
TALHAKOSEN3-Oct-08 4:41 
Generalthats ok ! If somebody needs Pin
TALHAKOSEN3-Oct-08 6:07
TALHAKOSEN3-Oct-08 6:07 
GeneralRe: how to get text with api ??? Pin
led mike3-Oct-08 4:35
led mike3-Oct-08 4:35 
GeneralRe: how to get text with api ??? Pin
Giorgi Dalakishvili3-Oct-08 5:24
mentorGiorgi Dalakishvili3-Oct-08 5:24 
GeneralRe: how to get text with api ??? Pin
led mike3-Oct-08 5:30
led mike3-Oct-08 5:30 
GeneralRe: how to get text with api ??? Pin
TALHAKOSEN3-Oct-08 6:05
TALHAKOSEN3-Oct-08 6:05 
AnswerRe: how to get text with api ??? Pin
WinSolution5-Nov-08 18:30
WinSolution5-Nov-08 18:30 
GeneralRe: how to get text with api ??? Pin
TALHAKOSEN6-Nov-08 3:45
TALHAKOSEN6-Nov-08 3:45 
it takes the button names on calculator

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace apiGetText
{
public partial class Form1 : Form
{
private const int WM_GETTEXT = 0x000D;
private const int WM_SETTEXT = 0x000C;
private const int WM_GETTEXTLENGTH = 0x000E;


[DllImport("User32.dll")]
public static extern uint GetMenuItemID(int hMenu, int nPos);

[DllImport("User32.dll")]
public static extern int FindWindow(
String lpClassName,
String lpWindowName);

[DllImport("user32.dll")]
private static extern int FindWindowEx(
int parentHandle,
int childAfter,
string className,
string windowTitle);

[DllImport("User32.dll")]
public static extern Int32 SendMessage(
int hWnd, // handle to destination window
int Msg, // message
IntPtr wParam, // first message parameter
StringBuilder lParam);

[DllImport("User32.dll")]
public static extern Int32 SendMessage(
int hWnd, // handle to destination window
int Msg, // message
IntPtr wParam, // first message parameter
IntPtr lParam); // second message parameter




private void button1_Click(object sender, EventArgs e)
{
int calculatorHwnd;
int btnHwndGrp;


// youcan find SciCalc on spy++ --- > findwindow ----> classname

calculatorHwnd = FindWindow("SciCalc", "Calculator");
btnHwndGrp = FindWindowEx(calculatorHwnd, 0, "BUTTON", null);

int length = SendMessage(btnHwndGrp, WM_GETTEXTLENGTH, (IntPtr)0, (IntPtr)0);

if (length > 0)
{
StringBuilder sb = new StringBuilder(length);
SendMessage(btnHwndGrp, WM_GETTEXT, (IntPtr)(length + 1), sb);
//this shows the text
MessageBox.Show(sb.ToString());
}

}


}
}

thanks for everything i have...

GeneralRe: how to get text with api ??? Pin
WinSolution7-Nov-08 2:16
WinSolution7-Nov-08 2:16 
GeneralRe: how to get text with api ??? Pin
TALHAKOSEN7-Nov-08 2:18
TALHAKOSEN7-Nov-08 2:18 
GeneralRe: how to get text with api ??? Pin
WinSolution7-Nov-08 19:20
WinSolution7-Nov-08 19:20 

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.