Adding ILC_MASK did the trick
Jochem
Posts
-
Adding icons to an imagelist that is used in a listctrl -
Adding icons to an imagelist that is used in a listctrlI use a CListCtrl on a dialog. The problem is that the background of the icons is somehow changed to black when the dialog pops up. But the background is supposed to be transparent. Who knows how to prevent this? This is the code that i use:
CMyDlg::OnInitDialog() { m_imageList.Create(32, 32, ILC_COLOR4, 2, 2); //adding the icons for(int i=0; i<2; i++) { int nID = GetIconID( i ); //code taken from CWinApp::LoadIcon(int nID ) HICON hIcon = ::LoadIcon(AfxFindResourceHandle(MAKEINTRESOURCE(nID), RT_GROUP_ICON), MAKEINTRESOURCE(nID)); m_imageList.Add(hIcon); } m_listCtrl.SetImageList(&m_imageList, LVSIL_NORMAL); //inserting items in the listctrl for(int nIndex=0; nIndex<2; nIndex++) { m_type.InsertItem(nIndex, "some text", nIndex); nIndex++; } }
Thanks in advance, Jochem -
Problem with the registryThis solves the problem thanks
-
Problem with the registryThe KEY_ALL_ACCESS is the next argument
-
Problem with the registryThe problem is that all data that i save in the registry is gone after windows (2000) is restarted. All data appears to be ok after the application closes. But after the restart the key is completely gone. The code used in the app: Opening the key: HKEY hKeyRoot = HKEY_CURRENT_USER; LPCTSTR pszPath = "Software\\Companyname\\My App Name\\Settings" HKEY hKey; DWORD dw; RegCreateKeyEx(hKeyRoot, pszPath, 0L, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dw); Writing: int iValue = 8; LPCTSTR pszKey = "MyInteger"; hKey as returned by RegCreateKeyEx RegSetValueEx(hKey, pszKey, 0L, REG_DWORD, (CONST BYTE*)&iValue, sizeof(int)); Does anyone know how to prevent this and why it happens? Thanks I'm smart enough to know that i'm stupid and i'm stupid enough to think that i'm smart