Hi I used logical coordinates in my program,in such functions as MoveTo() ,LineTo()etc.But if I scroll the client are i am not able to get those points.i am using CScrollView only.how to convert the coordinates and get the points? thanks in advance. Pathi bhikshapathi_g@semanticspace.com
pathi
Posts
-
how to convert from device coordinates into physical coordinates -
How to Convert CString to Char*Hi, Iam getting problem with converting CString into Char* and vise versa. If anyone helps me in this thanks for their help. Regards Pathi bhikshapathi_g@semanticspace.com
-
how to convert from device coordinates into physical coordinatesHi I drew a few line .Now I want to select a particular line by clicking on that line.I implemented a funtion which will take the mouse point and end points of line as parameters and returns true if the point is on the line by using Bresehalm's algorithm.for that I need to find the slope of line.the window has default mapping mode MM_TEXT.How can I convert the device coordinates into physical coordinates as if I place the mouse over the line the function should return true?how to solve this problem?please help me.for the lines with negative slopes I am getting errors. Thanks Regards Pathi bhikshapathi_g@semanticspace.com
-
line drawing algorithmhi I want to find whether the mouse is positioned on the line which I draw ,or not.for this I am using Bresenhalm algorithm.this is the code. /* [helpstring] */ STDMETHODIMP CConnector::intersects(/* [in] */ SPoint pt,/* [retval][out] */ BOOL __RPC_FAR *checkflag) { SRect boundingRect; ptrConState->get_Position(&boundingRect); SPoint start,end; start.x=boundingRect.topLeft.x; start.y=boundingRect.topLeft.y; end.x=boundingRect.bottomRight.x; end.y=boundingRect.bottomRight.y; double m=findSlope(start,end); int dx,dy,xend,yend,p,x1,y1; dx=abs(start.x-end.x); dy=abs(start.y-end.y); //if(m<1||m>-1) if(m<=1&&m>=0) { p=2*dy-dx; if(start.x>end.x) { x1=end.x; y1=end.y; xend=start.x; } else { x1=start.x; y1=start.y; xend=end.x; } while(x1=0) y1=y1+1; //else // y1=y1-1; p=p+2*(dy-dx); } if((pt.x==x1)&&(pt.y==y1)) { *checkflag=1; return S_OK; } } *checkflag=0; return S_OK; } else if(m<0&&m>-1) { p=2*dy-dx; if(start.x>end.x) { x1=end.x; y1=end.y; xend=start.x; } else { x1=start.x; y1=start.y; xend=end.x; } while(x1=1) { p=2*dx-dy; if(start.y>end.y) { x1=end.x; y1=end.y; yend=start.y; } else { x1=start.x; y1=start.y; yend=end.y; } while(y11) x1=x1+1; else x1=x1-1; p=p+2*(dx-dy); } if((pt.x==x1)&&(pt.y==y1)) { *checkflag=1; return S_OK; } } *checkflag=0; return S_OK; } *checkflag=0; return S_OK; } here the problem is i am not getting exact intersections for the lines slope of which is less than 0 and greater than -1.why this problem? please find any mistakes and hellp me.I also want that the user of my application can easily select the lines provided some offset for the line to get selected. Thanks regards Pathi bhikshapathi_g@semanticspace.com
-
proble in releasing the pointerHi I queried for a interface pointer in a constructor and want to use it across several functions.I need that pointer in many functions but dont know where to release it and how to do it?Can I release it in destructor of the class in which i queried and using? Please help me Thanks Pathi:( bhikshapathi_g@semanticspace.com
-
HELP!!! How to Release Memory in COM?memory means you r want to delete the pointers ?You can release them by calling Release() method of IUnknown interface. Pathi bhikshapathi_g@semanticspace.com
-
any good material on com in net?hi I want some good samples on aggregation ?Where can I find links for this? please help Pathi bhikshapathi_g@semanticspace.com
-
when to call AddRef() and Releasehi I am getting confused as when to call the methods AddRef() and Release() methods.I am using aggregation hence please tell me in detail.I am new to com Thanks Pathi bhikshapathi_g@semanticspace.com
-
how do I implement IStorage methodsHi I have serialized my data into an xml file.Now I want to implement IStorage methods and expose those methods to encapsulate my xml code. To achieve this what I have to do?I want to pass IXMLDOMDocument pointer to IStorage methods.Can I do this?or how to do? Thanks in advance Pathi bhikshapathi_g@semanticspace.com
-
How to reflect the changes made in view to documentHi I have a class Line which has 2 endpoints as members and Drawing() as method. I just declared a CTypedPtrList of pointers to Line in document .I accessed the list in view by GetDocument() and created the instance of Line and added to list.I want to modify the values of end points so that i can draw another line with same pointer.I am able to reflect the changes in OnDraw() but I want to serialize the data which i modified.i am able to serialize the data which i have given at the time of creating the instance of the class(pointer which i am storing in list) but not the modified values.I am getting the pointer from list and modifying the values after assigning to another pointer.to reflect the changes what i have to do? Thanks for ur help. bhikshapathi_g@semanticspace.com
-
how can i handle file commands to read and write xml filesYeah I am trying to override OnOpenDocument() but i cant get the data from file into the document.I declared DISPPARAMS pointer in document and trying to get the data read from file into this pointer but getting an error.my aim is to read from file and show it in view. my code is void componentView::fileOpen() { isFileOpen=true; CFileDialog file(true, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, NULL, GetParent()); file.DoModal(); CString filep=file.GetPathName(); BSTR filepath; TCHAR szStringRepresentation[200]; wsprintf ( szStringRepresentation, _T("%s"), filep ); filepath=_bstr_t(szStringRepresentation) ; CClientDC cdc(this); CPen penStroke(PS_SOLID, 1, RGB(0,0,0)); cdc.SelectObject(&penStroke); parse pa; DISPPARAMS var=pa.readFile(filepath); DISPPARAMS *params; params=&var; VARIANT myVars[2]; VariantInit(&myVars [0]); myVars[0].vt=VT_ARRAY|VT_I4; myVars[0]=params->rgvarg[0]; VariantInit(&myVars [1]); myVars[1].vt=VT_ARRAY|VT_I4; myVars[1]=params->rgvarg[1]; SAFEARRAY* SXArray; SAFEARRAY* SYArray; SXArray=myVars[0].parray; SYArray=myVars[1].parray; long lxbound,lybound; long uxbound,uybound; SafeArrayGetLBound(SXArray,1,&lxbound); SafeArrayGetUBound(SXArray,1,&uxbound); SafeArrayGetLBound(SYArray,1,&lybound); SafeArrayGetUBound(SYArray,1,&uybound); VARIANT ptVar; VariantInit(&ptVar); ptVar.vt=VT_BSTR; int i,j,k,l; for(long p=lxbound;p<=uxbound;p++) { SafeArrayGetElement(SXArray,&p,(&ptVar.bstrVal)); i=strtol(_bstr_t(ptVar.bstrVal),NULL,10); SafeArrayGetElement(SYArray,&p,(&ptVar.bstrVal)); k=strtol(_bstr_t(ptVar.bstrVal),NULL,10); p++; SafeArrayGetElement(SXArray,&p,(&ptVar.bstrVal)); j=strtol(_bstr_t(ptVar.bstrVal),NULL,10); SafeArrayGetElement(SYArray,&p,(&ptVar.bstrVal)); l=strtol(_bstr_t(ptVar.bstrVal),NULL,10); cdc.MoveTo(i,k); cdc.LineTo(j,l); } } I did in view but how can I read file in document and draw the lines in view? bhikshapathi_g@semanticspace.com
-
how to get the VARIANT array of structure having two CPoint variablesHai I want to put my structure containing two CPoint variables into VARIANT array and assign to DISPPARAMS.I need variant array of this structure. How can I do it? Thanks Pathi Gorantla bhikshapathi_g@semanticspace.com
-
how to pass CTypedPtrList objectHi I declared CTypedPtrList object in the document class like this CTypedPtrList m_strokeList; and I want to pass this list to a function in a view by declaring reference CTypedPtrList& LineList = pDoc->m_strokeList; writeFile(filepath, LineList ); I am getting error that error C2664: 'writeFile' : cannot convert parameter 2 from 'class CTypedPtrList' to 'class CTypedPtrList' No copy constructor available for class 'CTypedPtrList' How can I solve this problem? bhikshapathi_g@semanticspace.com
-
how can i handle file commands to read and write xml filesHi I serialized my data in an xml file but how can I open or save them using Document view architecture.I want to read data from document and use it in view. I will be glad if I get a clear answer. Thanks Pathi Gorantla bhikshapathi_g@semanticspace.com
-
how to override file handler functionsHi I stored two points in an xml file and retrieved them in OnOpenDocument() but How can I pass these values to View to draw a line with the points? Pathi bhikshapathi_g@semanticspace.com
-
how to override file handler functionsI want to store my data in an xml file and have operations of file new,open and save.I am coding in vc++ and not using CObject class which takes care of these default.How can I achieve this? Thanks in advance. Pathi :) bhikshapathi_g@semanticspace.com
-
variablehow to convert from int to BSTRHi Please tell me how to convert from int to BSTR in VC++.I want to create a xml node with an int value.I need to pass BSTR variable to the method createTextNode(). How can I do it? Thanks. Pathi bhikshapathi_g@semanticspace.com
-
how can i select a particular object using the list pointers to objects?hai Thanks for fast response. I have drawn a few lines by instantiating class and I stored the pointers to objects in a list.now I want to select a particular line using this list of pointers.If I want to select a line to resize or drag it.for that purpose how can I get the pointer to particular object?I used pointers.I have written it in vc++. Thanks again. bhikshapathi_g@semanticspace.com
-
how can i select a particular object using the list pointers to objects?I drawn multiple objects using pointers.i stored all pointers.how can i select a particular object using the pointer list?or any other simple method to serve the same purpose? Please answer in detail. thanks in advance.:) eeshwar_g@nagar.com