Click here to Skip to main content
15,891,431 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Create device driver Pin
22491712-Nov-04 0:54
22491712-Nov-04 0:54 
GeneralMain handle of MFC dialog Pin
Kreatief11-Nov-04 22:25
Kreatief11-Nov-04 22:25 
GeneralRe: Main handle of MFC dialog Pin
22491711-Nov-04 22:47
22491711-Nov-04 22:47 
GeneralRe: Main handle of MFC dialog Pin
Kreatief12-Nov-04 0:46
Kreatief12-Nov-04 0:46 
GeneralRe: Main handle of MFC dialog Pin
BlackDice12-Nov-04 2:46
BlackDice12-Nov-04 2:46 
GeneralRe: Main handle of MFC dialog Pin
David Crow12-Nov-04 3:35
David Crow12-Nov-04 3:35 
GeneralRe: Main handle of MFC dialog Pin
Kreatief12-Nov-04 4:51
Kreatief12-Nov-04 4:51 
Generalaaaaaaaaah.....help!!!!!my OnSetCursor()....doesnt work at all places!!!!!! Pin
namaskaaram11-Nov-04 22:19
namaskaaram11-Nov-04 22:19 
D'Oh! | :doh: ok....tis a long story.....here goes......
u c.....the code.....

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<br />
//<br />
<br />
#include "stdafx.h"<br />
#include "creamz.h"<br />
#include "MyClass.h"<br />
<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// CMyStaticpot1<br />
<br />
CMyClass::CMyClass()<br />
{<br />
m_DragOn1=FALSE;<br />
m_pot1=0;<br />
m_update=TRUE;<br />
//AfxMessageBox("constructor activated");<br />
}<br />
<br />
CMyClass::~CMyClass()<br />
{<br />
}<br />
<br />
<br />
BEGIN_MESSAGE_MAP(CMyClass, CStatic)<br />
//{{AFX_MSG_MAP(CMyStaticpot1)<br />
ON_WM_LBUTTONDOWN()<br />
ON_WM_LBUTTONUP()<br />
ON_WM_MOUSEMOVE()<br />
ON_WM_SETCURSOR()<br />
//}}AFX_MSG_MAP<br />
END_MESSAGE_MAP()<br />
<br />
/////////////////////////////////////////////////////////////////////////////<br />
// CMyClass message handlers<br />
<br />
void CMyClass::OnLButtonDown(UINT nFlags, CPoint point) <br />
{<br />
// TODO: Add your message handler code here and/or call default<br />
<br />
HICON hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR2 );<br />
SetCursor( hIcon );<br />
m_DragOn1=TRUE;<br />
<br />
<br />
CStatic::OnLButtonDown(nFlags, point);<br />
}<br />
<br />
void CMyClass::OnLButtonUp(UINT nFlags, CPoint point) <br />
{<br />
// TODO: Add your message handler code here and/or call default<br />
//AfxMessageBox("click up");<br />
<br />
HICON hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR1 );<br />
SetCursor( hIcon );<br />
m_DragOn1=FALSE;<br />
<br />
<br />
CStatic::OnLButtonUp(nFlags, point);<br />
}<br />
<br />
void CMyClass::onmousemove(UINT nFlags, CPoint point) <br />
{<br />
// TODO: Add your message handler code here and/or call default<br />
<br />
//AfxMessageBox("move");<br />
<br />
if(m_DragOn1==TRUE)<br />
{<br />
<br />
if(m_pot1<62)<br />
m_pot1+=1;<br />
else<br />
m_pot1=0;<br />
<br />
//AfxMessageBox("dragging");<br />
// Invalidate();<br />
if(m_pot1%2==0)<br />
m_update=TRUE;<br />
<br />
}//end of if(m_DragOn==TRUE)<br />
<br />
<br />
<br />
<br />
CStatic::onmousemove(nFlags, point);<br />
}<br />
<br />
BOOL CMyClass::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) <br />
{<br />
// TODO: Add your message handler code here and/or call default<br />
<br />
if(m_DragOn1==FALSE)<br />
{<br />
<br />
//AfxMessageBox("CURSOR SET");<br />
<br />
HICON hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR1 );<br />
SetCursor( hIcon );<br />
}<br />
else<br />
{<br />
HICON hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR2 );<br />
SetCursor( hIcon );<br />
} <br />
<br />
<br />
return TRUE;<br />
<br />
<br />
// return CStatic::OnSetCursor(pWnd, nHitTest, message);<br />
}

plz help me out......
thanx in advance.....and thanx for ur intrest!!!!!
Generalconvert _int64 to double Pin
Member 147636711-Nov-04 22:15
Member 147636711-Nov-04 22:15 
GeneralRe: convert _int64 to double Pin
David Crow12-Nov-04 3:47
David Crow12-Nov-04 3:47 
GeneralTCP/IP Sockets Pin
QuaKx11-Nov-04 22:08
QuaKx11-Nov-04 22:08 
GeneralWindow without vertical borders Pin
Sara Burns11-Nov-04 21:57
Sara Burns11-Nov-04 21:57 
QuestionHow to hide an application on Win 9x/Me ? Pin
chauhoangtrung11-Nov-04 20:16
chauhoangtrung11-Nov-04 20:16 
AnswerRe: How to hide an application on Win 9x/Me ? Pin
David Crow12-Nov-04 3:51
David Crow12-Nov-04 3:51 
GeneralRe: How to hide an application on Win 9x/Me ? Pin
chauhoangtrung14-Nov-04 14:34
chauhoangtrung14-Nov-04 14:34 
GeneralRe: How to hide an application on Win 9x/Me ? Pin
David Crow15-Nov-04 4:41
David Crow15-Nov-04 4:41 
GeneralRe: How to hide an application on Win 9x/Me ? Pin
chauhoangtrung15-Nov-04 14:24
chauhoangtrung15-Nov-04 14:24 
GeneralRe: How to hide an application on Win 9x/Me ? Pin
David Crow16-Nov-04 2:41
David Crow16-Nov-04 2:41 
GeneralRe: How to hide an application on Win 9x/Me ? Pin
chauhoangtrung16-Nov-04 14:27
chauhoangtrung16-Nov-04 14:27 
GeneralRe: How to hide an application on Win 9x/Me ? Pin
David Crow17-Nov-04 2:41
David Crow17-Nov-04 2:41 
GeneralRe: How to hide an application on Win 9x/Me ? Pin
chauhoangtrung17-Nov-04 14:25
chauhoangtrung17-Nov-04 14:25 
GeneralRe: How to hide an application on Win 9x/Me ? Pin
David Crow18-Nov-04 2:07
David Crow18-Nov-04 2:07 
GeneralRe: How to hide an application on Win 9x/Me ? Pin
chauhoangtrung18-Nov-04 14:27
chauhoangtrung18-Nov-04 14:27 
GeneralRe: How to hide an application on Win 9x/Me ? Pin
David Crow19-Nov-04 2:32
David Crow19-Nov-04 2:32 
GeneralRe: How to hide an application on Win 9x/Me ? Pin
chauhoangtrung20-Nov-04 0:33
chauhoangtrung20-Nov-04 0:33 

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.