Hello, 
I'd like to set multiple InputScopes to one text box in a Windows Form with using C#. This application will be used in TabletPC.
I found SetInputScopes API.
But I'm not good at C#, so I don't have any idea how to program it in C#.
Could anyone please answer the following questions?

1. How can I declare it in C#?

HRESULT SetInputScopes(
  __in  HWND hwnd,
  __in  const InputScope *pInputScopes,
  __in  UINT cInputScopes,
  __in  WCHAR **ppszPhraseList,
  __in  UINT cPhrases,
  __in  WCHAR *pszRegExp,
  __in  WCHAR *pszSRGS
);

In C#, I'm on the way of declaring.
[DllImport ( "Msctf.dll" ) ]

private static extern int SetInputScopes ( IntPtr hWnd, ??   ) ;

What type should be used for
const InputScope *
WCHAR
WCHAR * //(is it String?)
In C#?

2. How can I write "{IS_PHRASELIST, IS_DEFAULT}" in the C# code for it?

SetInputScopes (hwndMe, {IS_PHRASELIST, IS_DEFAULT}, 0, NULL, 2, NULL, NULL)

My development Environment:
• Visual Studio 2010
• Language: C#

I would appreciate your kindly help.
Thanks in advance.

Recommended Answers

All 3 Replies

This question was resolved.

If you want to add what you did, it may help other posters in the future. Thank you.

Thanks for your suggestion.
For Q1,
I declared it as follows
static extern int SetInputScopes(IntPtr hwnd, int[] pInputsSopes, uint cInputScopes,
string[] ppszPhraseList, uint cPhrases, string pszRegExp, string pszSRGS);
For Q2, I just set value of IS_** to int[].
Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.