I want to use WinApi function ComboBox_SetCurSel in my C# application.
For this purpose I insert following statement:
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr ComboBox_SetCurSel(IntPtr hWnd, int index);
When I run the program, I get the error
EntryPointNotFoundException ComboBox_SetCurSel user32.dll
Message=Can't find entry point "ComboBox_SetCurSel" in DLL "user32.dll".
I suppose that this error is caused by ComboBox_SetCurSel being located not in user32.dll, but in some other DLL.
If this is correct, to fix this error I need to change DllImport declaration.
Question: In what DLL is ComboBox_SetCurSel located?
That’s not actually a function. It’s a macro, from WindowsX.h:
Where SNDMSG is SendMessage. In other words you should do: