Click here to Skip to main content
16,015,166 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Shell Context menu and "Send To" Pin
_Magnus_31-May-02 3:46
_Magnus_31-May-02 3:46 
GeneralRe: Shell Context menu and "Send To" Pin
Neville Franks31-May-02 11:38
Neville Franks31-May-02 11:38 
GeneralRe: Shell Context menu and "Send To" Pin
_Magnus_2-Jun-02 21:27
_Magnus_2-Jun-02 21:27 
GeneralRe: Shell Context menu and "Send To" Pin
Neville Franks2-Jun-02 21:44
Neville Franks2-Jun-02 21:44 
GeneralRe: Shell Context menu and "Send To" Pin
_Magnus_2-Jun-02 22:01
_Magnus_2-Jun-02 22:01 
GeneralRe: Shell Context menu and "Send To" Pin
_Magnus_2-Jun-02 22:53
_Magnus_2-Jun-02 22:53 
GeneralRe: Shell Context menu and "Send To" Pin
Neville Franks31-May-02 3:07
Neville Franks31-May-02 3:07 
GeneralSaving changes to IHTMLDocument2 Pin
S Fewings30-May-02 20:26
S Fewings30-May-02 20:26 
Hi,
If you could help that would be great.
I am trying to make changes to a html page using IMarkupSevices and IHTMLElement.
I get the document, create the IMarkupServices and make the change. I can see the change in the HTML page but when I come to save the changes the original page is saved to file NOT the changes I have made.

Here are the code snipets.
The html document is from a CHTMLView class
////////////////////////////////////////////
//Create and make the change to HTMLDocument

IHTMLDocument2 *pDoc;
IDispatch* pDisp = GetHtmlDocument();
HRESULT hr;
hr = pDisp->QueryInterface( IID_IHTMLDocument2, (void**)&pDoc );
if (pDoc)
{
CComQIPtr<imarkupservices, &iid_imarkupservices=""> pMS;
pMS = pDoc;
if (pMS)
{
CComPtr<imarkuppointer> pMkStart, pMkFinish;
pMS->CreateMarkupPointer(&pMkStart);
pMS->CreateMarkupPointer(&pMkFinish);

IHTMLElement* pElement;
LastPara( &pElement ); // returns the last element in the document
if( pElement )
{
pMkStart->MoveAdjacentToElement(pElement, ELEM_ADJ_BeforeBegin );
pMkFinish->MoveAdjacentToElement(pElement, ELEM_ADJ_BeforeBegin );
}
pElement->Release();

IHTMLElement *pNewElement;
OLECHAR id[] = OLESTR("id=anID");
pMS->CreateElement(TAGID_P, id, (IHTMLElement**) &pNewElement);
pMS->InsertElement(pNewElement, pMkStart, pMkFinish);
pNewElement->Release();

OLECHAR* text = L"Text to add";
pMS->InsertText(text, -1, pMkStart );

}
pDoc->Release();
}


////////////////////////////////////////////
//Save the document

IHTMLDocument2 *pDoc = NULL;
IDispatch* pDisp = GetHtmlDocument();

HRESULT hr;
hr = pDisp->QueryInterface( IID_IHTMLDocument2, (void**)&pDoc );
if (pDoc)
{
CComPtr<ipersistfile> pPersistFile;
hr = pDoc->QueryInterface(IID_IPersistFile, (void**) &pPersistFile);
if(! FAILED(hr) )
{
CString csPath = "C:\\Temp\\test.htm";
MAKE_WIDEPTR_FROMANSI(wszCodeFile, csPath.GetBuffer(csPath.GetLength()));
pPersistFile->Save(wszCodeFile, TRUE);
if ( SUCCEEDED(hr) )
{
hr = pPersistFile->SaveCompleted(wszCodeFile);
}
pDoc->Release();
}
}
Generalusing winsock after TAPI establish Pin
Sameer Maggon30-May-02 19:54
Sameer Maggon30-May-02 19:54 
GeneralRe: using winsock after TAPI establish Pin
Joaquín M López Muñoz30-May-02 19:58
Joaquín M López Muñoz30-May-02 19:58 
GeneralRe: using winsock after TAPI establish Pin
Sameer Maggon30-May-02 20:16
Sameer Maggon30-May-02 20:16 
GeneralGraphics editor in c/c++.. Pin
Neha30-May-02 19:05
Neha30-May-02 19:05 
GeneralRe: Graphics editor in c/c++.. Pin
Amit Dey30-May-02 19:58
Amit Dey30-May-02 19:58 
GeneralLinking Error Pin
30-May-02 16:13
suss30-May-02 16:13 
GeneralRe: Linking Error Pin
SilverShalkin30-May-02 16:20
SilverShalkin30-May-02 16:20 
GeneralRe: Linking Error Pin
Nish Nishant30-May-02 17:23
sitebuilderNish Nishant30-May-02 17:23 
GeneralRe: Linking Error Pin
30-May-02 18:16
suss30-May-02 18:16 
GeneralRe: Linking Error Pin
30-May-02 18:19
suss30-May-02 18:19 
GeneralRe: Linking Error Pin
Nish Nishant30-May-02 19:56
sitebuilderNish Nishant30-May-02 19:56 
Questionhow to add a new toolbar to vs.net ide in the vs.net add-in? Pin
G.Richard30-May-02 15:57
G.Richard30-May-02 15:57 
AnswerRe: how to add a new toolbar to vs.net ide in the vs.net add-in? Pin
James R. Twine31-May-02 10:34
James R. Twine31-May-02 10:34 
GeneralDev Studio... Pin
Max Santos30-May-02 15:17
Max Santos30-May-02 15:17 
GeneralRe: Dev Studio... Pin
benjymous30-May-02 22:35
benjymous30-May-02 22:35 
GeneralRe: Dev Studio... Pin
Max Santos31-May-02 0:34
Max Santos31-May-02 0:34 
Generalexperimenting... "to understand pointers more" Pin
SilverShalkin30-May-02 15:20
SilverShalkin30-May-02 15:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.