public static void Initialize(ref IntPtr data, IntPtr rm) { Rainmeter.API api = new Rainmeter.API(rm); string parent = api.ReadString("ParentName", ""); Measure measure; if (String.IsNullOrEmpty(parent)) { measure = new ParentMeasure(); } else { measure = new ChildMeasure(); } data = GCHandle.ToIntPtr(GCHandle.Alloc(measure)); }