 |
|
 |
Does your code realy compile? (don't assign BSTR to CString)
|
|
|
|
 |
|
 |
I had a problem with get_innerText too.
HRESULT CMyHtmlDlg::OnTest(IHTMLElement* pElement) { IHTMLElement* pTextElement = NULL; if (GetElement(_T("Text1"), &pTextElement) == S_OK && pTextElement != NULL) { BSTR bstrText; pTextElement->get_innerText(&bstrText); char *Text = _com_util::ConvertBSTRToString(bstrText); } return S_OK; }
The get_innerText function still doesn't work... everyone please???
|
|
|
|
 |
|
 |
not really that elegant but you can fix it up all pretty:
bool bReturn = false; BSTR bstrText = ::SysAllocString(L""); m_pHTMLElement->get_innerText(&bstrText);
char* lpszText2 = _com_util::ConvertBSTRToString(bstrText); std::string shortName = lpszText2; int pos = shortName.find(sItem); if( pos > -1 && pos < 50) bReturn = true; PRINTF("char * lpszText2: %s\n", lpszText2); PRINTF("pos: %d", pos); SysFreeString(bstrText); delete[] lpszText2;
// get_innerText(BSTR *p); return bReturn;
|
|
|
|
 |
|
 |
Try this:
BSTR bstrInnerText; IHTMLElement* pElement = NULL; VARIANT pText;
GetElementInterface("ID", __uuidof(IHTMLElement), (void**)&pElement); if (pElement != NULL) { pElement->getAttribute(CString("value").AllocSysString(), NULL, &Text); }
|
|
|
|
 |
|
 |
Hi, i am use your dialog in asp.net pages.
Like System.Windows.Forms.MessageBox.Show("OK") User Interactive
Tanks
|
|
|
|
 |
|
 |
Hello.
I'm trying to hadle an event (OnCreate) whih is throwed by an activeX control. I have some of this controls in the same HTML page and I want to use only a unic method to handle this event, but I want to know which of the ActiveX controls have fired the event.
Anyone knows how I can do this ?
Thanks
|
|
|
|
 |
|
 |
Chris, don't forget to call pLinkElement->Release() when you're done with it unless you're using smart pointers (such as CComPtr<IHTMLElement> pLinkElement).
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
 |
|
 |
Posible reason why this do not work on some systems is that it required IE 5.5 or higer.;)
|
|
|
|
 |
|
 |
How do we prevent the user from hitting F5 and wiping out our contents with the subsequent refresh?
|
|
|
|
 |
|
 |
I would also like to know if anyone has found a way around this problem. Currently, I'm using OnDocumentComplete() to set the correct/current settings in the HTML controls. However, if the user hits F5 the dialog gets "reset" to its initial design-time state without OnDocumentComplete() being called, and without any other form of notification that I can find.
Anyone?
|
|
|
|
 |
|
 |
Implement TranslateAccelerator in the class derived from CDHTMLDialog and return S_OK if message = WM_KEYDOWN and key = F5.
|
|
|
|
 |
|
 |
Firstly I'd like to thank Chris for the article. There seems to be far too many people here that complain because it dosn't work on VC6 - well as the subject area is .Net - why should it (especially as .Net is out now anyway -- yeah I know it was not out when most of the comments were written!).
Anyway, my problem is:
I am trying to create a CDHtmlDialog with a background image on the HTML page. However, I can't seem to get the background image to be loaded from the resource witin the exe (I could use RES:\\) but there are several dissadvantages to that:
1) you need to know the exe/dll name that holds the resource - and would need to put this in the HTML file - is there a way round that - seeing that the HTML file is also a resource?
2) What about a dynamic background image - i.e. I have several images in my resources and I want to choose which one the dialog has at runtime? I notice this example simply links to a file which has to be in the same place as the exe - this is not much good - there must be a better way - anyone?!
Thanks for any info, Phil
|
|
|
|
 |
|
 |
This worked for me, and you don't need to know the exe name.
<IMG alt="" src="res:\#2/#1">
The ID of the Image I inserted was 1.
|
|
|
|
 |
|
 |
I'm writing an application so it can be 'skinned, and the CDHtmlDialog seems to be the tool of choice...if not please show me how. But I've got one problem. I need to be able to select text via a textarea on the HTML page. My app is a TTS (Text to Speech) app and I currently use a richedit ctrl to do this ie:
CRichEditCtrl TextBox;
TextBox.SetSel (nStart,nEnd);
<TEXTAREA id="Textarea1" name="Textarea1" rows="7" cols="58"> Welcome to JustSpeak, improving computer interaction is our passion </TEXTAREA>
Now my problem is that the TEXTAREA object select() method selects the entire text in the box...I want to only select a word at a time so that I can highlight the current word being spoken.
I've looked at the DHtmledit object and it seems to have the ability to do this via a IHTMLTxtRange...but this seems rather complicated. Is there a simplier method to do this?
Thanks
JR Furman
|
|
|
|
 |
|
 |
Where's the alien then?
Cheers, -Erik ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ My thoughts are my own and reflect on no other.
|
|
|
|
 |
|
 |
I've allways wanted to know how I could make a GUI which had more of a web-page feel to it, now I can accomplish this, after poking though your article I was able to get something up and running right away, good job!
|
|
|
|
 |
|
 |
Hello, the codegurus around the world.
Now, EXE works on VC6.0 without SP and Japanese Window98 at my home. Does anyone know how we can compile this code on Window98 and VC6.0.
I want to use this for my current project.
Have a nice day! -Masaaki Onishi-
|
|
|
|
 |
|
 |
There is no way - why would M$ give you the new version of MFC ( version 7 ) when they want you to buy .Net ? That's not rude of them, it's just business.
Christian
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
 |
|
 |
I've statically linked the download app so you should be able to get it to run on your system if you don't have the MFC7 libs. (at least I'm hoping!)
cheers, Chris Maunder
|
|
|
|
 |
|
 |
Hi!
I rate this article poor and what do you think say the site:
3 users have rated this article. result: 5 out of 5.
very nice
|
|
|
|
 |
|
 |
Ya' well it is Chris's article, after all
|
|
|
|
 |
|
 |
you can't rate an article unless you are logged in.
cheers, Chris Maunder
|
|
|
|
 |
|
 |
> you can't rate an article unless you are logged in
Why?
|
|
|
|
 |
|
 |
Hi!
I do not understand why people rate this article to 5? What should we with an article which did not run?
Manfred
|
|
|
|
 |
|
 |
It is an MFC7 article, so you need the new MFC7 DLL's. (oh - and ensure that they are the beta 1 versions)
I guess I should have statically linked the application...
cheers, Chris Maunder
|
|
|
|
 |