Textbox ID in c#

G

Guest

I've a vendor provided executable that runs under WinCE .NET 4.2 and
requires two input parameters:
1. window handle of a dialog
2. ID of a textbox

The program will perform a barcode scanning and send the result to the
specified textbox. The program works fine in eVC++ 4.0 with the
following function call:

CString arg;
arg.Format(L"ScanToWindow H:%d ID:%d", GetSafeHwnd(), IDC_TEST);
CreateProcess(TEXT("\\windows\\Barcode.exe"),
arg,
NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL);

However, I need to develop an application in C# with compact
framework. I can find a routine to return the handle of the form:

[DllImport("CoreDll.dll")]
extern public static IntPtr GetCapture();

How about the corresponding textbox ID in C#? In eVC++, each textbox
is defined with an ID in a header file. Is there a counterpart in C#
textbox? I searched all the properties but no such decimal ID defined
in C#. Any idea?

Thanks for your help in advance.
 
G

Guest

Try to invoke the "GetDlgCtrlID" function of the coredll.dll.

To get the ID of your textbox try the following code:

[DllImport("CoreDll.dll")]
extern public static IntPtr GetCapture();

[DllImport("CoreDll.dll")]
extern public static int GetDlgCtrlID(IntPtr hwndCtl);

textbox.Capture = true;
IntPtr hwnd = GetCapture();
int id = GetDlgCtrlID(hwnd);

I hope this will help you!

Regards,
Daniel.

--
Daniel Strigl
http://www.hh-system.com/danielstrigl

Pocket PC Developer Network Team Member
http://www.pocketpcdn.com/forum/profile.php?mode=viewprofile&u=17
 
G

Guest

Thanks for your reply. I've tried the suggested function but it always return a zero and passing zero to my vendor provided executable will cause it to keep running.

Daniel Strigl said:
Try to invoke the "GetDlgCtrlID" function of the coredll.dll.

To get the ID of your textbox try the following code:

[DllImport("CoreDll.dll")]
extern public static IntPtr GetCapture();

[DllImport("CoreDll.dll")]
extern public static int GetDlgCtrlID(IntPtr hwndCtl);

textbox.Capture = true;
IntPtr hwnd = GetCapture();
int id = GetDlgCtrlID(hwnd);

I hope this will help you!

Regards,
Daniel.

--
Daniel Strigl
http://www.hh-system.com/danielstrigl

Pocket PC Developer Network Team Member
http://www.pocketpcdn.com/forum/profile.php?mode=viewprofile&u=17


Eric Chung said:
I've a vendor provided executable that runs under WinCE .NET 4.2 and
requires two input parameters:
1. window handle of a dialog
2. ID of a textbox

The program will perform a barcode scanning and send the result to the
specified textbox. The program works fine in eVC++ 4.0 with the
following function call:

CString arg;
arg.Format(L"ScanToWindow H:%d ID:%d", GetSafeHwnd(), IDC_TEST);
CreateProcess(TEXT("\\windows\\Barcode.exe"),
arg,
NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL);

However, I need to develop an application in C# with compact
framework. I can find a routine to return the handle of the form:

[DllImport("CoreDll.dll")]
extern public static IntPtr GetCapture();

How about the corresponding textbox ID in C#? In eVC++, each textbox
is defined with an ID in a header file. Is there a counterpart in C#
textbox? I searched all the properties but no such decimal ID defined
in C#. Any idea?

Thanks for your help in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top