|
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.
|
|
|
|
|
thathvamsi wrote: 'CNTGraph' : 'class' type redefinition
You might have include the '.h' file(which has CNTGraph) in more than one place... to avoid redefinition error try by putting the below as your first line of .h file
#pragma once
-- modified at 1:53 Tuesday 8th August, 2006
Do your Duty and Don't expect the Result
|
|
|
|
|
That's right (of course). I didn't think of that , I just came back from my summer vacation.
|
|
|
|
|
No Problem, every body will miss something in someday.. Cheers..
Do your Duty and Don't expect the Result
|
|
|
|
|
Did you see msdn
From the MSDN
<br />
'identifier' : 'type' type redefinition<br />
The identifier was already defined as type. For example:<br />
<br />
struct S;<br />
union S;
<br />
<br />
<br />
<div class="ForumSig"><font size="2" color="#99ff66"><hr></font><div style="padding: 2px; text-align: left; color: rgba(255, 255, 255, 1); width: 80px"><font size="2" color="#99ff66">WhiteSky<br />
</font></div><hr></div>
|
|
|
|
|
Hi,
I have created a TCP connection between client and server. On client system I do socket(), bind(), connect() and recv()/send(). I do recv() and send() simultaneously in two threads.
The program works fine for some time (1-2 minutes), but after some time, recv() returns SOCKET_ERROR. WSAGetLastError() returns error code of 12. Any suggestions on how to solve this problem?
I am sending about 20 packets per second (at a rate of 100kbps). I am receiving about same number of packets although bitrate is much lesser.
Any help will be highly appreciated.
Thanks very much in advance.
Regards
RS
|
|
|
|
|
What are the sizes of the packets?
Do they change?
You need to print the error message text.
I think 12 is:
WSAEMSGSIZE The message was too large to fit into the specified buffer and was truncated.
But I'm not sure.
The above is in the MSDN for recv().
FUNNY, I am chasing a recv() error right now myself! My post is just a few after yours
|
|
|
|
|
> What are the sizes of the packets?
> Do they change?
Initially the packet sizes are about 8-10 bytes. Later packet sizes increase to 600-800 bytes. When the packet size is small and packets per second are low, the error is generated after a longer time. When packet size increases the error is generated in a very short time.
Also I am using TCP port 80.
|
|
|
|
|
Also if I use port such as 5000 the program works fine.
Thanks a lot.
Regards,
RS
|
|
|
|
|