|
So to understand when wanting to copy text from a CView, one has to track the text. Then when the user defines a rectangle, the app has to use the define rectangle and then search the tracked text for the starting and stopping point. Then move that highlighted text to clipboard
|
|
|
|
|
is you view a graphic view ( i.e. drawn text ) or a text view ( Editable text ) ?
if it's a graphical view, you need to have a way to be able to know that text is in the selection rectangle because it will ( ? ) be pixels, not text.
if it's an editable text view, ( CEdit or CRichEdit ), you should be ready to go, with appropriate class members to select the text and copy it to the clipboard.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Very good! When you are drawing the text you need to keep track of were you drew it, if you want the user to be able to select it. With that infomation it should be farely easy to determine what text is contain within the selection rectangle. Note, I said farely easy; in reality the calculation can get quite complicated (depending on font used, text extents and all that).
Good Luck!
INTP
|
|
|
|
|
I am working with MDI apps.It is Explorer Apps. Some of the Global variables were created.I want make it as class variables.I was converted 90%.But I got problem with CListView variables.wherever CListView is there.I try replace with ((CMyListView *)AfxGetApp())->. He was created one ListView variable in CDocument class.I try to replace with m_pDOc->m_ListView. But I am getting Access Violation Errors? Pl Help me..........
dadsadasd
|
|
|
|
|
Where is it declared? Declare it in stdafx.h.
Kuphryn
|
|
|
|
|
All global variables were declared in one file.
dadsadasd
|
|
|
|
|
Hi,
You cannot cast AfxGetApp() to CMyListView! AfxGetApp() returns a pointer to your main CWinApp.
If you want to get a pointer to your ListView, then try:
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
if (pFrame && pFrame->GetSafeHwnd())
{
CMDIChildWnd* pChild = (CMDIChildWnd *)pFrame->GetActiveFrame();
if (pChild && pChild->GetSafeHwnd())
{
CMyView* pView = (CMyView*)pChild->GetActiveView();
}
}
Assuming that it is the current view...
If you have any questions, I'd be happy to help,
Andy
|
|
|
|
|
Thanks for reply,
I got problem at GetDocument() function.
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(COamDoc)));
return (COamDoc* )m_pDocument;
Here I am getting assertion failure
dadsadasd
|
|
|
|
|
Hi,
To use the IsKindOf function,
Make sure the class has run-time class support. That is, the class must have been derived directly or indirectly from CObject and used the DECLARE_DYNAMIC and IMPLEMENT_DYNAMIC, the DECLARE_DYNCREATE and IMPLEMENT_DYNCREATE, or the DECLARE_SERIAL and IMPLEMENT_SERIAL.
I've guessing that COamDoc is your derived CDocument class (??) in which case as long as you've not removed any MFC code this should be the case.
Again, if you need to gain access to the document...
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
if (pFrame && pFrame->GetSafeHwnd())
{
COamDoc* pDocument = (COamDoc*)pFrame->GetActiveDocument();
}
|
|
|
|
|
Thanks ,I was implemented, still I am getting same errors.
Actual Problem:
class CMyDoc : public CDocument
{
CListView * p1;
CTreeView *p2;
};
class CMyDoc;
class CMyDialog : public CDocument
{
CMyDoc *m;
};
void CMyDialog :: OnOk()
{
m->p1->fun(); ---------> Here I am getting an error ->Access violation
CDialog::OnOk();
}
CListView ,CTreeView are members of the CMyDOc.
Pl Help me
satya
|
|
|
|
|
I inherited some source code that was originaly written for command line apps.
Some functions have signatures as follows
void doSomething(whatever wh, FILE *fp);
so if you pass stdin or stderr it will output the result to the console.
Since I'm writing an MFC app that needs to use these functions, is there any way to redirect the output to a MessageBox, Static text or any other non console output?
|
|
|
|
|
|
I'm making an MFC appplication with CDialog as the base class. Wanna open another non modal dialog in it. Please suggest me how to do this...
All help is appreciated
Thanks
|
|
|
|
|
CAnotherDialog *pDlg;
pDlg = new CAnotherDialog;
pDlg->Create(CAnotherDialog::IDD);
pDlg->ShowWindow(SW_SHOW);
for more info read the msdn.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
don't forget to delete pDlg the variable.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Modeless dialog created via pointers generally delete themself.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
Thanks for the help it solved the problem.
|
|
|
|
|
char *sendSize;
sendSize = new char[10];
//on operator delete i have error during the running:
//Unhandled exception at 0x77f767cd in Connect.exe: User //breakpoint.
// in dbgheap.h
// #define WINVER 0x0400
// I'm using VS 7.
delete [] sendSize;
|
|
|
|
|
there must be something you must be doing between new and delete that is causing the problem with the pointer.
if you overshoot the buffer you would get the error when deleting the pointer.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
Weird... I had that one too a while ago and it seemingly had nothing to do with pointers. This is just that there is a particular breakpoint code in executable. Can this be a compiler bug because it all went away as soon as I switched to Release build.
PS. It's not an "overshoot" error. The error message sounds differently. I remember because I get it at times
|
|
|
|
|
You are still trashing memory outside of the array. The reason it doesn't have problems in release mode is because the CRTL doesn't have the memory checks on deallocation. All you did was turn off the error, not fix it.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Yup. This can be true. But the other possibility is that there actually is no error and Debug version just keeps generating that lousy exception because I'm trying to write beyond what's the end of the string (i.e. '\0') but far from being beyond the end of the allocated memory end. In such case it can be but a misunderstanding based on compiler developers' wish to warn programmer of a possible mistake.
If it's an actual error then please somebody explain to me what's wrong with this code:
char* ptr=new char[256];
strcpy(ptr,"123");
ptr[3]='4';
ptr[4]='\0';
delete [] char; //we get an exception here
|
|
|
|
|
Be sure you don't write outside the border of your allocated memory (be carefull of the end of string character ('\0') ). So this will probably produce an exception when destroying the string:
char* sendSize;<br />
sendSize = new char[10];<br />
strcpy(sendSize,"1234567899");
|
|
|
|
|
Try setting the last item in the array to null.
Kuphryn
|
|
|
|
|
See the line dbgheap.h which is showing an error. It can tell you a lot about the failure.
Bikram Singh
|
|
|
|