|
yes, this is what I want, thanks
|
|
|
|
|
HI ,,
i m using CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
but compiler gives error Undecleared Identifer.
while i m using its header file and lib file
but CoInitialize gives no error
wets problm
thanx
|
|
|
|
|
Add this to a header file.
#define _WIN32_DCOM
Kuphryn
|
|
|
|
|
My apologies if you already answered this question, but I've looked all over the web and in book stores for information on how to get the html content of a webpage that was Navigated to with the CHtmlView class. To be more clear, I am using a CHtmlView class and navigating to a webpage on a specific server that I maintain. That webpage does some serverside work and gives me a new webpage. This new webpage will display some data that I need to process before moving on to do something else within the application. Any hints suggestions or solutions as to how to get this data while using the CHtmlView class would be greatly appreciated. Other solutions are welcomed as well. Thank you.
Sincerely,
Testtests
|
|
|
|
|
Hi there,
Firstly, override the OnDocumentComplete virtual function (event), then we can get access to the DOM, e.g.
virtual void OnDocumentComplete(LPCTSTR lpszURL);
void CMyHTMLView::OnDocumentComplete(LPCTSTR lpszURL)
{
USES_CONVERSION;
MSHTML::IHTMLDocument2Ptr spDoc(this->GetHtmlDocument());
if (spDoc)
{
MSHTML::IHTMLDocument3Ptr spDoc3 = spDoc;
if (spDoc3)
{
MSHTML::IHTMLElementPtr spElem = spDoc3->getElementById(_bstr_t("idDataCell1"));
if (spElem)
{
CString strValue = W2T(spElem->innerText);
}
}
}
CHtmlView::OnDocumentComplete(lpszURL);
}
With the above code, remember to import the MSHTML type library to help give us smart pointer wrappers around the interfaces, e.g. insert into your views .h file
#import <mshtml.tlb> no_auto_exclude
Also, we use are performing unicode conversion here (macros USES_CONVERSION and W2T) so dont forget to add:
#include <AFXPRIV.H>
into your stdafx.h file.
I've assumed that the document returned has tags labelled with ID's - if this isn't how the data is 'structured' then you need to give me an example of the HTML. We can use the DOM to recurse through the hierarchy to retrieve the information you want. I must point out though, if you can use ID's then this is the preferred approach.
Hope this helps,
Andy
|
|
|
|
|
Thanks Andy. I'm trying to use what you gave me, but I'm such a dolt I still don't know how to use it to process the info. I think my problem is I am really confused as to how a doc/view app works (any one give me a hand?). Anyway, right now, I made the strValue a member of the CmyHtmlView class so I can get acess to it. I'm trying to display it so I can see what's inside it with a dialog but I'm having a fun time trying to play with the CString class. If you or anyone have an easy way of getting at the webpage (which is just "1" to get the value, that would be cool.
Sincerely,
Testtests
|
|
|
|
|
Hi again,
If the value is just in the body, then the following code will work...
void CMyHTMLView::OnDocumentComplete(LPCTSTR lpszURL)
{
USES_CONVERSION;
MSHTML::IHTMLDocument2Ptr spDoc(this->GetHtmlDocument());
if (spDoc)
{
CString strValue = W2T(spDoc->body->innerText);
}
CHtmlView::OnDocumentComplete(lpszURL);
}
I'm not sure what you are trying to achieve though? Is the HTML View being used to display information to the user or as a way of sending information from the web server to your application? (a web service if you like)
You say, also, that you are creating a dialog to display the value - is this something that will feature in your application or is it just for your benefit? If so, are you not developing in debug? You can also use AfxMessageBox if you want to display information quickly - just remember to remove them in production code
Hope this helps,
Andy
|
|
|
|
|
Thanks again Andy,
Basically, I have an initial webpage that CHtmlView initially navigates to. From this webpage, they type in a special key and submit it by clicking a button on the form. This webpage then in turn posts the data to an ASP webpage that does some work with a database to check if this special key exists or not in its database. It replies back a 1 if it exists and a 0 if it doesn't. It is based upon these replies that the application must now decide to allow the user to retry entering the special key or to allow the user to move forward in the application. All in all, the processing is to determine the success or failure of the special key so the program will know how to react.
I hope this clears up some confusion. Thanks for your input Andy. I really appreciate it and look forward to hearing from you again.
Sincerely,
Testtests
|
|
|
|
|
Hi,
The first problem I guess is that the user will see a page in the HTML view with the contents '1'. A better approach would be that the page returned by ASP would be more user friendly, e.g.
<html>
<body>
<h1>Key incorrect</h1>
<input type='hidden' value='1' id='idRetVal'>
</body>
</html>
So the page returned would have visible information for the user and a hidden element for the application to use. Because we've given the element an id, you can use the code I gave you at the beginning to get the value.
Once they've entered a valid key, what should your application do next? Is the interface of your application all through HTML, e.g. once verified you then display the next HTML page in the view? If so, is there a reason why you are using C++?
Or is the HTML view purely for verifying the key is valid?
If the first statement is true, have you thought about using an Internet Explorer HTML application?
Let me know
Cheers,
Andy
|
|
|
|
|
Hi!
Yes, the HTML is purely for verifying the key is valid. As soon as that is done, the executable, coded in C++, takes over and generates non-html user interfaces to move the user forward within the program. I can not use an Internet Explorer HTML application since the program involves manipulation of files and the creation of non HTML interfaces that will create other processes. Furthermore, the application is required to be a standalone executable (myHtml.exe) able to run on older Window operating systems, excluding Win95.
Thanks in advance,
Testtests
|
|
|
|
|
HI.
From where i can Download installshield for VC++
n how to use it
thanx
|
|
|
|
|
|
Which Version i use ... for VC++ and Operating system XP
Is there any built in for VC++
as there is in VB its own component..
wt abut VC++
thanx.
|
|
|
|
|
i don't know of any built specifically for VC++
there are other installation programs that dont' cost $$$
i don't know of a name off the top of my head, but they have been mentioned several times on CP
|
|
|
|
|
|
I want to begin a project with vc6 + sp5 + directx8,but I do not know how to beigin this!!
Any suggestion is welcome!
buaa_chenx@hotmail.com
|
|
|
|
|
First Download DirectX SDK
then study it ,, it has Samples for VC++
choose utr area on which u want to work ...
means DirectShow / DirectSound / DirectPlay etc.
i Hope SDK will Help u to Study it
GOOD LUCK
|
|
|
|
|
damn it, you beat my message by 2 mins
great minds think alike!!
|
|
|
|
|
My first step would be to get the DirectX SDK. Last I looked it had lots of samples.
DirectX 9.0 SDK[^]
|
|
|
|
|
Hi!
in the onpaint function of a dialog i've got this code:
CString temptext;
this->m_EditTexto.GetWindowText(temptext);
CSize size=dlgDC.GetTextExtent(temptext);
CRect rect;
rect.left=m_pto_pers_texto.x-size.cx/2;
rect.right=rect.left+size.cx;
rect.top=m_pto_pers_texto.y;
rect.bottom=rect.top+size.cy;
dlgDC.DrawText(temptext,-1,rect,DT_CENTER);
it's a part of a drag and drop operation, when i drag something, it writes what the user inserts.
if i drag the from the same place, the old text disappaers and the new one shows up, in the new position where i've dropped the object.
is the problem here?
thanks!
Another thing. i'm just storing what i draw in a list of CPoint's. Is it posible to transfer the text to points? sounds quite hard to me.
should i put everything in a CRgn?
|
|
|
|
|
kfaday,
It seems to be me answering you all the time
You don't say what the problem is, is the text not moved? Is it moved to the wrong place? Is it not shown until you drop it (that is, don't you see it while dragging?).
If it is something wrong with the position, you can use TRACE to output values to the debug-window while running the app (it's difficult to use breakpoints for drawing operations, as they will be triggered as soon as you restart from the breakpoint...). TRACE looks like:
TRACE( "Some variables to check %i, %i\n", variable1, variable2 );
well, you might just want to check it up on MSDN
If it is the latter case, that is, you don't see it while dragging, then your problem is most likely that you don't invalidate and redraw the screen in your MouseMove -handler.
You might want to look at my articles http://www.codeproject.com/miscctrl/diagrameditor.asp[^] and http://www.codeproject.com/miscctrl/flowcharteditor.asp[^] - which are frameworks for vector drawing apps, although your application seems to be more of a freehand drawing tool.
To convert text strings to points - if I understand you correctly - yes, that is quite hard. My suggestion is that you structure your data so that it consists of different drawing objects, one being a single line segment, one being a text string etc. You can see this in the articles I mentioned.
|
|
|
|
|
thanks for the help. i solved it by creating a list of text, so everytime the window gets redrawn, every text piece gets redrawn
|
|
|
|
|
I use the follow code to change the color of status bar YourStatusBar.GetStatusBarCtrl().SetBkColor(Color);
but the right of the status bar has a little rectangle,you can see it in any window(the right bottom of the window),it keep default color,how can I change it's color or just move it from the status bar?
hiall
|
|
|
|
|
I have a function that finds the end of the lines of text in an edit field and adds more text to end of edit field.
However after all is done, everything is selected.
The MSDN says to send EM_SETSEL with -1,0 to deselect all the text, but my text is still selected.
What have you done to correct this?
If it is any issue, this code is in the OnSetActive for a property page.
Thanks.
|
|
|
|
|
To clear the selection, set the first and last values to the same value, eg. 0,0. The cursor will then be placed at position 0, with no selection.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|