|
hi!!
Iterator has a member called _MyPtr. Can I use that to get a pointer and then convert it to wparam??
thx
|
|
|
|
|
What iterator that was.. I mean map, list, vector..
anyway i hope the below approach will help you and i sorry 4 the delay..
Allocate memory of your type using new and copy the content from the iterator to the allocated memory and typecaste it...
say, the iterator has string valur then..
char *pStr = new char[..];
strcpy(pStr, (*it).c_str());
SendMessage(hWnd, USER_MSG, NULL, (LPARAM)(LPVOID)pStr);
the pStr memory should be freed in the handler of the message
Do your Duty and Don't expect the Result
|
|
|
|
|
|
Thx Whitesky!!
I already gone throught this article. I am clear now with the usage of SendMessage. My actual problem is how to convert an Iterator to WPARAM.
Typecasting was working in VC6. But it is not supported in VC8. can u suggest something. Also can i use _MyPtr member of iterator to get the pointer??
Thx again!
|
|
|
|
|
hi all,
I have Created a an Ellipse/Circle in mouse move, But after creating the Circle/Ellipse in the View i am trying to Drag the Circle what i have created.
But before Dragging the Circle what i have created. I am not able to see the dragged circle from the point what i am dragging. the Dragging is starting from the slight different position.
here is the Code.
void CPaintingView::OnLButtonDown(UINT nFlags, CPoint point)
{
Anchor = point;
OldPoint = Anchor;
int nTime = GetDoubleClickTime();
SetTimer(1,nTime,0);
if((nFlags && MK_LBUTTON) && circleDrawn == false) // For First Time
{
CString strReadBuffer,strTokenizer;
int index = -1,ind=0;
for(int i =0; i < strCollect.GetSize(); i++)
{
strReadBuffer = strCollect.GetAt(i);
index = strReadBuffer.Find(",");
do
{
strTokenizer = strReadBuffer.Left(index);
strReadBuffer = strReadBuffer.Mid(index+1);
index = strReadBuffer.Find(",");
array[ind++]= atoi(strTokenizer.GetBuffer(0));
}while(index != -1);
if(index == -1) array[ind++] = atoi(strReadBuffer.GetBuffer(0));
array[ind++] = '\0';
ind =0;
CRgn rgn;
rgn.CreateEllipticRgn(array[0],array[1],array[2],array[3]);
if(rgn.PtInRegion(point)== TRUE) insidepoint = true;
}
}
CScrollView::OnLButtonDown(nFlags, point);
}
void CPaintingView::OnLButtonUp(UINT nFlags, CPoint point)
{
CClientDC dc(this);
DrawTo = point;
CPen one,*old;
if(bEllipseFlag && insidepoint == true)
{
dc.SetROP2(R2_NOT);
dc.SelectStockObject(NULL_BRUSH);
dc.SetBkMode(TRANSPARENT);
dc.Ellipse(array[0],array[1],array[2],array[3]);
}
else if(bEllipseFlag && insidepoint == false)
{
CRect rect;
GetClientRect(&rect);
ScreenToClient(&rect);
one.CreatePen(PS_DASH,1,RGB(200,100,50));
old = dc.SelectObject(&one);
SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR1));
dc.SelectStockObject(NULL_BRUSH);
dc.Ellipse(Anchor.x, Anchor.y, point.x, point.y);
dc.SelectObject(old);
CString strCordinates;
strCordinates.Format("%d,%d,%d,%d",Anchor.x,Anchor.y,point.x,point.y);
strCollect.Add(strCordinates);
}
CScrollView::OnLButtonUp(nFlags, point);
}
void CPaintingView::OnMouseMove(UINT nFlags, CPoint point)
{
CClientDC dc(this);
CPen one,*old;
if((insidepoint == true ) && (nFlags & MK_LBUTTON))
{
CRect rect;
GetClientRect(&rect);
ScreenToClient(&rect);
dc.SetROP2(R2_NOT);
one.CreatePen(PS_DASH,1,RGB(200,100,50));
old = dc.SelectObject(&one);
dc.SelectStockObject(NULL_BRUSH);
dc.Ellipse(OldPoint.x+ array[0],OldPoint.y+array[1],(point.x + array[2]),(point.y + array[3])); // Here the Position is not getting Correctly
dc.Ellipse(OldPoint.x+ array[0],OldPoint.y+array[1],(point.x + array[2]),(point.y + array[3])); //A slight Difference in Position I cant Understand why this happens. please help me out.
OldPoint = point;
dc.SelectObject(old);
showCordinates(point);
}
if((nFlags && MK_LBUTTON) && bEllipseFlag && circleDrawn == true)
{
SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR1));
dc.SetROP2(R2_NOT);
dc.SelectStockObject(NULL_BRUSH);
one.CreatePen(PS_DASH,1,RGB(200,100,50));
old = dc.SelectObject(&one);
dc.Ellipse(OldPoint.x, OldPoint.y, Anchor.x, Anchor.y);
dc.Ellipse(Anchor.x, Anchor.y, point.x, point.y);
OldPoint= point;
dc.SelectObject(old);
showCordinates(point);
}
CScrollView::OnMouseMove(nFlags, point);
}
// what shall i do for getting the Circle Dragged exacltly and at the Point where i have dragged.
please help me out.
Uday kiran
-- modified at 2:09 Tuesday 8th August, 2006
|
|
|
|
|
whats problem in this code?you show your code but can you show declare variables (array,...)
|
|
|
|
|
Hi whitesky,
My intention is that.
1) when you first see the View. The moment you Mouse Down i created a Cirlce, and Added the Points into CStringArray. After drawing all circles with LButton Down Click.
2) when i Click RButton Down i set the Flags circleDrawn as false, It mean we can no more draw any Circles.
3) When the flag CircleDrawn is set to False and the Mouse is Pressed LButtonDown, I am Checking if this point lies between any of the Circles i have drawn before the CircleDrawn Flag set to False.
4) if the CircleDrawn Flag is False and if the LButton Lies in between the Circle then I Have to Draw a Circle When Mouse is Moving.
5) In The Mouse Move i calculated the Exact Circle Area by Calculating the Point of the Mouse Co-Oridinates + Points of the Circle.
//===============================================
dc.Ellipse(point.x+ array[0],point.y+array[1],(point.x + array[2]),(point.y + array[3]));
//================================================
The Step i have used because to Draw the Exact Circle what i have drawn previously.
This is Because when the Mouse is being moved we have to shift the new location this is done by CPoint point.
so i have added point.x + (X1 co-ordinate of the Circle which is previously drawn.)
please let me know if you get any doubts
Uday kiran
|
|
|
|
|
I want to run your code but i need to declares from variables and if they has initialize
|
|
|
|
|
Hi whitsky,
i am giving all the variables initialized. please see it. and also the View Class
//==========================================================
class CPaintingView : public CScrollView
{
protected: // create from serialization only
CPaintingView();
DECLARE_DYNCREATE(CPaintingView)
// Attributes
public:
CPaintingDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPaintingView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void OnInitialUpdate(); // called first time after construct
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
//}}AFX_VIRTUAL
// Implementation
public:
CPoint Anchor;
CPoint DrawTo;
CPoint OldPoint;
bool bEllipseFlag;
bool insidepoint;
int array[60];
CStringArray strCollect;
public:
void showCordinates(CPoint point);
void DrawPixel();
void DrawCircles();
public:
UINT m_Circle,m_SolidCircle,m_Rectangle,m_SolidRectangle,m_Line;
CString szPosx,szPosy,Res;
bool circleDrawn;
virtual ~CPaintingView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CPaintingView)
afx_msg void OnFiguresCircle();
afx_msg void OnUpdateFiguresCircle(CCmdUI* pCmdUI);
afx_msg void OnButton32773();
afx_msg void OnUpdateButton32773(CCmdUI* pCmdUI);
afx_msg void OnButton32774();
afx_msg void OnFiguresExit();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnButton32775();
afx_msg void OnUpdateButton32775(CCmdUI* pCmdUI);
afx_msg void OnFiguresSolidcircle();
afx_msg void OnUpdateFiguresSolidcircle(CCmdUI* pCmdUI);
afx_msg void OnFiguresRectangle();
afx_msg void OnUpdateFiguresRectangle(CCmdUI* pCmdUI);
afx_msg void OnFiguresSolidrectangle();
afx_msg void OnUpdateFiguresSolidrectangle(CCmdUI* pCmdUI);
afx_msg void OnFiguresLine();
afx_msg void OnUpdateFiguresLine(CCmdUI* pCmdUI);
afx_msg void OnButton32780();
afx_msg void OnUpdateButton32780(CCmdUI* pCmdUI);
afx_msg void OnButton32782();
afx_msg void OnUpdateButton32782(CCmdUI* pCmdUI);
afx_msg void OnButton32781();
afx_msg void OnUpdateButton32781(CCmdUI* pCmdUI);
afx_msg void OnPaint();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnSize(UINT nType, int cx, int cy);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//==============================================================
View Class
#include "stdafx.h"
#include "painting.h"
#include "colorattr.h"
#include "paintingDoc.h"
#include "paintingView.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNCREATE(CPaintingView, CScrollView)
BEGIN_MESSAGE_MAP(CPaintingView, CScrollView)
//{{AFX_MSG_MAP(CPaintingView)
ON_COMMAND(ID_FIGURES_CIRCLE, OnFiguresCircle)
ON_UPDATE_COMMAND_UI(ID_FIGURES_CIRCLE, OnUpdateFiguresCircle)
ON_COMMAND(ID_BUTTON32773, OnButton32773)
ON_UPDATE_COMMAND_UI(ID_BUTTON32773, OnUpdateButton32773)
ON_COMMAND(ID_BUTTON32774, OnButton32774)
ON_COMMAND(ID_FIGURES_EXIT, OnFiguresExit)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONDBLCLK()
ON_WM_RBUTTONDOWN()
ON_COMMAND(ID_BUTTON32775, OnButton32775)
ON_UPDATE_COMMAND_UI(ID_BUTTON32775, OnUpdateButton32775)
ON_COMMAND(ID_FIGURES_SOLIDCIRCLE, OnFiguresSolidcircle)
ON_UPDATE_COMMAND_UI(ID_FIGURES_SOLIDCIRCLE, OnUpdateFiguresSolidcircle)
ON_COMMAND(ID_FIGURES_RECTANGLE, OnFiguresRectangle)
ON_UPDATE_COMMAND_UI(ID_FIGURES_RECTANGLE, OnUpdateFiguresRectangle)
ON_COMMAND(ID_FIGURES_SOLIDRECTANGLE, OnFiguresSolidrectangle)
ON_UPDATE_COMMAND_UI(ID_FIGURES_SOLIDRECTANGLE, OnUpdateFiguresSolidrectangle)
ON_COMMAND(ID_FIGURES_LINE, OnFiguresLine)
ON_UPDATE_COMMAND_UI(ID_FIGURES_LINE, OnUpdateFiguresLine)
ON_COMMAND(ID_BUTTON32780, OnButton32780)
ON_UPDATE_COMMAND_UI(ID_BUTTON32780, OnUpdateButton32780)
ON_COMMAND(ID_BUTTON32782, OnButton32782)
ON_UPDATE_COMMAND_UI(ID_BUTTON32782, OnUpdateButton32782)
ON_COMMAND(ID_BUTTON32781, OnButton32781)
ON_UPDATE_COMMAND_UI(ID_BUTTON32781, OnUpdateButton32781)
ON_WM_PAINT()
ON_WM_ERASEBKGND()
ON_WM_SIZE()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CScrollView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPaintingView construction/destruction
CPaintingView::CPaintingView()
{
}
CPaintingView::~CPaintingView()
{
}
BOOL CPaintingView::PreCreateWindow(CREATESTRUCT& cs)
{
return CScrollView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CPaintingView drawing
void CPaintingView::OnDraw(CDC* pDC)
{
CPaintingDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
}
void CPaintingView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal;
sizeTotal.cx = 200;
sizeTotal.cy = 200;
SetScrollSizes(MM_HIENGLISH,sizeTotal);
bEllipseFlag = false;
insidepoint = false;
circleDrawn = false;
}
BOOL CPaintingView::OnPreparePrinting(CPrintInfo* pInfo)
{
return DoPreparePrinting(pInfo);
}
void CPaintingView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
}
void CPaintingView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
}
#ifdef _DEBUG
void CPaintingView::AssertValid() const
{
CScrollView::AssertValid();
}
void CPaintingView::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
CPaintingDoc* CPaintingView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CPaintingDoc)));
return (CPaintingDoc*)m_pDocument;
}
#endif //_DEBUG
void CPaintingView::OnLButtonDown(UINT nFlags, CPoint point)
{
Anchor = point;
OldPoint = Anchor;
if((nFlags && MK_LBUTTON) && circleDrawn == false) // For First Time
{
CString strReadBuffer,strTokenizer;
int index = -1,ind=0;
for(int i =0; i < strCollect.GetSize(); i++)
{
strReadBuffer = strCollect.GetAt(i);
index = strReadBuffer.Find(",");
do
{
strTokenizer = strReadBuffer.Left(index);
strReadBuffer = strReadBuffer.Mid(index+1);
index = strReadBuffer.Find(",");
array[ind++]= atoi(strTokenizer.GetBuffer(0));
}while(index != -1);
if(index == -1) array[ind++] = atoi(strReadBuffer.GetBuffer(0));
array[ind++] = '\0';
ind =0;
CRgn rgn;
rgn.CreateEllipticRgn(array[0],array[1],array[2],array[3]);
if(rgn.PtInRegion(point)== TRUE) insidepoint = true;
}
}
CScrollView::OnLButtonDown(nFlags, point);
}
void CPaintingView::OnLButtonUp(UINT nFlags, CPoint point)
{
CClientDC dc(this);
DrawTo = point;
CPen one,*old;
if(insidepoint == true && bEllipseFlag == false && insidepoint == true && nFlags & MK_SHIFT)
{
one.CreatePen(PS_DASHDOTDOT,1,RGB(100,0,10));
old = dc.SelectObject(&one);
dc.SetROP2(R2_NOT);
dc.SelectStockObject(NULL_BRUSH);
dc.SetBkMode(TRANSPARENT);
dc.Ellipse(DrawTo.x + array[0],DrawTo.y+array[1],(DrawTo.x + array[2]),(DrawTo.y + array[3]));
insidepoint = false;
dc.SelectObject(old);
showCordinates(DrawTo);
}
else if(bEllipseFlag && insidepoint == false)
{
CRect rect;
GetClientRect(&rect);
ScreenToClient(&rect);
one.CreatePen(PS_DASHDOTDOT,1,RGB(100,0,10));
old = dc.SelectObject(&one);
SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR1));
dc.SelectStockObject(NULL_BRUSH);
dc.Ellipse(Anchor.x, Anchor.y, point.x, point.y);
dc.SelectObject(old);
CString strCordinates;
strCordinates.Format("%d,%d,%d,%d",Anchor.x,Anchor.y,point.x,point.y);
strCollect.Add(strCordinates);
}
CScrollView::OnLButtonUp(nFlags, point);
}
void CPaintingView::OnMouseMove(UINT nFlags, CPoint point)
{
CClientDC dc(this);
CPen one,*old;
if(insidepoint == true && bEllipseFlag == false && insidepoint == true && nFlags & MK_SHIFT )
{
OnPrepareDC(&dc);
dc.LPtoDP(&point);
one.CreatePen(PS_DASHDOTDOT,1,RGB(100,0,10));
old = dc.SelectObject(&one);
dc.SelectStockObject(NULL_BRUSH);
dc.SetROP2(R2_NOT);
dc.Ellipse(OldPoint.x+ array[0],OldPoint.y+array[1],(point.x + array[2]),(point.y + array[3]));
dc.Ellipse(OldPoint.x+ array[0],OldPoint.y+array[1],(point.x + array[2]),(point.y + array[3]));
OldPoint = point;
dc.SelectObject(old);
showCordinates(point);
}
if((nFlags && MK_LBUTTON) && bEllipseFlag && circleDrawn == true)
{
SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR1));
dc.SetROP2(R2_NOT);
dc.SelectStockObject(NULL_BRUSH);
one.CreatePen(PS_DASHDOTDOT,1,RGB(100,0,10));
old = dc.SelectObject(&one);
dc.Ellipse(OldPoint.x, OldPoint.y, Anchor.x, Anchor.y);
dc.Ellipse(Anchor.x, Anchor.y, point.x, point.y);
OldPoint= point;
dc.SelectObject(old);
showCordinates(point);
}
CScrollView::OnMouseMove(nFlags, point);
}
void CPaintingView::showCordinates(CPoint point)
{
szPosx.Format("%d",point.x);
szPosy.Format("%d",point.y);
Res = "x=";
Res += szPosx;
Res += ",";
Res += "y=";
Res += szPosy;
CMainFrame* pFrameParent = (CMainFrame *)GetParentFrame();
pFrameParent->m_wndStatusBar.SetPaneText(4,Res);
}
void CPaintingView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
if(circleDrawn == false)
{
CString strReadBuffer,strTokenizer;
int index = -1,ind=0;
for(int i =0; i< strCollect.GetSize(); i++)
{
strReadBuffer = strCollect.GetAt(i);
index = strReadBuffer.Find(",");
do
{
strTokenizer = strReadBuffer.Left(index);
strReadBuffer = strReadBuffer.Mid(index+1);
index = strReadBuffer.Find(",");
array[ind++]= atoi(strTokenizer.GetBuffer(0));
}while(index != -1);
if(index == -1){
array[ind++] = atoi(strReadBuffer.GetBuffer(0));
}
array[ind++] = '\0';
ind =0;
CRgn rgn;
rgn.CreateEllipticRgn(array[0],array[1],array[2],array[3]);
if(rgn.PtInRegion(point)== TRUE)
{
insidepoint = true;
colorattr attr;
attr.ptrPaint = this;
attr.DoModal();
}
if(insidepoint == true) break;
}
}
CScrollView::OnLButtonDblClk(nFlags, point);
}
void CPaintingView::OnRButtonDown(UINT nFlags, CPoint point)
{
if(bEllipseFlag == true){
SetCursor(AfxGetApp()->LoadCursor(IDC_ARROW));
bEllipseFlag = false;
}
CScrollView::OnRButtonDown(nFlags, point);
circleDrawn = false;
}
void CPaintingView::OnPaint()
{
DrawPixel(); //Call this Function to Paint the Back Ground
CPaintDC dc(this);
int nRet;
CDC dcMem;
CRect rect;
CBitmap bmpMem;
GetClientRect(&rect); //Capture the Image of the Screen what we Want
nRet = dcMem.CreateCompatibleDC(&dc);
nRet = bmpMem.CreateCompatibleBitmap(&dc,rect.Width(),rect.Height());
CBitmap *pOldBmp = (CBitmap *)(dcMem.SelectObject(&bmpMem));
dc.BitBlt(0,0,rect.Width(),rect.Height(),&dcMem,0,0, SRCCOPY);
dcMem.SelectObject(pOldBmp);
bmpMem.DeleteObject();
dcMem.DeleteDC();
}
void CPaintingView::DrawCircles()
{
CString strReadBuffer,strTokenizer;
int index = -1,ind=0;
for(int i =0; i< strCollect.GetSize(); i++)
{
strReadBuffer = strCollect.GetAt(i);
index = strReadBuffer.Find(",");
do
{
strTokenizer = strReadBuffer.Left(index);
strReadBuffer = strReadBuffer.Mid(index+1);
index = strReadBuffer.Find(",");
array[ind++]= atoi(strTokenizer.GetBuffer(0));
}while(index != -1);
if(index == -1) array[ind++] = atoi(strReadBuffer.GetBuffer(0));
array[ind++] = '\0';
ind =0;
CClientDC dc(this);
CPen one,*old;
CRect rect;
GetClientRect(&rect);
one.CreatePen(PS_DASHDOTDOT,1,RGB(100,0,10));
old = dc.SelectObject(&one);
dc.SelectStockObject(NULL_BRUSH);
dc.Ellipse(array[0],array[1],array[2],array[3]);
dc.SelectObject(old);
}
}
BOOL CPaintingView::OnEraseBkgnd(CDC* pDC)
{
return TRUE; //Erase the BackGround Color
}
void CPaintingView::DrawPixel()
{
CRect Recto; //Draw the BackGround Color
GetClientRect(&Recto);
CPaintDC dc(this);
CBrush bgBrush;
CBrush *pBrush;
bgBrush.CreateSolidBrush(RGB(0,0,0));
pBrush = dc.SelectObject(&bgBrush);
dc.Rectangle(0,0,Recto.Width(), Recto.Height());
for(int x = 0; x < Recto.Width(); x += 17)
{
for(int y = 0; y < Recto.Height(); y += 17)
{
dc.SetPixel(x, y, RGB(255, 255, 255));
}
}
dc.SelectObject(pBrush);
}
void CPaintingView::OnFiguresCircle()
{
m_Circle = ID_FIGURES_CIRCLE;
bEllipseFlag = true;
circleDrawn = true;
}
void CPaintingView::OnButton32773()
{
m_Circle = ID_FIGURES_CIRCLE;
bEllipseFlag = true;
circleDrawn = true;
}
void CPaintingView::OnUpdateButton32773(CCmdUI* pCmdUI)
{
pCmdUI->SetRadio((m_Circle == ID_FIGURES_CIRCLE)?1 );
}
void CPaintingView::OnButton32774()
{
(strCollect.GetSize() > 0 ? strCollect.RemoveAll(): 0);
PostQuitMessage(0);
}
void CPaintingView::OnFiguresExit()
{
(strCollect.GetSize() > 0 ? strCollect.RemoveAll(): 0);
PostQuitMessage(0);
}
void CPaintingView::OnUpdateFiguresCircle(CCmdUI* pCmdUI)
{
pCmdUI->SetRadio((m_Circle == ID_FIGURES_CIRCLE)?1 );
}
void CPaintingView::OnButton32775()
{
m_SolidCircle = ID_FIGURES_SOLIDCIRCLE;
}
void CPaintingView::OnUpdateButton32775(CCmdUI* pCmdUI)
{
pCmdUI->SetRadio((m_SolidCircle == ID_FIGURES_SOLIDCIRCLE) ? 1 );
}
void CPaintingView::OnFiguresSolidcircle()
{
m_SolidCircle = ID_FIGURES_SOLIDCIRCLE;
}
void CPaintingView::OnUpdateFiguresSolidcircle(CCmdUI* pCmdUI)
{
pCmdUI->SetRadio((m_SolidCircle == ID_FIGURES_SOLIDCIRCLE) ? 1 );
}
void CPaintingView::OnFiguresRectangle()
{
m_Rectangle =ID_FIGURES_RECTANGLE;
}
void CPaintingView::OnUpdateFiguresRectangle(CCmdUI* pCmdUI)
{
pCmdUI->SetRadio((m_Rectangle == ID_FIGURES_RECTANGLE) ? 1 );
}
void CPaintingView::OnFiguresSolidrectangle()
{
m_SolidRectangle = ID_FIGURES_SOLIDRECTANGLE;
}
void CPaintingView::OnUpdateFiguresSolidrectangle(CCmdUI* pCmdUI)
{
pCmdUI->SetRadio((m_SolidRectangle == ID_FIGURES_SOLIDRECTANGLE) ? 1 );
}
void CPaintingView::OnFiguresLine()
{
m_Line = ID_FIGURES_LINE;
}
void CPaintingView::OnUpdateFiguresLine(CCmdUI* pCmdUI)
{
pCmdUI->SetRadio((m_Line =ID_FIGURES_LINE) ? 1 );
}
void CPaintingView::OnButton32780()
{
m_Line = ID_FIGURES_LINE;
}
void CPaintingView::OnUpdateButton32780(CCmdUI* pCmdUI)
{
pCmdUI->SetRadio((m_Line =ID_FIGURES_LINE) ? 1 );
}
void CPaintingView::OnButton32782()
{
m_SolidRectangle = ID_FIGURES_SOLIDRECTANGLE;
}
void CPaintingView::OnUpdateButton32782(CCmdUI* pCmdUI)
{
pCmdUI->SetRadio((m_SolidRectangle == ID_FIGURES_SOLIDRECTANGLE) ? 1 );
}
void CPaintingView::OnButton32781()
{
m_Rectangle =ID_FIGURES_RECTANGLE;
}
void CPaintingView::OnUpdateButton32781(CCmdUI* pCmdUI)
{
pCmdUI->SetRadio((m_Rectangle == ID_FIGURES_RECTANGLE) ? 1 );
}
void CPaintingView::OnSize(UINT nType, int cx, int cy)
{
CScrollView::OnSize(nType, cx, cy);
DrawPixel();
DrawCircles();
}
//==============================================================
Please provide me a solution.
Uday kiran
-- modified at 7:43 Tuesday 8th August, 2006
uday
|
|
|
|
|
I can run your code one black page with dots and (it doesnt work i change bEllipseFlag/insidepoint/circleDrawn to true)and when i lbutton it draws a circle but i think your code needs a lot of works for move circle(and...) in the OnLButtonDown you have a for that i think its for move you have a cstringarray that i think you get four numbers in this array and convert them for CreateEllipticRgn but how do you move circle,now:
---------
I have a suggestion for you see this[^] i think your program needs to another things (for example when you draw your circle aftre draw you want to change size of previous circle or need to undo/redo and ...) i dont know you want these things in your program or no but if yes see this link
--------
(2)you want to draw a circle and drag and drop well you can draw your circle and set this circle or circles to a control or controls like static and use from drag drop
--------
|
|
|
|
|
Hello all,
I have developed one dialog based application. How to resize this application according to resolution set by the user for the system. The application contains seven propertysheets in wizard mode.
Regards,
Aj.
|
|
|
|
|
To get the resolution
CRect rcWindow;
GetDesktopWindow()->GetWindowRect( &rcWindow );
Regard's
Dhana
|
|
|
|
|
mails2dhana wrote: GetDesktopWindow()->GetWindowRect( &rcWindow );
this will return only the dektop window. u have to move ur window after this
CRect rcWindow;
GetDesktopWindow()->GetWindowRect( &rcWindow );
Movewindow( &rcWindow );
nave
|
|
|
|
|
or SetWindowPos
|
|
|
|
|
|
|
try the following way
subclass the tabctrl in the property page.
overide the WM_LBUTTONDOWN message. Inside that call CTabCtrl::HitTest() to find the item. If the item is the one that u dont want to act as disabled, simply return the function with out calling the CTabCtrl::OnLButtonDown(..)
nave
|
|
|
|
|
see me wrote: disable a particular tab of my property page
Check this[^]
Do your Duty and Don't expect the Result
|
|
|
|
|
How do we know how much maximum memory we can use for user process running on some OS (2K, XP, CE, Mac, Linux etc.)?
I mean is it OS and hardware dependent or we can change it at the time of linking while linking for different OS.
Can we increase or decrease the maximum memory used by any user process if yes how ?
Thanks in advance.
Manish Agarwal
manish.k.agarwal @ gmail DOT com
|
|
|
|
|
The limit on the user-mode virtual address space for a process is well-defined for each OS. In Win32 it's normally 2GB, but on some versions of NT you can change it to some other value at boot time with boot.ini switches. The most common value to change to is 3GB. 64-bit Windows has different limits for each CPU type.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Vis C/C++ 6.0, Visual Studio
My program is a client to read a web page.
I am successfully setting up the socket.
The following calls and assignments are successful
WSAStartup()
memset(&sa,0,sizeof(sa));
sa.sin_family = AF_INET;
gethostbyname(gipaddrname); // example yahoo.com
memcpy(&sa.sin_addr, phe->h_addr, phe->h_length);
sa.sin_port = portn; //port 80 converted to net order
getprotobyname("tcp");
socktype = SOCK_STREAM;
sockdes = socket(PF_INET, socktype, ppe->p_proto);
connect(sockdes, (struct sockaddr *)&sa, sizeof(sa));
But when I go to receive the Servers 'hello'
message with:
recv(sockdes, pbufbin, len, 0);
I get the error:
WSAECONNABORTED The virtual circuit was terminated due to a time-out or other failure. The application should close the socket as it is no longer usable.
The strange thing is that I have used this exact code for
other servers, such a pop3 mail servers and servers that I wrote, all without a problem....
Any help would be much appreciated
Many thanks,
Robert
|
|
|
|
|
Robert Palma Jr. wrote: memcpy(&sa.sin_addr, phe->h_addr, phe->h_length);
try changing this line to
(&sa.sin_addr.s_addr,phe->h_addr,phe->h_length);
Hope this helps you.
KIRAN PINJARLA
|
|
|
|
|
Hi Kiran,
Thank-you for input.
I made the change but still get the same result.
Hmmm ....
Any other thoughts?
Many thanks,
Robert
|
|
|
|
|
hey all,
I get this error
error C2011: 'CNTGraph' : 'class' type redefinition
in the ntgraph.h header file in the line
// CNTGraph wrapper class
class CNTGraph : public CWnd ---error here.
{
protected:
----
}
I havent defined this classa anywhere else. Waht could be wrong?
Any help/suggestins?
thanks in advance.
|
|
|
|
|
The most likely cause of this problem is that the h-file for CNTGraph becomes included more than once.
The usual way to fix this problem is to surruond the contents of the h-file with a block such as this:
#ifndef CNTGRAPH_H
#define CNTGRAPH_H
.... The normal class definition
#endif
That way, the class can only be defined once. Of course, you substitue CNTGRAPH_H with something else for other classes.
|
|
|
|
|