Click here to Skip to main content
15,910,980 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to display specific file in a folder using c program in ubuntu? Pin
mybm124-Jul-14 1:41
mybm124-Jul-14 1:41 
QuestionVisual studio 2010 - class wizard Pin
Member 1095872123-Jul-14 16:58
Member 1095872123-Jul-14 16:58 
AnswerRe: Visual studio 2010 - class wizard Pin
Stefan_Lang24-Jul-14 23:25
Stefan_Lang24-Jul-14 23:25 
QuestionHow to connect and access a SQLite database via C++ Pin
sarah0023-Jul-14 8:26
sarah0023-Jul-14 8:26 
AnswerRe: How to connect and access a SQLite database via C++ Pin
Richard Andrew x6423-Jul-14 8:39
professionalRichard Andrew x6423-Jul-14 8:39 
GeneralRe: How to connect and access a SQLite database via C++ Pin
PIEBALDconsult23-Jul-14 8:48
mvePIEBALDconsult23-Jul-14 8:48 
QuestionHow do you do data exchange (as in DDX_ functions/macros).... Pin
Member 1095872123-Jul-14 5:50
Member 1095872123-Jul-14 5:50 
QuestionIcons are displayed as black squares on remote desktops Pin
APSAccounts23-Jul-14 4:36
APSAccounts23-Jul-14 4:36 
Hey guys,

I'm encountering the following problem. I wolud very much appreciate your help.

Description of the problem
MFC Desktop Application
VisualStudio 2010
Icons are supposed to be displayed in a CListCtrl as a CImageList.
It usually works fine except when using RemoteDesktop with the OS Windows 2008 / 2003.
In these particular cases the icons are just displayed as a black square.
Connecting with VMware vSphere (alternative to RemoteDesktop) -> Icons are shown appropriately
Remotdesktop on Windows XP / 7 / 8 -> Icons are shown appropriately

Code:

OnInitDialog()
{
/*
~Standardcode
*/

// Setting the symbol for this dialog-field. This is done automatically
// if the mainwindow of the application is no dialog-field.
SetIcon(m_hIcon, TRUE); // using big symbol
SetIcon(m_hIcon, FALSE); // using small symbol

// TODO: appending additional initialization
InitList(); //
m_list.SetImageList(imageList, LVSIL_NORMAL);

//captions
CString buf = _T("testitem");
m_list.InsertItem(0, buf, 0);
m_list.SetItemData(0, (DWORD) 0);
m_list.SetItemText(0, 0, _T("0"));


m_list.SetItemState(0, 2, LVIS_SELECTED);
m_list.EnsureVisible(0, FALSE);
}

void CDispomarkierungTestDlg::InitList()
{
imageList = new CImageList();
int err = imageList->Create(16, 16, ILC_COLOR32 | ILC_MASK, 1, 1); //ILC_COLOR16 , ILC_COLOR8 , ... getested
int id = 40;
int requiredLength = 3154;
LPCSTR picInCharsFromDB = GetBitmapAsText();
int width = 24;
int heigth = 24;
int pixel = 32;
int planes = 1;
BYTE *picInBytes = new BYTE[requiredLength];
int lengthVariable = requiredLength;
int* lengthPointer;
lengthPointer = &lengthVariable;

Base64Decode(picInCharsFromDB, requiredLength, picInBytes, lengthPointer);

HANDLE hBitMap = CreateBitmap(width, heigth, planes, pixel, picInBytes);

BITMAP bitmap;
GetObject(hBitMap,sizeof(BITMAP),&bitmap);

CImage image;
image.Attach((HBITMAP)hBitMap);

CBitmap icon;
icon.Attach((HBITMAP)hBitMap);

CBitmap* bitmappointer;
bitmappointer = &icon;

BITMAP bmp;
icon.GetBitmap(&bmp);

CClientDC dcClient(this);
CDC memDC;
memDC.CreateCompatibleDC(&dcClient);

HBITMAP hbmMask = ::CreateCompatibleBitmap(memDC.GetSafeHdc(), width, heigth);

ICONINFO ii = {0};
ii.fIcon = TRUE;
ii.hbmColor = icon;
ii.hbmMask = hbmMask;

HICON hIcon = ::CreateIconIndirect(&ii);
::DeleteObject(hbmMask);
err = imageList->Add(hIcon);
}

In the real application, the source is a database which saves the Bitmap as a string. That’s the reason for the complicated code during the loading. Loading the images as a resource is possible, but in this case no option.
Drivers of server and client are updated to latest version.
I added the project here https://www.hidrive.strato.com/lnk/gRuMg38R. Thanks for helping out
AnswerRe: Icons are displayed as black squares on remote desktops Pin
Richard Andrew x6423-Jul-14 5:02
professionalRichard Andrew x6423-Jul-14 5:02 
GeneralRe: Icons are displayed as black squares on remote desktops Pin
APSAccounts23-Jul-14 5:07
APSAccounts23-Jul-14 5:07 
AnswerRe: Icons are displayed as black squares on remote desktops Pin
Richard MacCutchan23-Jul-14 6:14
mveRichard MacCutchan23-Jul-14 6:14 
GeneralRe: Icons are displayed as black squares on remote desktops Pin
APSAccounts23-Jul-14 22:11
APSAccounts23-Jul-14 22:11 
GeneralRe: Icons are displayed as black squares on remote desktops Pin
Richard MacCutchan23-Jul-14 22:18
mveRichard MacCutchan23-Jul-14 22:18 
GeneralRe: Icons are displayed as black squares on remote desktops Pin
APSAccounts23-Jul-14 22:43
APSAccounts23-Jul-14 22:43 
GeneralRe: Icons are displayed as black squares on remote desktops Pin
Richard MacCutchan23-Jul-14 22:48
mveRichard MacCutchan23-Jul-14 22:48 
GeneralRe: Icons are displayed as black squares on remote desktops Pin
APSAccounts23-Jul-14 22:58
APSAccounts23-Jul-14 22:58 
QuestionUsing CMFCShellListCtrl Pin
Member 1095872122-Jul-14 6:28
Member 1095872122-Jul-14 6:28 
AnswerRe: Using CMFCShellListCtrl Pin
Richard Andrew x6422-Jul-14 8:44
professionalRichard Andrew x6422-Jul-14 8:44 
GeneralRe: Using CMFCShellListCtrl Pin
Member 1095872122-Jul-14 15:37
Member 1095872122-Jul-14 15:37 
QuestionUsing CMFCShellListCtrl Pin
Member 1095872122-Jul-14 6:24
Member 1095872122-Jul-14 6:24 
AnswerRe: Using CMFCShellListCtrl Pin
Richard MacCutchan22-Jul-14 6:54
mveRichard MacCutchan22-Jul-14 6:54 
QuestionVisual studio 2010 compile error - I don't understand how to fix it Pin
Member 1095872122-Jul-14 5:23
Member 1095872122-Jul-14 5:23 
AnswerRe: Visual studio 2010 compile error - I don't understand how to fix it Pin
Jochen Arndt22-Jul-14 5:44
professionalJochen Arndt22-Jul-14 5:44 
GeneralRe: Visual studio 2010 compile error - I don't understand how to fix it Pin
Member 1095872122-Jul-14 6:26
Member 1095872122-Jul-14 6:26 
GeneralRe: Visual studio 2010 compile error - I don't understand how to fix it Pin
Member 1095872122-Jul-14 6:26
Member 1095872122-Jul-14 6:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.