|
NiHao, Is google translator not working again?
A dll on it's own is harmless, but when a program loads it, the bad code inside will run. A virus scanner looks at the bytes inside any memory looking for a specific sequence 's of bytes.
|
|
|
|
|
In SDI project I need to call some function that create in CView at CDocument class.
but when I declare as CMyView m_view in header file of *Doc.h I got a lot of error.
Please give me some idea for solve this problem.
|
|
|
|
|
use a forward declaration for the view...
// In the CYourDocument header file toward the top
class CYourView;
|
|
|
|
|
Also, here's a method you can create in your document class that will simplify getting the view pointer.
// Document declaration file (.h)
public:
CYourView* GetView();
// Document implementation file (.cpp)
CYourView* CYourDoc::GetView()
{
// Assumes this is an SDI app
POSITION position=GetFirstViewPosition();
if (position) {
return (CYourView*)GetNextView(position); // Get the only view
}
return NULL;
}
|
|
|
|
|
use this code may it help
CFrameWnd *pFrame = (CFrameWnd *)AfxGetApp()->m_pMainWnd;
CYourView *pView = (CYourView *)pFrame->GetActiveView();
Regards,
Pankaj Sachdeva
"There is no future lies in any job"
"but"
"future lies in the person who holds the job"
|
|
|
|
|
In my application I have to add a Menu Item in the System Pop-up Menu, just like Winzip does.
So that, I can manipulate my application from the menu, whenever I Right-clicked on any file.
I couldn't find any way out about how to do this. Please guide me to write the code in MFC and
also please tell, what are the necessary Registry Key entries for doing this during the installation of the application?
Sudipta Mukherjee
|
|
|
|
|
|
When you say "system menu" I believe you mean the right-click menu in Windows Explorer?
Search in MSDN for "Shell Basics" and then look at the "Extending the Shell" section onwards.
|
|
|
|
|
Hi~
I made Dialog Box and I put a button for creating new window named CBrowserWnd
Which has base class CFrameWnd or CWnd.
What I would like to know is how to apply the CHtmlView to CBrowserWnd.
In Single or Multiple Document CWinApp DocTemplate do this job.
but I don't know how to apply CHtmlView to CBrowserWnd without using
DocTemplate?.....
heres my signature
|
|
|
|
|
You could try reading here[^] and creating a sample BrowserApp to see what the MFC Wizard does, and/or examine the MFCIE Sample[^] for guideance
|
|
|
|
|
Thank you for your kind answer....^^
is it possible to combine CMyView with CMyFrameWnd without supporting Document/View architecture in the AppWizard...? I am using dialog based program. and I know that dialog based doesn't support the Document/View architecture.... so I put a button which creates popup window(CFrameWnd) so I need to know how to combine the CMyView(CHtmlView) and CMyFrameWnd.
-- modified at 1:30 Thursday 30th August, 2007
heres my signature
|
|
|
|
|
The MFC normally creates the View in response to the OnCreate message invoked as a result of LoadFrame. I see no reason why you couldnt do the same thing.
Alternately you could use the MFC Wizard to create a new SDI application with the Document/View architecture using CHtmlView as the view and then migrate the neccessary bits into your project (the frame, document and view).
|
|
|
|
|
Hi all,
I made a modified version of MBrooker's extended mime to extract embedded files of .eml messages, I was able to make it but unfortunately I have to break the standard content type, instead of Multipart/mixed I used Multipart/related:
virtual inline BOOL MakeMimeHeaderTwo(CStringA& header, LPCSTR szBoundary) throw()
{
_ATLTRY
{
if (!*szBoundary)
{
header.Format("X-Priority: %d\r\n%s", m_nPriority, (LPCSTR) m_XHeader);
}
else if (m_BodyParts.GetCount() > 1)
{
header.Format("X-Priority: %d\r\n%sMIME-Version: 1.0\r\nContent-Type: multipart/related;\r\n\tboundary=\"%s\"\r\n",
m_nPriority, (LPCSTR) m_XHeader, szBoundary);
}
return TRUE;
}
_ATLCATCHALL()
{
return FALSE;
}
}
Now the solution I am thinking of is to create a new boundary for the multipart/related part of the msg so I can still use the standard Multipart/mixed, now my question is how can I do that?
From my analysis there will be a lot of changes at altmime.h
Is there a way to create a new boundary?
any suggestions of course will be welcome and thanked.
Thank you,
Monsieur Jj
|
|
|
|
|
I made my own version of writedata
virtual BOOL WriteData(HANDLE hFile, LPOVERLAPPED pOverlapped, LPCSTR szBoundary=NULL, DWORD dwFlags = 0) throw()
{
if (pOverlapped == NULL)
{
return FALSE;
}
char szBoundaryBuf[ATL_MIME_BOUNDARYLEN+1];
if(MakeBoundary(szBoundaryBuf,ATL_MIME_BOUNDARYLEN+1) == FALSE)
return FALSE;
if (szBoundary && *szBoundary != '\0')
{
_ATLTRY
{
CStringA strHeader;
strHeader.Format("\r\n\r\n--%s\r\nContent-Type: message/rfc822\r\n\tname=\"%s\"\r\nContent-Transfer-Encoding: 8bit\r\n"
"Content-Disposition: attachment;\r\n\tfilename=\"%s\"\r\n\r\n",
szBoundary, m_szDisplayName, m_szDisplayName);
if (!AtlSmtpSendAndWait(hFile, ((LPCSTR)strHeader), strHeader.GetLength(), pOverlapped))
{
return FALSE;
}
}
_ATLCATCHALL()
{
return FALSE;
}
}
if (!CMimeHeader::WriteData(hFile, pOverlapped, szBoundaryBuf, dwFlags))
return FALSE;
CStringA strHeader;
char szBoundaryBufTwo[ATL_MIME_BOUNDARYLEN+1];
if (MakeMimeHeader(strHeader, szBoundaryBuf))
{
MakeBoundary(szBoundaryBufTwo,ATL_MIME_BOUNDARYLEN+1);
MakeMimeHeaderTwo(strHeader, szBoundaryBufTwo);
}
else
{
return FALSE;
}
if (!AtlSmtpSendAndWait(hFile, ((LPCSTR)strHeader), strHeader.GetLength(), pOverlapped))
{
return FALSE;
}
CMimeBodyPart* pCurrPart;
POSITION currPos = m_BodyParts.GetHeadPosition();
while (currPos != NULL)
{
pCurrPart = m_BodyParts.GetAt(currPos);
if (pCurrPart->GetContentType()== "text/html"){
if (!pCurrPart->WriteData(hFile, pOverlapped, szBoundaryBuf, dwFlags))
{
return FALSE;
}
m_BodyParts.GetNext(currPos);
}
else
{
if (!pCurrPart->WriteData(hFile, pOverlapped, szBoundaryBufTwo, dwFlags))
{
return FALSE;
}
m_BodyParts.GetNext(currPos);
}
}
char szBuf[ATL_MIME_BOUNDARYLEN+(sizeof("\r\n\r\n--%s--\r\n"))];
if (*szBoundaryBuf)
{
#if _SECURE_ATL
int nBufLen = sprintf_s(szBuf, ATL_MIME_BOUNDARYLEN+(sizeof("\r\n\r\n--%s--\r\n")),
"\r\n\r\n--%s--\r\n", szBoundaryBuf);
#else
int nBufLen = _snprintf(szBuf, ATL_MIME_BOUNDARYLEN+(sizeof("\r\n\r\n--%s--\r\n")),
"\r\n\r\n--%s--\r\n", szBoundaryBuf);
#endif
if ((nBufLen < 0) || (!AtlSmtpSendAndWait(hFile, szBuf, nBufLen, pOverlapped)))
{
return FALSE;
}
}
return TRUE;
}
Now i have a different output i have the working boundary for the whole mime unfortunately I only want them for the embedded attachments, how can I do this? Can anyone make a change to the code above?
Then it is enclosed by another boundary the first I made unfortunately it has no header content-type which i expect to be multipart/mixed, it is being over written by multipart/related eventhough i already changed the function names for them so they will be performed both, How can I write both headers?
|
|
|
|
|
I am missing the obvious. I know it. Given an activeX control, let's say something visual, I drop the control onto a dialog. When I build the application, VC++ says, "Hey, this is the first time you've used this control, and I need to build a wrapper class for it", so it does, and I have two new files: activex.cpp and activx.h.
Now, suppose I have a non-visual control, something I don't drop into a dialog. I still need the wrapper classes. How do I generate these?
Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
Overheard in a cubicle: "A project is just a bug under development."
Seeking to rise above the intelligence of a one eared rabbit...
Caught in a vortex of weirdness...
|
|
|
|
|
In VS 2005, you can right click a project in the Class View window and
(or from the Project menu) choose Add Class...
From the add class dialog MFC section, there's a "MFC Class From ActiveX Control" option.
Choose that and a dialog with the list of installed activeX controls and interface
selection options is shown.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'd like to have a simple control bar instance that is like the Outlook 'caption' bar. Any tips or examples of how to do this would be greatly appreciated - it's been yonks since I did anything with toolbars and have forgotten it all.
|
|
|
|
|
|
I need some suggestions.
I am using CEditView to edit .txt file.
When I use CFile I set the buffer to 10000 and transfer the file text using
SetWindowText((char*) file). Works fine but gives me a ton of non ascii characters. I ended up filling the buffer with spaces after the real number of characters was read.
Is there a way to "modify" the CFile buffer length?
I like to try to use CStdioFile with CStdioFile::modeText which should eliminate the weird stuff. I cannot figure out how to insert the text into CEditView since the file “output” is in CString format per line.
How does one insert CStrings into CEditView?
Thanks for reading.
Vaclav
|
|
|
|
|
Get all the file (using CFile) and put it in a CString....then use SetWindowText(string)
If problems with the contents of the String when reading the file try to specify CFile::typeText open mode.
Russell
|
|
|
|
|
Works but ... it does not get rid of empty buffer stuff and it takes forever.
Thanks and see my other comments.
Cheers
Vaclav
|
|
|
|
|
Error checking is skipped, but the code should be usable:
<br />
CFile file;<br />
file.Open("file.txt",CFile::modeRead);<br />
int len = file.GetLength();<br />
TCHAR pData = new TCHAR[len+1];
int read = file.Read(pData,(len+1)*sizeof(TCHAR));<br />
file[read] = '\0';<br />
view_object.SetWindowText(pData);<br />
delete [] pData;<br />
|
|
|
|
|
I think this is the best and an efficient soulution. ( It does not read past the file lenght as I am doing and collecting nothing! ).
I want to try CArchive per Mark's suggestion.
I will post results when I am done.
Thanks
|
|
|
|
|
I'm wondering why you're using the CEditView class but not using any
of its built-in functionality?
The class comes with a built-in SerializeRaw() method for moving text into
and out of the window.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I plead ignorace.
CArchive here I came!
I still have doubts that it will get rid of the lefovers in the buffer.
Give me few hours to try it anyway.
|
|
|
|