I have a series of values from some VB6 code I found online. I need this code converted to C#. I have no idea how to read VB6. How can I convert this VB6 to the equivalent C#?
Private Const EM_GETRECT = &HB2;
Private Const EM_SETRECT = &HB3
Private Const EM_SCROLLCARET = &HB7
Private Const ES_AUTOHSCROLL = &H80&
Private Const ES_AUTOVSCROLL = &H40&
Private Const ES_CENTER = &H1&
Judging by one signature
[DllImport("coredll.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);
that takes these types of variables (as the Msg param), I believe these should be of the form
const int EM_GETRECT =
I don’t know how to change the &HB2 to an int. I think it’ll be 0x???, but how do I convert this little &HB2 to hex?
The syntax to express an hexdecimal value in C# is simply 0x followed by the hex representation of the number. (And this representation is the same in VB6 and C#) so you write
prints out 178 decimal.
The last three values (with the & suffix) are VB variables of long datatype.
In C# the datatype int is the same as VB long.
You could still use a C# integer
prints 1 as expected