|
You are getting the code that is received by IE after it formats it. If you want to get the unformatted code Look into the IPersistStream interface. The code will look something like this:
HRESULT GetDocumentContent(CComBSTR &bstrHTMLText)
{
bstrHTMLText.Empty();
CComPtr<IDispatch> pDisp;
HRESULT hr = m_spWebBrowser2->get_Document(&pDisp);
if (FAILED(hr))
{
return hr;
}
CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spHTML = pDisp;
if (spHTML)
{
CHAR *szData = NULL;
OLECHAR *htmlText = NULL;
try
{
CComQIPtr<IPersistStreamInit, &IID_IPersistStreamInit> spData = spHTML;
CComPtr<IStream> spStream;
::CreateStreamOnHGlobal(NULL, TRUE, &spStream);
spData->Save(spStream ,FALSE);
STATSTG stat;
spStream->Stat(&stat, STATFLAG_NONAME);
szData = new CHAR[stat.cbSize.LowPart];
ULONG length;
LARGE_INTEGER pos;
pos.QuadPart = (__int64)0;
spStream->Seek(pos, STREAM_SEEK_SET, NULL);
spStream->Read(szData, stat.cbSize.LowPart, &length);
htmlText = new OLECHAR[length];
::MultiByteToWideChar(CP_ACP, 0, szData, length, htmlText, length);
bstrHTMLText = htmlText;
}
catch (...)
{
}
delete[] htmlText;
delete[] szData;
}
else
{
}
return S_OK;
}
This function is taken from a class that I wrote, so you may need to rework it a little.,
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
anyone know of any samples for detecting multiple displays, and more so, which display the app is on?
any help or pointers in the right direction are appreciated
shotgun
|
|
|
|
|
GetSystemMetrics(SM_CMONITORS) will give you the # of monitors installed. Use MonitorFromRect() to tell which monitor a window is on (or which monitor it is mostly in, if it spans more than one)
--Mike--
Looks like I picked the wrong week to stop sniffing glue.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi.
I am an experienced 'C' programmer trying to venture into the MSVC++ programming world.
As my first serious graphical C++ project I am trying to recreate the old Tetris program.
However, I am having some difficulty trying to determine where my main processing loop should live and how it should initiate drawing a shape.
I have no problem managing and randomly selecting shape imagelist orientations for display, the problem is what type of application is most suited to this type of program and where should my control loop live.
I would very much appreciate any guidance that you might have.
Thanks in advance.
James.
|
|
|
|
|
Think of it as this. You have to update the window every "frame" CheckForUserInput->Update Display By doing this you will ultimately beable to get input as well as display objects its kinda like with rendering Im not sure exactly how your doing it but if your using OpenGL Or directx just put it "before" or after the rendering process.
- LiquidKnight
|
|
|
|
|
Check out http://nehe.gamedev.net[^]. This guy uses VC++ 6.0 to write OpenGL programs and has a great tutorial.
Brad Jennings
"if the golden arches shut shop, where else are the VB people going to get work." - Colin Davies
|
|
|
|
|
Hmm, just went to http://nehe.gamedev.net and none of the tutorial links seem to work. He does still have them available for download though (a little farther down the page).
Brad Jennings
"if the golden arches shut shop, where else are the VB people going to get work." - Colin Davies
|
|
|
|
|
Thanks for the two suggestions and the link.
I think that I might have over stated the 'seriousness' of my attempts at a graphics program.
My approach is very simple.
I have designed some image lists comprising a number of bitmaps to represent the orientation of each shape.
I simply randomly select an imagelist and bitmap and use this to draw to the window view.
Since the format of the Tetris program is to simply draw the image advancing/rotating/moving side to side it does not involve any complex graphics manipulation.
I simply use BitBlt.
My problem is the type of VC++ application I should define so that I can have a control loop somewhere that generates these random shapes and dispatches them to be drawn.
I defined a straight forward SDI application and tried to use it as my base, but I do not know where my control loop should be placed.
Is this the right kind of application for this type of program ? or do I need another type WIN32 etc ?
As I say, my problem is not realy knowing the windows/MFC generated environment.
Any advice would be very welcome.
|
|
|
|
|
The trick is for a game processing loop, is that you want to update your graphics after all of the input has been processed.
In MFC, the processing loop is hidden from you, but you could always override the PretranslateMessage function, but that could get a little messy. Other than that, I am not an MFC guru so I do not know the simple way to change the message processing loop in MFC.
If you go for a plain Win32 implementation, that would be a lot easier. Your message pump should look something like this:
while (TRUE)
{
if (PeekMessage( &m_msg, NULL, 0, 0, PM_REMOVE))
{
if (WM_QUIT == m_msg.message)
{
break;
}
if(!PreTranslateMessage(&m_msg))
{
::TranslateMessage(&m_msg);
::DispatchMessage(&m_msg);
}
}
else
{
OnUpdateFrame();
}
You should use PeekMessage because GetMessage blocks until a message becomes available. There are other things that I omitted from this loop that will help your idle processing and when the game is paused.
If you are adventurous, and understand C++ templates, you may want to checkout WTL. I wrote a full version of Tetris in DirectX for this, and there is a base window that you could use to start your version.
I also wrote a class that is a modified gameloop for WTL, so you would not have to mess with this. This code can be found here: WTL GameLoop[^], and my Tetris game can be found here: Tetris[^]
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Who has C/C++ experience about 3-4 years with experience with: Win32, MFC, Javascript, and Visual basic inlcuding, HTML, CSS, Java, Open GL, some Perl, some PHP, some assemebly, some directx type api stuff. What would be the adverage yearly income on a starting position of someone with those following skills. Thats with only some college education no degrees as of yet.
- LiquidKnight
|
|
|
|
|
Um maybe 20k to 25k if you're lucky
|
|
|
|
|
Even with a very high level of C++ experience?
- LiquidKnight
|
|
|
|
|
Benny is right on. If your 3-4 years experience is work experience (and not "playing" at home), maybe a bit more. You don't start into the serious money until you have several projects under your belt and can demonstrate all of the skills not directly related to writing code (like doing software requirements/design docs, working in a team environment, generating formal test procedures, user documentation and follow up support including program updates and associated paper work). This is especially true for government contracts - a lot more time is spent on the paper work than actual coding. When I stated out (25 yrs ago), I was making about 14K a year. In six years, that figure just about tripled. This was in OS & compiler design and not application programming.
Steve
|
|
|
|
|
It depends on the kind of experience.
Somebody who knows STL inside out and every nuance of the C++ Standard might be good but if he doesn't have experience of building MFC GUI apps talking to a database then his experience doesn't have much commercial value to my company.
Michael
The avalanche has started, it's too late for the pebbles to vote.
|
|
|
|
|
It depends on what type of experience.
Usually companies do not like to count hobby programming as years of experience, so unless you can show an employer your practical, full-time experience, they are likely to pass you by. You will have an easier time getting a job with a college degree than without, especially in this economy.
With that said, you could probably get a job for about 20 - 25,000 dollars, and once you get a degree, 40 - 50,000 a year.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
It would all depend on how much commerical experience you had with each technology. If you had 3-4 years of commercial MFC/WIN32/C++ experience then I'd probably be paying £18k-25k in the current market.
A lot would depend on the skillset and experience value to my company.
Michael
The avalanche has started, it's too late for the pebbles to vote.
|
|
|
|
|
Hiya does anyone have any tutorials or links on using C++ with SQL. I know C++ already but want to learn SQL. I will be using Visual C++ 6.0.
All I know is there is a header file called sql.h.
Thanks for any help..
grahamoj.
|
|
|
|
|
see ADO or DAO . ADO is a COM-based interface; DAO has an MFC interface (CDAORecordset and friends)
-c
Fractals
|
|
|
|
|
I am developing a MFC Document/view application which only has one document type and one view type. Up until now I have developed it as a SDI style application. However, I now wish to create two different "versions" of the application: the SDI version, and a MDI version which supports multiple views and documents in one frame window.
My question is: is there any way that i can use the same functionality from my original SDI-Frame class in the new MDI application or subclass from it in order to not lose all functionality, toolbars, menus, etc? The reason I'm thinking subclassing is because i need both the SDI frame and the MDI frame to be functional in the same project: ie I can't just convert it, I need to keep the SDI functionality and also extend it for a MDI application.
Thanks very much
Ben
|
|
|
|
|
I have a question, obviously, I have a MDI application with three different document templates. I simply want to launch a specific one from a menu option. How would one go about launching a certain document/view?
Thanks
Michael Shuster the 1st
|
|
|
|
|
CMultiDocTemplate::OpenDocumentFile
|
|
|
|
|
I acutally got that far, I jsut do not know what to use for a parameter. It is asking for a path name string but i want to load a template. Forgive me if I am missing something obvious
|
|
|
|
|
Call CDocTemplate::OpenDocumentFile and pass it NULL. The MSDN says this causes it to create a new document.
Chris Richardson
C/C++ Include Finder[^]
|
|
|
|
|
hmmm, that did not seem to work. I can not pass it the value of Null. It returns the following error:
error C2512: 'CDocTemplate' : no appropriate default constructor available
Plus I want to actually pick which document templat opens. I have three, and I want a specific one to open.
Any other suggestions or maybe you could refer me to where you read that at.
|
|
|
|
|
Sounds like you need to make use of the undocumented MFC class CDocManager. When you call AddDocTemplate() in InitInstance(), the template pointer is handed off to the m_pDocManager object, which is part of your CWinApp object. You can use this to iterate the CDocTemplates registered in your application and call OpenDocumentFile(NULL) on your CMultiDocTemplate object.
This should create an empty document of the required type.
See MFC files DOCMULTI.CPP line 114 and DOCSINGL.CPP line 88 for the functions in question.
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|