I got it in VS.Net, and I'll have a try this method. Thank you. Best Regards, Haifeng
rgbalpha
Posts
-
how to new a doc/view in program with parameters -
Where is the class wizard in VS2005When you click the class in class sheet, you'll see a property sheet. It is like the class wizard for adding message handlers and overwriting virtual functions. If you use Dialog DDV/DDX, the adding variable members is for it.
-
Can FindFirstFile/FindNextFile be multithread?Hi, Thank you for the solution. I'll have a try this method. Best Regards, Haifeng
-
how to new a doc/view in program with parametersMFC documentation has the creation of a new document and views. It is in CDocTemplate::OpenDocumentFile(). There a new document ojbect is created. But there are NOT an easy interface to use. Or you must overrride this function. That is, you have to inherit your own doctemplate class. Then use this class to create the new document/view.
-
Can FindFirstFile/FindNextFile be multithread?In FielProcessor() { new pFile = File(); delete pFile; // Error when there are nearly 25 threads. The first serval threads are OK. }
-
how to new a doc/view in program with parametersYes, it is. I didn't think how to add a tree view. But if possible, the treeview is better. That is I need. Hope suggestion.:)
-
how to new a doc/view in program with parametersHi, thank you for your help. The file open dialog is actually implemented in ID_FILE_OPEN command. I override this in CMyDoc::OnOpenDocument(). Here I open the image and send to view for display. The problem is that I want to display results. They are a list of images just like std::vector m_imagelist. The CMyDoc can only display images in original size, and it can't display a list of images in only a document. In other words, what I want to do is like the Windows Explorer. It can display images in thumnail.(mine is CMyDoc2/CMyView2), When clicking thumbnails, it open the image in an image viewer.(mine is CMyDoc2/CMyView). The question is how to communicate between them.
-
how to new a doc/view in program with parametersMy project actually is an image search program, as follows: First, user must input the search key words or image, that is, the program gets the m_imagefilename for it. The search image is displayed in a doc. This is CMyDoc1. Then where to search the image, that is, the m_imagedatabase. It is a directory in hard disk. When clicking the search button, the search begins. In the end, the seearch results return. The return value is a list of image name, that is, m_imagelist. The m_imagelist is sent as a parameter to the CMyDoc2 for thumbnail display. When double clicking the thumbnails, the original image is displayed in CMyDoc1. In implementation, I create a MDI project with CMyApp, CMainFrame, CChildFrame, CMyDoc/CMyView, CMyDoc2/CMyView2. In CMyApp, two members are added for doc templates. m_pDocTemplate1, m_pDocTemplate2. The two pointers are for selecting different doc types. CMyDoc/CMyView are mainly for displaying images in original size for query and result. CMyDoc2/CMyView2 are mainly for displaying search results. The results are thumbnails. I use CImageList and the CMyView2 is inherited from CListView. When clicking thumbnails, in the message handler, it should call a function to create a new doc with image name as parameter to create CMyDoc/CMyView for display. That's why I ask the question.
-
Can FindFirstFile/FindNextFile be multithread?Each time when the program find a file, it send it to the file_handler() to process. The file_handler() is a function in where I create another thread to process the file. It is like this:
void CMyDoc1::file_handler(LPCTSRT pFileName) { m_fileName = pFileName; AfxBeginThread(ThreadProc, this); } UINT ThreadProc(PVOID pParam) { //processing the file... CMyDoc1* pDoc = pParam; pDoc ->FileProcessor(); return 0; }
The error occurs in FileProcessor(), when free the memory. -- modified at 6:47 Monday 11th December, 2006 -
Can FindFirstFile/FindNextFile be multithread?Hello folks, I want to search all of files under some directory. For example, dir\file1.txt, dir\file2.txt, dir\file3.txt, ... When using ::FindFirstFile and FindNextFile, I can get all files, and then I can process them. But because the processing may last long, I want to use multithread, but There are strage errors. Can ::FindFirstFile/FindNextFile be multithread? or Are they thread safe? Thanks in advance. Haifeng
-
How to create and use a lib file ?Do you try adding your .lib to the project settings? or Is it your .lib path incorrect?
-
how to new a doc/view in program with parametersHello, My MFC is MDI program. I have two doctemplate in CMyApp, that is, m_pDocTemplate1 and m_pDocTemplate2. In CMyDoc1, I process some variables m_var, and then send to CMyDoc2 for processing. I handle a command to create a doc of doctemplate2 type. I do as follows:
void CMyDoc1::OnCmd() { static_cast(AfxGetApp())->m_pDocTemplate2->OpenDocumentFile(NULL, TRUE); }
This can only create a new empty doc/view. But what I need is to create a doc and at the same time, the CMyDoc1::m_var can be sent to CMyDoc2. How can it implement? Does anyone give me some light? Thanks in advance. Best Regards, Haifeng