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

Windows Forms

 
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 
GeneralRe: how to get text with api ??? Pin
TALHAKOSEN9-Nov-08 21:43
TALHAKOSEN9-Nov-08 21:43 
GeneralRe: how to get text with api ??? Pin
WinSolution10-Nov-08 19:34
WinSolution10-Nov-08 19:34 
GeneralRe: how to get text with api ??? Pin
TALHAKOSEN10-Nov-08 20:46
TALHAKOSEN10-Nov-08 20:46 
GeneralRe: how to get text with api ??? Pin
WinSolution11-Nov-08 5:29
WinSolution11-Nov-08 5:29 
QuestionQuery Designer Pin
Mohammad Al Hoss2-Oct-08 0:05
Mohammad Al Hoss2-Oct-08 0:05 
AnswerRe: Query Designer Pin
Giorgi Dalakishvili2-Oct-08 0:23
mentorGiorgi Dalakishvili2-Oct-08 0:23 
GeneralRe: Query Designer Pin
Paul Conrad3-Oct-08 6:38
professionalPaul Conrad3-Oct-08 6:38 
QuestionHow to tell when a form is opened? Pin
jpsstavares1-Oct-08 0:52
jpsstavares1-Oct-08 0:52 
AnswerRe: How to tell when a form is opened? Pin
Giorgi Dalakishvili1-Oct-08 1:21
mentorGiorgi Dalakishvili1-Oct-08 1:21 
GeneralRe: How to tell when a form is opened? Pin
jpsstavares1-Oct-08 5:39
jpsstavares1-Oct-08 5:39 
GeneralRe: How to tell when a form is opened? Pin
Giorgi Dalakishvili1-Oct-08 5:40
mentorGiorgi Dalakishvili1-Oct-08 5:40 
QuestionValueMember with sorted ComboBox Pin
Nigel Mackay30-Sep-08 19:16
Nigel Mackay30-Sep-08 19:16 
QuestionAdd 2 number in Crystal Report Pin
tungcan5diop30-Sep-08 17:26
tungcan5diop30-Sep-08 17:26 
AnswerRe: Add 2 number in Crystal Report Pin
TheCardinal30-Sep-08 20:16
TheCardinal30-Sep-08 20:16 

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.