What is wrong in this piece of code...
-
private: CButton Comps[5]; CRegKey reg; ....... (reg.Open(HKEY_LOCAL_MACHINE, "Software\\ShutDown") == ERROR_SUCCESS ) { reg.QueryDWORDValue("NumOfComputers", num); POINT pt1, pt2; pt1.x = 20; pt1.y = 20; pt2.x = 120; pt2.y = 50; ULONG Cname_sz; char buf[20]; CString cn, Cname; for (int i=0; i< maxComps; i++) { CRect tmpRect(pt1, pt2); LPCTSTR val = (LPCTSTR) itoa(i, buf, 10); int len = Cname.GetLength(); reg.QueryStringValue(val, (Cname.GetBuffer(len)), &Cname_sz); Comps[i].Create(_T(Cname), WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX, tmpRect, this, 1210+i); pt1.y += 30; pt2.y += 30; Cname.Empty(); } .........
-
private: CButton Comps[5]; CRegKey reg; ....... (reg.Open(HKEY_LOCAL_MACHINE, "Software\\ShutDown") == ERROR_SUCCESS ) { reg.QueryDWORDValue("NumOfComputers", num); POINT pt1, pt2; pt1.x = 20; pt1.y = 20; pt2.x = 120; pt2.y = 50; ULONG Cname_sz; char buf[20]; CString cn, Cname; for (int i=0; i< maxComps; i++) { CRect tmpRect(pt1, pt2); LPCTSTR val = (LPCTSTR) itoa(i, buf, 10); int len = Cname.GetLength(); reg.QueryStringValue(val, (Cname.GetBuffer(len)), &Cname_sz); Comps[i].Create(_T(Cname), WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX, tmpRect, this, 1210+i); pt1.y += 30; pt2.y += 30; Cname.Empty(); } .........
what is your problem with this piece of code? Don't try it, just do it! ;-)