|
looking for a quick way to dynamically change tooltip text--
I.E. change tooltip string text based on some other action
|
|
|
|
|
Have you tried CToolTipCtrl::UpdateTipText(...); ?
|
|
|
|
|
I'm looking at doing some VERY simple webpage parsing. My plan is to turn either the source or the output of the webpage into a text file, and then parse that. However, I do not know how to either get a pages source or output into a text file.
Any hints or better (as in simplier) methods would be well appreciated.
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
i'm not sure to understand...
htm, html, dhtml files and so on are pure text file !
for example, you can do this simple following thing : save this page (this one or another is you prefer) as an html file...
then, browse you hard disk toward the recently saved file. right click on the file and open it with Notepad... what do you see ? binary ? no of course.
you can submit your parser an htm file directly.
If you really need to have a txt file, you can simply change the extension (*.htm -> *.txt) or add the txt extension to the file name (*.htm -> *.htm.txt). whatever you want...
TOXCCT >>> GEII power
|
|
|
|
|
Not exactly what I mean. I wish to have a program go to a site, and then parse that. I want to only have to press a button to have it do all that...
I wish to use fstream to parse the page's text, but I can't figure out how to access the text through the program.
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
Have the program save a copy of the file (InternetReadFile) then use the fstream functions to read/parse it like it was any other file.
|
|
|
|
|
1) Open web page in Internet Explorer
2) From the menu select File/Save As...
3) In the "Save Web Page" dialog set "Save as type" to "TextFile (*.txt)
4) Give the file a name and a location and click the "Save" button
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
|
Hello all.
Help me please: I need to make a callback function as a member of my class (Win32 API, no MFC). Is it possible?
Thanks.
|
|
|
|
|
sure but it has to be static which means there is no object instance scope when the function is called.
-pete
|
|
|
|
|
Sorry, I can't fully understand the idea. Can you give a code example?
|
|
|
|
|
class base_w32thread{
protected:
HANDLE _handle;
DWORD _dwTID;
base_w32thread():_handle(0), _dwTID(0L){}
virtual ~base_w32thread()=0;
public:
bool start(LPSECURITY_ATTRIBUTES psecattrs = NULL, DWORD dwCreateFlags = 0L);
operator HANDLE(){ return _handle; }
protected:
virtual void run()=0;
virtual void onEndThread(){}
static long WINAPI threadfnc( LPARAM lp);
};
threadfnc is the callback that is sent as the argument to CreateThread() below
bool base_w32thread::start(LPSECURITY_ATTRIBUTES psecattrs, DWORD dwCreateFlags){
assert( !_handle);
if( _handle)
return false;
_handle = ::CreateThread( psecattrs, 0,
(LPTHREAD_START_ROUTINE)threadfnc, this, dwCreateFlags, &_dwTID);
return (_handle)?true:false;
}
Then in the callback function there is no "this" pointer so we have sent the object pointer as the User Parameter to CreateThread and we cast it to the correct type
long WINAPI base_w32thread::threadfnc( LPARAM lp){
assert( lp);
base_w32thread* pThis = (base_w32thread*)lp;
if( pThis)
pThis->run();
pThis->_handle = 0L;
pThis->onEndThread();
return 0L;
}
Hope that helps
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Thanks a lot. I'll try my best.
|
|
|
|
|
|
Just curious... is CALLBACK exaactly the same ad __stdcall? Can I use them interchangeably?
|
|
|
|
|
I had a problem with CALLBACK functions in MFC when i made my process/windows viewer
someone on CodePrject showed me a way to get around this, ill
declare one function as
static BOOL CALLBACK myfunc( LPARAM lParam );
and one as (you can use the same name if you like VC++ will pick the right one )
BOOL myfunc2( LPARAM lParam );
when call your callback call the static one with the lparam as "this"
ie. EnumWindows( myfunc, (LPARAM) this);
then have your static function call the second
BOOL CALLBACK myfunc( LPARAM lParam )
{
CMyDialog * me = (CMyDialog*) lParam;
return me->myfunc2();
}
|
|
|
|
|
What is the proper way to define a function that contains a class pointer as an arguement (because I am having very bad compile errors all over the place)
Is this the correct way:
void MyFunction(char*, char*, CClass*);
or
void MyFunction(char*, char*, class CClass*);
The former gives me a syntax error eg. identifyer CClass
The later gives me compile error when writing a differnt function such as
void MyFunction2(char*, char*, CClass::CSubClass*);
void MyFunction2(char*, char*, class CClass::cSubClass*);
Every time I change one way of doing it, I screw the code up somewhere else.
Can I get some help on this one? Thanks
|
|
|
|
|
void MyFunction(char* c1, char* c2, CClass* theObject);
void MyFunction2(char* c1, char* c2, CSubClass* theObject);
Note that if CSubClass extends CClass then you can pass a CSubClass* as the argument to CClass*
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
class CClass; // OR: #include "Class.h"
void MyFunction(char*, char*, CClass*);
|
|
|
|
|
Ok, thanks for the reply...I must omit "class" before the class.
NOw on to the compile errors, I don't understand them because I am including the header file that contains the class definition.
Isn't this enough?
|
|
|
|
|
what are the errors now ?
compile error ?
what is the description of the error ?
what is the line giving the error ?
TOXCCT >>> GEII power
|
|
|
|
|
that is right. Do not use the word class before variable declarations, only before the class declaration.
class B1
int i;
B1 b; // B1 is a type like int is a type
Your compile errors should be discernable. Take a break and then look at them again.
To make it more fun, Java has a "Class" type and this can be used in declaring a variable such as Class somvarthatwillrefertoaclasslater; //
|
|
|
|
|
Anonymous wrote:
Java has a "Class" type and this can be used in declaring a variable such as Class somvarthatwillrefertoaclasslater;
are you sure it is not a declaration before a definition instead of a type ?! (in C++, it is like that...)
TOXCCT >>> GEII power
|
|
|
|
|
Thanks for the replies guys. The error line reads:
error C2061: syntax error : identifier 'cDataFile'
Where cDataFile is a class defined in another header file which I have included in this header file
The function definition (part of another class)
void Save(cDataFile*);
So I'm stumped
|
|
|
|
|
First, make sure that cDataFile is spelled correctly (including capitalization, I am suspicious of your lowercase 'c').
Second, when your function uses a pointer to a class, as you did, you only need to forward include the class in the header file. Then put the #include in the .cpp file (not the .h file)
i.e.
class cDataFile;
class CYourClass
{
void Save(cDataFile*);
};
|
|
|
|