Click here to Skip to main content
15,890,897 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralBlueTooth question Pin
eli150219799-Nov-04 20:29
eli150219799-Nov-04 20:29 
Generaldisplay korean characters inside mfc dialog box Pin
virtualweb9-Nov-04 20:11
virtualweb9-Nov-04 20:11 
QuestionHow to create Barchart ? Pin
pubududilena9-Nov-04 20:02
pubududilena9-Nov-04 20:02 
AnswerRe: How to create Barchart ? Pin
David Crow10-Nov-04 4:08
David Crow10-Nov-04 4:08 
GeneralRe: How to create Barchart ? Pin
pubududilena10-Nov-04 17:27
pubududilena10-Nov-04 17:27 
Generalplz help!!!!! Pin
namaskaaram9-Nov-04 20:01
namaskaaram9-Nov-04 20:01 
GeneralRe: plz help!!!!! Pin
ThatsAlok9-Nov-04 22:24
ThatsAlok9-Nov-04 22:24 
GeneralRe: plz help!!!!! Pin
namaskaaram10-Nov-04 18:51
namaskaaram10-Nov-04 18:51 
ok....tis a long story.....here goes......
u c.....the code.....

HICON hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR1 );<br />
SetCursor( hIcon );<br />
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???Cry | :((



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......Confused | :confused:
thanx in advance.....and thanx for ur intrest!!!!!Big Grin | :-D
Generalmfc... Pin
bektek9-Nov-04 19:06
bektek9-Nov-04 19:06 
GeneralRe: mfc... Pin
peterchen9-Nov-04 20:05
peterchen9-Nov-04 20:05 
GeneralRe: mfc Pin
pc_dev9-Nov-04 20:18
pc_dev9-Nov-04 20:18 
GeneralRe: mfc Pin
dada_buley9-Nov-04 20:42
dada_buley9-Nov-04 20:42 
GeneralRe: mfc Pin
John R. Shaw10-Nov-04 7:02
John R. Shaw10-Nov-04 7:02 
GeneralThanks all... Pin
bektek9-Nov-04 20:43
bektek9-Nov-04 20:43 
GeneralRe: mfc Pin
Robert M Greene10-Nov-04 8:20
Robert M Greene10-Nov-04 8:20 
GeneralNotification about system shutdown Pin
Vancouver9-Nov-04 17:50
Vancouver9-Nov-04 17:50 
GeneralRe: Notification about system shutdown Pin
ThatsAlok9-Nov-04 18:18
ThatsAlok9-Nov-04 18:18 
GeneralRe: Notification about system shutdown Pin
Vancouver9-Nov-04 18:26
Vancouver9-Nov-04 18:26 
GeneralTrapping keystrokes globally Pin
Vancouver9-Nov-04 17:40
Vancouver9-Nov-04 17:40 
GeneralRe: Trapping keystrokes globally Pin
ThatsAlok9-Nov-04 18:11
ThatsAlok9-Nov-04 18:11 
GeneralRe: Trapping keystrokes globally Pin
Vancouver9-Nov-04 18:42
Vancouver9-Nov-04 18:42 
GeneralRe: Trapping keystrokes globally Pin
ThatsAlok9-Nov-04 18:59
ThatsAlok9-Nov-04 18:59 
GeneralWindows Forms Pin
NormBohana9-Nov-04 17:14
NormBohana9-Nov-04 17:14 
GeneralCleaning up memory Pin
mdykstra9-Nov-04 17:00
mdykstra9-Nov-04 17:00 
GeneralRe: Cleaning up memory Pin
David Crow10-Nov-04 4:17
David Crow10-Nov-04 4:17 

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.