|
Hi all,
I just wanted to let you know that you can query the IHTMLDocument for the IPersistStreamInit interface and call the Save method to save the raw data to an IStream object. Then it can easily be read into a BSTR or a CString.
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!
|
|
|
|
|
Hello, the codegurus around the world.;)
We can use Socket program to post HTTP GET command to HTTP server.
And we get the html source code by receive function of Socket.
Please, don't send me your email about your questions directly.
Have a nice day!
Sonork - 100.10571:vcdeveloper
-Masaaki Onishi-
|
|
|
|
|
THanks for the suggestion, but I was looking for a solution that I could tell what the user was currently looking at in their browser.
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!
|
|
|
|
|
|
Thanks, that looks like a very good example. However he is not doing what I needed:
[quoted from the explanation of that example]
The information presented is gathered after the Internet Explorer has parsed it. This is quite different from e.g. the information you get from the standard "View Source" popup menu.
BTW, I did find the correct solution. It involves qquerying the browser for its IPersistStreamInit interface, and calling the save method. The raw HTML data is found there.
Thanks again.
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!
|
|
|
|
|
How do I make List Control get its contents from a text file?
"Behind every longing of man is a longing for God."
|
|
|
|
|
I'm afraid you'll have to do most of the work yourself. Read the text file (probably using CStdioFile, if using MFC), then display in your list control in the format that you require.
If this control is used very regularly in your project, you might consider creating a derived custom list control that does this automatically. But you still have to code the hard bits yourself.
A simple case would be like: (NB: This is UNTESTED and probably will not compile, but it
demonstrates my line of thinking .
<br />
CStdioFile myFile; <br />
CString strLine;
<br />
int nIndex=0;<br />
if( myFile.Open( "C:\Text.txt", CFile::DenyNone | CFile::modeRead ) )<br />
{<br />
while( myFile.ReadString(strLine) )<br />
{<br />
m_ListCtrl.InsertItem(nIndex++, strLine);<br />
}<br />
myFile.Close;<br />
}<br />
chin
|
|
|
|
|
Yes, my current project heavily uses the List Control. I am not allowed to use any database program so what I would do is use a text file as my data storage and display its contents in the list box.
Thank you, Chin. I'll try your code.
"Behind every longing of man is a longing for God."
|
|
|
|
|
arg.. i have been using .net since it shipped and now i have added a new dialog.. i right click on the dialog and say 'Add Class'.. specify the class name and set it to be derived from CDialog (instead of CHtmlDialog).. and click ok..
and it doesn't make the .h or .cpp or add the class to my project!!!
i have tried deleting the source safe files and setting all of the files to not be read only.. i have tried adding a dummy dialog and adding a class for it, and it will NOT make a frickin' class for any dialog at all now..
if i try to add a message handler for a button i have tried to make a class for it gives me a frickin' debug error in the 'script' since all of there dialogs are apparently html driven now..
arg.. i cant deal with making every dialog manually instead of having .net make the classes for me, its just too much of a pain in the arse..
is anyone familiar with this error, or can anyone give me an expectation of what to expect if i try to get technical support from microsoft?! i have spent the last 6 months developing this frickin' software and now i cant add any classes to any dialogs?! i thought this was perhaps a screwup in the .rc or the recourse.h, but i am not familiar with these files, and they seem to look the same for the new dialogs as they have for every other dialog ive ever made in .net
arg..
i cant make any classes from any dialogs.. plz give me advice as to what my next plan of action should be (besides manually adding these classes..).. arg..
-dz
|
|
|
|
|
|
i have copied the project onto 3 different machines with .net and all three wont let me add classes.. i can add a class, just not a class to a dialog.. i have tried going to the class view and adding a class there and setting it to a 'MFC Class' and to derived from 'CDialog' and setting the ID and hitting ok, and i get an error 'Object required'. I can edit dialogs which already exist, and I can add message handlers to them, but i cant make a new class for a dialog.. any other ideas?
-dz
|
|
|
|
|
Microsoft Paint can convert a monochrome bit map to color bitmap using the Save As funtion. Ho can do it using VC++?
Show me please!
Thank,
Vo Hong Hai
|
|
|
|
|
Hi!
I am writing an OCR program. I need to write a function to do the same like ExtFloodFill. If you know where to find the code, please show me.
Thanks,
Vo Hong Hai
|
|
|
|
|
Hello,
Is there a way to change the color of the progress bar in a CProgressCtrl for each separate instance? I've a dialog with several of these and would like their color to give additional information to the user.
Thanks!
JennyP
|
|
|
|
|
JennyP wrote:
Hello,
Hey, JennyP!
Check out the Progress Controls section of CP, i think you might just find what you're looking for...
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
First the RTTI question.
How is it possible to create an object without using MFC's CObject CreateObject() ...???
I checked out the source code (MFC) and could only determine CreateObject returns a Function*...???
Could someone please explain how I can accomplish similar code using plain old platform independent C++...??? Can I do this using RTTI...???
Second question.
I have asked this question before, but obviously didn't get it so i'll ask again...
How does MFC wrap a Windows window HWND with a class and avoid using global or static functions...???
Are they fancy MACROS...? if so where do I find these...???
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
for the second question:
you can have a look for winamp3.0 client src; this is free. u can get it form it's site, just use a defwindowproc
and in this function use getwindowlong to get extra data,
then we can do all the things we want.
|
|
|
|
|
ttzzgg_80713 wrote:
just use a defwindowproc
and in this function use getwindowlong to get extra data,
then we can do all the things we want.
Is that how the MFC framework implements this...?
How would you handle messages, would you hook the object...?
Thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
How is it possible to create an object without using MFC's CObject CreateObject()...???
Sure. Just use 'new CYourObject' or declare CYourObject as local/global variable. CreateObject stuff is needed, because framework needs to create objects of 'unknown' type. For example, if you have doc/view app, MFC creates CYourDoc and CYourView for you, but doesn't have full knowledge about these classes. You're just passing the RUNTIME_CLASS which, among other things, has the CreateObject method.
Hockey wrote:
I checked out the source code (MFC) and could only determine CreateObject returns a Function*...???
No, CRuntimeClass::CreateObject returns CObject *. There's also m_pfnCreateObject data member which has an address to function which is called by CreateObject.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
Tomasz Sowinski wrote:
Sure. Just use 'new CYourObject'
This i knew...but I want to replicate MFC CObjects ability to create objects at runtime using CreateObject ...?
Like the DOC/VIEW in MFC, but I can't use MFC because I want to make my code cross platform...???
I did a little more reading an it turns out this isn't accomplished via RTTI...so i'm lost as to where to look...
I serach on google for objects dynamically and everything returns
CObject* pObject = new CObject;
Which is not exactly what I wanted to know...
I what I want to accomplish not dynamic creation...?
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
I did a little more reading an it turns out this isn't accomplished via RTTI...
Well, it isn't accomplished with C++ RTTI (dynamic_cast, typeid, typeinfo). MFC has its own RTTI invented before VC had support for C++ RTTI.
Hockey wrote:
I what I want to accomplish not dynamic creation...?
I'm not sure what do you mean here. If you want to get universal method for creating objects based on class name, you may find this article useful: http://www.microsoft.com/msj/defaulttop.asp?page=/msj/archive/S385.htm[^]
The article is titled 'Roll Your Own Persistence Implementations to Go Beyond the MFC Frontier', but dynamic creation is the base for serialization. Any reading which takes on 'factory' design pattern may also give you additional understanding of this subject.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
Tomasz Sowinski wrote:
I'm not sure what do you mean here
MFC DOC/VIEW uses a form of dynamic creation when instantiating the CView/CDoc derived classes however the dynamic creation is based on the new/delete operators...???
It uses a different method in creating objects dynamically...??
It is this method I wish to learn about...not the plain jane new and delete methods...
Thanx for the URL...i'll check it out...
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
MFC DOC/VIEW uses a form of dynamic creation when instantiating the CView/CDoc derived classes however the dynamic creation is based on the new/delete operators...???
In the MFC slang, 'dynamic creation' is creation of object on heap given a class name (class name as a string) at runtime. However, deep inside, it always boils down to some 'new CYourObject' in your code. The MFC magic works with macros. Basically, if you mark CYourObject with DECLARE_DYNCREATE/IMPLEMENT_DYNCREATE will have corresponding function which calls 'new CYourObject'. This function (along with class name) is hooked into list of available factory functions. Implementation of factory function is done for you by - guess what - IMPLEMENT_DYNCREATE.
So, you can look at the 'dynamic creation' problem like this: having a string with class name like 'CYourObject', you have to find a function which will call 'new CYourObject'.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
q1: Are you talking about dynamically creating an object at runtime?
q2. I think the answer to this is in MFC's Handle Maps. Have a look at CWnd::FromHandle()
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Neville Franks wrote:
q1: Are you talking about dynamically creating an object at runtime?
Yes I think...but NOT using new/delete
using something similar to MFC CObject but I can't use this method because I want to keep my code cross platform.
RUNTIME_CLASS macro takes a class and dynamically creates objects...I need this kinda functionality
But without MFC...
How is this accomplished...???
Thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|