Click here to Skip to main content
15,900,378 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Accessing parent class variables Pin
Joseph Dempsey25-Mar-01 4:21
Joseph Dempsey25-Mar-01 4:21 
GeneralWTL/Win32 question - making a CListCtrl Pin
Christian Graus25-Mar-01 1:21
protectorChristian Graus25-Mar-01 1:21 
GeneralRe: WTL/Win32 question - making a CListCtrl Pin
Michael Dunn25-Mar-01 9:24
sitebuilderMichael Dunn25-Mar-01 9:24 
GeneralRe: WTL/Win32 question - making a CListCtrl Pin
Christian Graus25-Mar-01 10:19
protectorChristian Graus25-Mar-01 10:19 
GeneralRe: WTL/Win32 question - making a CListCtrl Pin
Michael Dunn25-Mar-01 10:52
sitebuilderMichael Dunn25-Mar-01 10:52 
GeneralRe: WTL/Win32 question - making a CListCtrl Pin
Christian Graus26-Mar-01 10:19
protectorChristian Graus26-Mar-01 10:19 
GeneralRe: WTL/Win32 question - making a CListCtrl Pin
Michael Dunn26-Mar-01 12:26
sitebuilderMichael Dunn26-Mar-01 12:26 
GeneralConstructing Cursor on the fly no longer working Pin
Wolfram Steinke24-Mar-01 18:35
Wolfram Steinke24-Mar-01 18:35 
The code below is supposed to construct a cursor consisting of an arrow and a character from a font. It is part of a control that is in and extension DLL which is implicitly linked to the application. If 'sort' of works but seems to lose the 'AND' bitmap.

Any ideas??

HCURSOR CCharacterControl::MakeCharCursor(BYTE bCh)
{
ASSERT(this);
CPaintDC dc(this); // device context for painting

CDC dcTemp;
dcTemp.CreateCompatibleDC(&dc); // temp dc for rendering

int nCurX = GetSystemMetrics(SM_CXCURSOR);
int nCurY = GetSystemMetrics(SM_CYCURSOR);
CBitmap bitmap1, bitmap2, *pTempOld;

// Allocate memory for masks
int nByteArea = (nCurX/8) * nCurY;
TRACE("%s Cursor W = %d, H = %d\n",__FILE__,nCurX,nCurY);
HANDLE lpAnd = new HANDLE [nByteArea];
HANDLE lpXOR = new HANDLE [nByteArea];

bitmap1.LoadBitmap(IDB_CURSORAND);
pTempOld = dcTemp.SelectObject(&bitmap1);

CFont mFont;
mFont.CreateFont(28, 0, 0, 0, 400, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_SWISS,
(LPCSTR)m_szFontName);
char szOut[3] = "";
szOut[0] = (char)bCh;
CFont *pFontOld = dcTemp.SelectObject(&mFont);
CRect rect(0, 0, nCurX, nCurY);

dcTemp.DrawText(szOut, 1, rect, DT_SINGLELINE | DT_RIGHT | DT_BOTTOM | DT_NOPREFIX);
dcTemp.SelectObject(pFontOld);
bitmap1.GetBitmapBits(nByteArea, lpAnd);

bitmap2.LoadBitmap(IDB_CURSORXOR);
dcTemp.SelectObject(&bitmap2);
bitmap2.GetBitmapBits(nByteArea, lpXOR);

HCURSOR hCur = CreateCursor(AfxGetInstanceHandle(), 0, 0, nCurX, nCurY, lpAnd, lpXOR);
dcTemp.SelectObject(pTempOld);

delete lpAnd;
delete lpXOR;

return hCur;
}




Happy programming!!
GeneralPositioning a dialog Pin
Ashman24-Mar-01 15:07
Ashman24-Mar-01 15:07 
GeneralRe: Positioning a dialog Pin
Christian Graus24-Mar-01 21:04
protectorChristian Graus24-Mar-01 21:04 
GeneralNo click messages in CAnimateCtrl! Pin
24-Mar-01 10:57
suss24-Mar-01 10:57 
GeneralNo click messages in CAnimateCtrl! Pin
24-Mar-01 10:56
suss24-Mar-01 10:56 
GeneralUrgent ! System polices! Help !!! Pin
24-Mar-01 3:18
suss24-Mar-01 3:18 
GeneralWho can I create dialog, which is in MS InteDev 6.0 - flat tab Pin
24-Mar-01 2:02
suss24-Mar-01 2:02 
GeneralWho can I create dialog, which is in MS InteDev 6.0 - flat tab Pin
24-Mar-01 2:01
suss24-Mar-01 2:01 
GeneralInstallShield ... Pin
Hadi Rezaee23-Mar-01 23:53
Hadi Rezaee23-Mar-01 23:53 
GeneralRe: InstallShield ... Pin
Christian Graus24-Mar-01 0:23
protectorChristian Graus24-Mar-01 0:23 
GeneralUse View in controls ... Pin
Hadi Rezaee23-Mar-01 23:52
Hadi Rezaee23-Mar-01 23:52 
GeneralLearning Visual C++ Pin
Hadi Rezaee23-Mar-01 23:51
Hadi Rezaee23-Mar-01 23:51 
GeneralRe: Learning Visual C++ Pin
Christian Graus24-Mar-01 0:30
protectorChristian Graus24-Mar-01 0:30 
GeneralRe: Learning Visual C++ Pin
Hadi Rezaee24-Mar-01 0:42
Hadi Rezaee24-Mar-01 0:42 
GeneralRe: Learning Visual C++ Pin
l a u r e n24-Mar-01 3:12
l a u r e n24-Mar-01 3:12 
GeneralRe: Learning Visual C++ Pin
Hadi Rezaee24-Mar-01 20:45
Hadi Rezaee24-Mar-01 20:45 
GeneralRe: Learning Visual C++ Pin
24-Mar-01 9:43
suss24-Mar-01 9:43 
GeneralTAB Key ... Pin
Hadi Rezaee23-Mar-01 23:50
Hadi Rezaee23-Mar-01 23:50 

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.