Click here to Skip to main content
15,913,055 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDon’t expand CTreeCtrl on Right click… Pin
anderslundsgard16-Nov-04 3:56
anderslundsgard16-Nov-04 3:56 
GeneralRe: Don’t expand CTreeCtrl on Right click… Pin
BlackDice16-Nov-04 5:40
BlackDice16-Nov-04 5:40 
Questionis multiple inheritance possible?? Pin
namaskaaram16-Nov-04 3:48
namaskaaram16-Nov-04 3:48 
AnswerRe: is multiple inheritance possible?? Pin
Nemanja Trifunovic16-Nov-04 4:01
Nemanja Trifunovic16-Nov-04 4:01 
AnswerRe: is multiple inheritance possible?? Pin
David Crow16-Nov-04 4:07
David Crow16-Nov-04 4:07 
AnswerRe: is multiple inheritance possible?? Pin
Maximilien16-Nov-04 4:31
Maximilien16-Nov-04 4:31 
Questionhow do i change the color of the frame of a picture control??? Pin
namaskaaram16-Nov-04 3:45
namaskaaram16-Nov-04 3:45 
Generalregarding mouse events..... Pin
namaskaaram16-Nov-04 3:43
namaskaaram16-Nov-04 3:43 
plz help!!!!!Cry | :((

HICON hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR1 );
SetCursor( hIcon );
return TRUE; 

is a working code coz i have put this in my Dialog based application (Xyz) in a class called CXyzDlg..... that is, i have already added this function "OnSetCursor()".....and the cursor changes......in the main Dlg box but..... i have derived a class from the CStatic Class named it as "CMyClass".....and i have created obcts of it in the CXyzDlg class.....basically these objects i have created by placing the "static control" on the dialog box and then..... thru the class wizard created an object linking it with the picture control of type CMyClass(that is .....SUBCLASSING).....
also in thiz CMyClass i have added the "OnSetCursor()" function as well......and many other mouse functions like "onmousemove()","LbuttonDown()".....etc.....but here when i put in the same code as i had put in the main Dlg box for the "OnsetCursor()".....it does not change!!!!!......y???


heres the code......that i have put in the derived class CMyClass......

// MyClass.cpp : implementation file
//

#include "stdafx.h"
#include "creamz.h"
#include "MyClass.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMyStaticpot1

CMyClass::CMyClass()
{
m_DragOn1=FALSE;
m_pot1=0;
m_update=TRUE;
//AfxMessageBox("constructor activated");
}

CMyClass::~CMyClass()
{
}


BEGIN_MESSAGE_MAP(CMyClass, CStatic)
//{{AFX_MSG_MAP(CMyStaticpot1)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
ON_WM_SETCURSOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyClass message handlers

void CMyClass::OnLButtonDown(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default

HICON hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR2 );
SetCursor( hIcon );
m_DragOn1=TRUE;


CStatic::OnLButtonDown(nFlags, point);
}

void CMyClass::OnLButtonUp(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default
//AfxMessageBox("click up");

HICON hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR1 );
SetCursor( hIcon );
m_DragOn1=FALSE;


CStatic::OnLButtonUp(nFlags, point);
}

void CMyClass::onmousemove(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default

//AfxMessageBox("move");

if(m_DragOn1==TRUE)
{

if(m_pot1<62)
m_pot1+=1;
else
m_pot1=0;

//AfxMessageBox("dragging");
// Invalidate();
if(m_pot1%2==0)
m_update=TRUE;

}//end of if(m_DragOn==TRUE)




CStatic::onmousemove(nFlags, point);
}

BOOL CMyClass::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
{
// TODO: Add your message handler code here and/or call default

if(m_DragOn1==FALSE)
{

//AfxMessageBox("CURSOR SET");

HICON hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR1 );
SetCursor( hIcon );
}
else
{
HICON hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR2 );
SetCursor( hIcon );
} 


return TRUE;


// return CStatic::OnSetCursor(pWnd, nHitTest, message);
}


plz help me out......
thanx in advance.....and thanx for ur intrest!!!!!
GeneralRe: regarding mouse events..... Pin
Blake Miller16-Nov-04 4:43
Blake Miller16-Nov-04 4:43 
GeneralRe: regarding mouse events..... Pin
namaskaaram16-Nov-04 17:52
namaskaaram16-Nov-04 17:52 
GeneralRe: regarding mouse events..... Pin
Blake Miller17-Nov-04 4:05
Blake Miller17-Nov-04 4:05 
GeneralRe: regarding mouse events..... Pin
namaskaaram17-Nov-04 18:50
namaskaaram17-Nov-04 18:50 
GeneralRe: regarding mouse events..... Pin
Blake Miller18-Nov-04 4:04
Blake Miller18-Nov-04 4:04 
GeneralCoTaskMemAlloc and BITMAPINFO Pin
dmxdmxdmx0516-Nov-04 3:39
dmxdmxdmx0516-Nov-04 3:39 
GeneralRe: CoTaskMemAlloc and BITMAPINFO Pin
Blake Miller16-Nov-04 4:49
Blake Miller16-Nov-04 4:49 
Generalusing non-English languages in visual c++.... Pin
shah170116-Nov-04 3:11
shah170116-Nov-04 3:11 
GeneralRe: want icons in subitems of listview, but not first column Pin
BlackDice16-Nov-04 2:51
BlackDice16-Nov-04 2:51 
QuestionHow do I... Pin
KORCARI16-Nov-04 2:10
KORCARI16-Nov-04 2:10 
AnswerRe: How do I... Pin
David Crow16-Nov-04 2:44
David Crow16-Nov-04 2:44 
QuestionHow to make Custom Explorer Bars to Internet Explorer? Pin
pubududilena16-Nov-04 1:38
pubududilena16-Nov-04 1:38 
AnswerRe: How to make Custom Explorer Bars to Internet Explorer? Pin
ThatsAlok16-Nov-04 2:34
ThatsAlok16-Nov-04 2:34 
QuestionHow to import both adoce31.dll &amp; adoxce31.dll? Pin
george ivanov16-Nov-04 0:56
george ivanov16-Nov-04 0:56 
AnswerRe: How to import both adoce31.dll &amp; adoxce31.dll? Pin
Antony M Kancidrowski16-Nov-04 1:47
Antony M Kancidrowski16-Nov-04 1:47 
AnswerRe: How to import both adoce31.dll &amp; adoxce31.dll? Pin
RChin16-Nov-04 2:02
RChin16-Nov-04 2:02 
GeneralMDI CFormView and Dialog Templates Pin
navalgap16-Nov-04 0:10
navalgap16-Nov-04 0:10 

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.