|
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.
|
|
|
|
|
Heh Note I didn't say it was THE solution....I was just wondering.
Often (always?) the canned MFC classes are ok in their simplicity, but they aren't sufficient
for everything. CEditView is a simple edit control so you're kind of stuck with the limitations
of an edit control - like plain text.
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Anyone know how I can implement this in code?
Trying to synchronize data samples from two different hardware devices. One device is sampling around 10pt/s and the other device is sampling at 50pt/s. These samples are displayed on a graph in realtime.
|
|
|
|
|
Can someone explain what "callback functions" are and how they are used? Or, point me to a good "callback functions for Dummies" web-site?
Thank you in advance
Pierre
|
|
|
|
|
|
|
vHi. I'm working on an MFC project in a company and we're stuck with Visual Studio 7.0 (2002/.Net) for the time being. I added an STL::map to a dll to hold some strings. The code compiles fine but falls over with an access violation whenever I try to do anything with the map (add items, call find() etc). It's like the container is corrupted somehow.
I've googled the problem and I've read a few other articles (eg. http://support.microsoft.com/kb/q168958/) and I think everything is set up correctly. Here's my code:
<br />
header of DLL:<br />
<br />
#pragma once<br />
<br />
namespace RegUtils<br />
{<br />
CString getRegCachedValue(const CString& p_strID);<br />
<br />
..<br />
<br />
}<br />
<br />
CPP of DLL:<br />
<br />
typedef std::map<CString, CString> RegKeyMap;<br />
typedef RegKeyMap::iterator RegKeyMapIter;<br />
RegKeyMap gRegKeyMap;<br />
<br />
CString RegUtils::getRegCachedValue(const CString& p_strID)<br />
{<br />
CString strValue = _T("");<br />
<br />
RegKeyMapIter iter = gRegKeyMap.find(p_strID);
if (gRegKeyMap.end() != iter) {<br />
strValue = iter->second;<br />
}<br />
<br />
return strValue;<br />
}<br />
As soon as the code gets to the find() method, it falls over. Ditto for any other operation on the map. Please help this is driving us nuts and I feel I've tried everything.
It's been suggested we switch to MFC maps as they apparently don't have this problem but that would be a LOT of work.
I'm using the 'Multi-threaded Debug DLL (/MDd)' runtime lib to build the DLL. I've read about problems associated with copying STL objects back and forth over DLL boundaries but I'm not doing that here - the map and this function is private to the DLL (it is not exported) and is used only internally. The code is being called by other DLLs (also built using /MDd).
Please help!
|
|
|
|
|
I'm not going to be able to find anything specific but I am sure I have done something like that in the past without problems. The most obvious difference is that I would have used a Singleton Pattern[^] rather than a global. Perhaps you might give that a try.
|
|
|
|
|
The problem is that we cannot read the < and > in your code (and for templates, it is quite annoying). Please, replace them by the two symbols that are above the emoticons.
Now for your problem, can you give a better description of the exception ? What is the exact error ? When you use the debugger, where does it crashes ? The more info you provide, the more chances you'll get help.
|
|
|
|