Click here to Skip to main content
15,896,726 members
Home / Discussions / C#
   

C#

 
GeneralRe: DateTime: UTC vs Local Pin
ptr2void21-Apr-08 17:49
ptr2void21-Apr-08 17:49 
GeneralRe: DateTime: UTC vs Local Pin
ptr2void21-Apr-08 17:53
ptr2void21-Apr-08 17:53 
Questionc# Pin
veronika8921-Apr-08 2:45
veronika8921-Apr-08 2:45 
GeneralRe: c# Pin
Pete O'Hanlon21-Apr-08 2:49
mvePete O'Hanlon21-Apr-08 2:49 
GeneralRe: c# Pin
Vikram A Punathambekar21-Apr-08 2:53
Vikram A Punathambekar21-Apr-08 2:53 
GeneralRe: c# Pin
CPallini21-Apr-08 3:31
mveCPallini21-Apr-08 3:31 
AnswerRe: c# Pin
V.22-Apr-08 1:56
professionalV.22-Apr-08 1:56 
Generalcontrolling controls with handles Pin
V.21-Apr-08 2:36
professionalV.21-Apr-08 2:36 
Guys,

Check out the following

private void btn_disable_Click(object sender, EventArgs e) {
    IntPtr handle = FindWindow(null, "windowtitle");
    Form.FromHandle(handle);
    IntPtr chandle = GetDlgItem(handle, Convert.ToInt32(txtbox_controlid.Text));
    Control.FromHandle(chandle);
    string text = "";
    GetWindowText(handle, text, 10);
    MessageBox.Show(text);
}

[DllImport(@"user32.dll", EntryPoint="GetDlgItem")]
public static extern IntPtr GetDlgItem(IntPtr DialogHandle, int ControlId);

[DllImport(@"user32.dll", EntryPoint="FindWindow")]
public static extern IntPtr FindWindow(string ClassName, string DialogTitle);

[DllImport(@"user32.dll", EntryPoint="GetWindowText")]
public static extern int GetWindowText(IntPtr Hwnd, string text, int length);


both handle as chandle give back an IntPtr different from zero. Yet my MessageBox will stay empty.
If I try to create a Control (Control.FromHandle(chandle);) I get back a null value.

I did find an article that uses SendMessage to manipulate controls, but I was wondering if I couldn't plug in into the control via a reference or something. (like TextBox.FromHandle(found_handle)). [EDIT]Goal is to get hold of the properties and methods of the control like backColor, ForeColor, GetWindowtext, SetWindowText, Enable, Visible, ...[/EDIT]

Am I on the wrong path here or did I just miss a detail?

thanks !!

V.

Stop smoking so you can: Enjoy longer the money you save.
Moviereview Archive

GeneralRe: controlling controls with handles Pin
carbon_golem21-Apr-08 7:01
carbon_golem21-Apr-08 7:01 
GeneralRe: controlling controls with handles Pin
V.22-Apr-08 1:48
professionalV.22-Apr-08 1:48 
GeneralRe: controlling controls with handles Pin
carbon_golem22-Apr-08 2:37
carbon_golem22-Apr-08 2:37 
GeneralRe: controlling controls with handles Pin
V.22-Apr-08 4:53
professionalV.22-Apr-08 4:53 
GeneralCharacter Sets Pin
baerten21-Apr-08 2:27
baerten21-Apr-08 2:27 
GeneralRe: Character Sets Pin
Vikram A Punathambekar21-Apr-08 2:59
Vikram A Punathambekar21-Apr-08 2:59 
QuestionSystem.StackOverflowException was unhandled Pin
cuongmits21-Apr-08 2:11
cuongmits21-Apr-08 2:11 
GeneralRe: System.StackOverflowException was unhandled Pin
Vikram A Punathambekar21-Apr-08 3:00
Vikram A Punathambekar21-Apr-08 3:00 
GeneralRe: System.StackOverflowException was unhandled Pin
leppie21-Apr-08 4:08
leppie21-Apr-08 4:08 
QuestionRe: System.StackOverflowException was unhandled Pin
cuongmits21-Apr-08 7:36
cuongmits21-Apr-08 7:36 
GeneralRe: System.StackOverflowException was unhandled Pin
Yusuf21-Apr-08 8:21
Yusuf21-Apr-08 8:21 
QuestionRe: System.StackOverflowException was unhandled Pin
cuongmits21-Apr-08 20:27
cuongmits21-Apr-08 20:27 
GeneralRe: System.StackOverflowException was unhandled Pin
Yusuf22-Apr-08 1:35
Yusuf22-Apr-08 1:35 
GeneralMulti threading To my Search Program Pin
shinboxe21-Apr-08 1:39
shinboxe21-Apr-08 1:39 
GeneralRe: Multi threading To my Search Program Pin
J4amieC21-Apr-08 2:15
J4amieC21-Apr-08 2:15 
GeneralRe: Multi threading To my Search Program Pin
shinboxe21-Apr-08 3:35
shinboxe21-Apr-08 3:35 
GeneralRe: Multi threading To my Search Program Pin
Simon P Stevens21-Apr-08 3:35
Simon P Stevens21-Apr-08 3:35 

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.