|
u might want to think about implementing the http GET and POST methods in a c++ app that runs in the system tray for example ... then its fairly easy to do all the stuff u want
"there is no spoon" biz stuff about me
|
|
|
|
|
You can:
1) Search info on msdn for automation.
Then you can control your I-net explorer.
you can "feed" data to the I-net explorer with GET (via URL) or POST (if I'm not mistaken data in HTML header section)
Note: This is possible, but not easy.
2) if you know MFC (or have Visual Studio) maybe you can find functions there.
Good luck.
|
|
|
|
|
|
is it possible to check a variable's type?
e.g.
if m_variable is equal to CString, DoSomething()...
|
|
|
|
|
if ((dynamic_cast<CString*>(m_variable))!=0)
{
DoSomething();
}
hope it helps
|
|
|
|
|
unfortunately that didn't work.
error C2682: cannot use dynamic_cast to convert from 'class CString' to 'class CString *'
and const_cast didn't work either (not that I fully understand either of them )
changing CString to double didn't help - apparently it's not possible to dynamic_cast double*
anymore ideas ?
|
|
|
|
|
what if you remove that * with dynamic_cast?
|
|
|
|
|
no success
CString m_variable = "test";
if ((dynamic_cast<cstring>(m_variable))!=0)...
error C2680: 'class CString' : invalid target type for dynamic_cast
|
|
|
|
|
You have to do this way:
CString m_Str = "test";<br />
if(dynamic_cast<CString*>(&m_Str))<br />
DoSomething();
Maxwell Chen
|
|
|
|
|
that didn't work either.
i tried:
CString m_Str = "test";
if(dynamic_cast<cstring*>(&m_Str)) TRACE("yes !\n")
else TRACE("no !\n");
error C2683: dynamic_cast : 'CString' is not a polymorphic type
do i have to declare it as a polymorphic type?
|
|
|
|
|
I typed up a reply explaining that I'm pretty certain you need to qualify the dynamic_cast in this case (i.e. add <CString *>), but that won't fix your problem here.
CString has no virtual functions (apparently) and as such, is not polymorphic, which means you cannot use dynamic_cast on it.
Use typeid instead. It should theoretically be faster anyway.
typeid Operator (MSDN)
|
|
|
|
|
Don't know...
Regarding to typename CString specifically, it works well with my VC++.NET v7.0. I had tested the code snippet before I posted the previous post. And the code compiles well without any error / warning!
Maxwell Chen
|
|
|
|
|
Hmm. You're right. Your code's working on VS.NET2003 as well. Perhaps it's an incompatability between CString implementations? Or maybe he's using VC6, and it's failing to match the standards in this area.
|
|
|
|
|
In VC++6, it's an ordinal class CString.
In VC++7.x, it's a class template CStringT<typename N>. And typedefed CStringT<char> as CString.
Maybe that's the cause...
Maxwell Chen
|
|
|
|
|
Apparently so. I guess I'm not quite clear on what counts as a polymorphic type, though. Maybe templates are special or something, but I couldn't find any virtual functions in CString or its superclass. It seems to me that it still shouldn't qualify as a polymorphic type, and therefore dynamic_cast shouldn't work.
|
|
|
|
|
yes i am using vc++6.0
i will try the typeid method once i re-write all my lost codes
My initial intention was to come up with a global class that can convert
a variable of type A to type B at run-time.
|
|
|
|
|
Remember to turn on the RTTI (run-time type information) option in VC++ project setting.
Maxwell Chen
|
|
|
|
|
aaaaahh...
thats what they mean by run time type information !!!
haha.
|
|
|
|
|
What vc 7.x is doing seems more logical than vc 6.0 ...
it seems to be checking the "from" and "to" types!
class A {
int a;
};
class B: public A {
int b;
};
/***** break ****/
B b;
if (dynamic_cast<B *>(&b)) {
printf("OK");
}
/***** above will work in vc 7.x but not vc 6.0 */
/***** below will NOT work in both vc 7.x & vc 6.0 */
B b;
A *p_a = &b;
if (dynamic_cast<B *>(p_a)) {
printf("OK");
}
|
|
|
|
|
If you already have the variable, as opposed to a pointer or a reference to a variable, you already know the type of the variable, so I'm not quite clear on why you even need to check this at all.
If you can post a code snippet showing what exactly you are trying to do, I'm sure someone could give you an exact answer. At least tell us what m_variable is declared to be? Is it a CString, or a pointer to a CString, or a void pointer, or something else?
|
|
|
|
|
my source file is gone ! (not in Recycle Bin, My Computer, anywhere...)
for some reason, my source file has disappeared (although the header file is still there). Could it be because I wrote
#include "MyGlobals.h" in stdafx.h ?
I've been using extern to make everything in MyGlobals.cpp available
everywhere - and it worked so well for so long... up until I started messing around with dynamic_cast.
has this happened to anyone before ?
(in extreme doh)
|
|
|
|
|
I'd say run a system-wide search for the file just to make sure you didn't accidentally drag-and-drop it into another folder somehow.
If that doesn't turn it up, it's probably gone for good. I suppose you could try some file-recovery software. But I've had little success with that in the past.
I'd also run a system-wide virus scan. If it's really gone, something deleted it. It's unlikely that it's a Windows or hardware problem. (Might be worth checking the event viewer in Administrative Tools, though, just in case.)
After that, I guess you get to start over if you didn't recover it. Sucks, but it happens. (This is why everyone talks about backups, though I don't believe most actually do so on a regular basis.)
|
|
|
|
|
I used to zip my source code files (removed those .ncb, .opt, .plg, .\Debug, etc.) with separate file names (timestamp + hint) quite often to prevent such disasaters.
Maxwell Chen
|
|
|
|
|
When you get going again, maybe you could try a template specialisation, which avoids the need for typeid or dynamic_cast's by making the compiler do the work for you.
This specialisation is so simple that it should work even under VC6
template<class T>
void f(T t)
{
}
template<>
void f<CString>(CString t)
{
OutputDebugString(t);
}
int i = 0;
f(i);
CString str = "hello world";
f(str);
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
did you try typeid () ??
TOXCCT >>> GEII power
|
|
|
|