|
Hi
Im trying to figure out subject but I cant get it to work. I have no problem saving but when I want to load the data again I have to somehow know what type of object it is and then create it...how do I do that?
Tnx in advance!!!
|
|
|
|
|
The easiest way is to precede the class in the file with an enumerator that indicates what sort of object follows.
|
|
|
|
|
Why don't you put all your objects in a CObArray and use the CObArray::Serialize to read and write?
|
|
|
|
|
Hi friends,
Anybody have an idea how to get the details of the clients, workstation in a network ???
I thought it will be possible with NetBIOS. Is there any API for using that ??
Any suggestion regarding this will be very useful for my project.
Thanks & Regards
Satya
|
|
|
|
|
These should get you started:
WNetOpenEnum()<br />
WNetEnumResource()<br />
NetWkstaGetInfo()<br />
NetWkstaUserGetInfo()<br />
NetWkstaUserEnum()
|
|
|
|
|
hi david,
can i get some examples for these calls or any links for the examples.
regards
satya
|
|
|
|
|
|
I am looking for info on how to mimic the option bar found in winxp's explorer. It is also used in the CD burning software Alcohol 120%.
Sorry if I am not giving the correct name or describing it very well. I don't know what it is called. In explorer it has the options: system tasks, other places and details. They are collapsable. Well let me know.
Thanks,
Steve
|
|
|
|
|
|
Yes, but I don't use C# but thanks, I may can learn something from it
Steve
|
|
|
|
|
Oops, sorry, I didn't see it was written in C# when I looked at it...maybe I'll give a shot at porting it to MFC sometime.
Chris Richardson Terrain Software
|
|
|
|
|
|
|
Chris,
Thanks, I did happen to come across this article myself. Exactly what I was looking for.
Thanks for responding,
Steve
|
|
|
|
|
dear all,
i was just thinking about an developing an application which maintains a
counter (say the number of times it's been executed).
but i want the counter value to be maintaied within that application without using any external resources like registry, ini files, databases etc.
is possible for an application to keep track of such a counter.
regards,
|
|
|
|
|
No. If you do not want to save the value somewhere, there is absolutely no way to keep trace of your counter.
~RaGE();
|
|
|
|
|
This is just a guess, but you might could do it by modifying a known location within the EXE itself. Let's sayh you put two global variables in the program:
static LPCSTR lpszStringToSearchFor = "StringToSearchFor";
static DWORD dwRunCount = 0;
Now when the EXE is compiled, these two variables should be right next to each other. If you then searched for "StringToSearchFor," then the next 8 bytes would be the count. Modifying this value while the program is running might be a tad tricky. You might have to create a dummy program that launches the real program, waits for it to finish, then updates the count.
Another option that comes to mind is to update the count as a resource. Check out LoadResource(), LockResource(), BeginUpdateResource(), UpdateResource(), and EndUpdateResource().
|
|
|
|
|
The resource modifier option David mentions is the best way to do this.
|
|
|
|
|
okay.. in my program i would like to have a structure like that
<br />
class base<br />
{<br />
public:<br />
void function1()<br />
{<br />
....<br />
function2();<br />
}<br />
<br />
virtual void function2 = 0;<br />
};<br />
<br />
class derived1 : public base<br />
{<br />
public:<br />
void function2<br />
{<br />
cout << "Function2 from derived1";<br />
}<br />
}; <br />
<br />
class derived2 : public base<br />
{<br />
public:<br />
void function2<br />
{<br />
cout << "Function2 from derived2";<br />
}<br />
};<br />
int main()<br />
{<br />
base* pBase = new derived1;<br />
base* pBase2 = new derived2;<br />
<br />
pBase->function1();<br />
pBase->function2();<br />
}<br />
Any Ideas,
thanks in advance,
bernhard
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
I cant see anyt problem in your code
It's ok and should work...
output:
<br />
Function2 from derived1<br />
Function2 from derived1<br />
what is your problem ????
any ideas for what ????
------
The Server
|
|
|
|
|
it doesn't compile (in vc++6) because it tries to call the pure virtual function function2 from the base class (and not the derived ones).. it only works if i call the function2 from the derived classes..
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
You need to declare thye base class functions as virtual aswell as the derived class
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
Bernhard wrote:
it doesn't compile (in vc++6) because it tries to call the pure virtual function function2 from the base class (and not the derived ones).. it only works if i call the function2 from the derived classes..
You just said it youself , this class is abstract, it has a pure virtual method, it can't be instantiated.
|
|
|
|
|
but is there something, which will do the job..
i want a function in the base class which calls a overloaded function from derived classes?
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
FOR CRYING OUT LOUD
IT F#$%ING WORKS !!!!
file.h:
class cBase
{
public:
virtual void func1(){ func2(); }
virtual void func2()==0;
};
class cDer1
{
public:
void func2() { printf("(2)It works!!!\n");}
};
class cDer2
{
public:
void func2() { printf("(2)It works!!!\n");}
};
file.cpp
#include "file.h"
#include <conio.h>
#include <stdio.h>
void main()
{
cBase * a= new cDer1();
cBase * b= new cDer2();
a->func1();
b->func1();
a->func2();
b->func2();
printf("IT F@#!@ WORKS");
getch();
}
====================
=== THE SERVER ===
====================
|
|
|
|