Hey guys, I'm trying my luck at C# here. I'm more of a C++ guy, but learning doesn't hurt.
Right now, I'm trying to make a crosshair. Can you please review my code, and help me figure out where I'm getting the error on line 3? It would be appreciated.
Thank you in advance..
Edit: Wow, I figured it out a minute after posting. I was missing a } after { this.cx = cx; this.cy = cy; } so the code should have looked like { this.cx = cx; this.cy = cy; }}
Hopefully, this can be a reference to anyone else who encounters this issue in the future.
Right now, I'm trying to make a crosshair. Can you please review my code, and help me figure out where I'm getting the error on line 3? It would be appreciated.
Code
using System;using System.Runtime.InteropServices;namespace Crosshair{public static class Win32{public enum Bool{False= 0,True};[StructLayout(LayoutKind.Sequential)]public struct Point{public Int32 x;public Int32 y;public Point(Int32 x, Int32 y) { this.x = x; this.y = y; }}[StructLayout(LayoutKind.Sequential)]public struct Size{public Int32 cx;public Int32 cy;public Size(Int32 cx, Int32 cy) { this.cx = cx; this.cy = cy; }}[StructLayout(LayoutKind.Sequential, Pack = 1)]struct ARGB{public byte Blue;public byte Green;public byte Red;public byte Alpha;}[StructLayout(LayoutKind.Sequential, Pack = 1)]public struct BLENDFUNCTION{public byte BlendOp;public byte BlendFlags;public byte SourceConstantAlpha;public byte AlphaFormat;}[StructLayout(LayoutKind.Sequential)]public struct RECT{public int Width{get { return (Right - Left); }}public int Height{get { return (Bottom - Top); }}public int Left;public int Top;public int Right;public int Bottom;}public const Int32 ULW_COLORKEY = 0x0000001;public const Int32 ULW_ALPHA = 0x0000002;public const Int32 ULW_OPAQUE = 0x0000004;public const byte AC_SRC_OVER = 0x00;public const byte AC_SRC_ALPHA = 0x01;[DllImport("user32.dll", ExactSpelling = true, SetLastError = true)]public static extern Bool UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref Point pptDst, ref Size psize, IntPtr hdcSrc, ref Point pprSrc, Int32 crKey, ref BLENDFUNCTION pblend, Int32 dwFlags);[DllImport("user32.dll", ExactSpelling = true, SetLastError = true)]public static extern IntPtr GetDC(IntPtr hWnd);[DllImport("user32.dll", ExactSpelling = true)]public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);[DllImport("gdi32.dll", ExactSpelling = true, SetLastError = true)]public static extern IntPtr CreateCompatibleDC(IntPtr hDC);[DllImport("gdi32.dll", ExactSpelling = true, SetLastError = true)]public static extern Bool DeleteDC(IntPtr hdc);[DllImport("gdi32.dll", ExactSpelling = true)]public static extern IntPtr SelectObject(IntPtr hDC, IntPtr hObject);[DllImport("gdi32.dll", ExactSpelling = true, SetLastError = true)]public static extern Bool DeleteObject(IntPtr hObject);[DllImport("user32.dll")]public static extern int FindWindow(string lpClassName, string lpWindowName);[return: MarshalAs(UnmanagedType.Bool)][DllImport("user32.dll")]public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);}}Thank you in advance..
Edit: Wow, I figured it out a minute after posting. I was missing a } after { this.cx = cx; this.cy = cy; } so the code should have looked like { this.cx = cx; this.cy = cy; }}
Hopefully, this can be a reference to anyone else who encounters this issue in the future.


![[Image: 1riOqZa.png]](https://i.imgur.com/1riOqZa.png)
