|
sach!! wrote: I just want to confirm that my release build also work fine.
The best way would be to run it on a system which does not have VS installed.
This will confirm things once and for all.
Abhishek
The worst loneliness is not to be comfortable with yourself.
--Mark Twain
|
|
|
|
|
hello all,
how can i make, a forward declaration class's enum member, being
visible by another class?
consider the following case,
----------------------------
dog.h
----------------------------
#ifndef DOG_H
#define DOG_H
// class forward declaration.
class cat;
class dog
{
public:
enum dog_enum
{
d0, d1, d2
};
void speak(cat *c);
};
#endif
----------------------------
cat.h
----------------------------
#ifndef CAT_H
#define CAT_H
#include "dog.h"
class cat
{
public:
void speak(dog *d, dog::dog_enum e);
};
#endif
The above cat and dog just work fine. Now, let me create an enum type
for cat too.
----------------------------
dog.h
----------------------------
#ifndef DOG_H
#define DOG_H
// class forward declaration.
class cat;
class dog
{
public:
enum dog_enum
{
d0, d1, d2
};
// OPPS! HOW DO WE FORWARD DECLARE ENUM???
void speak(cat *c, cat::cat_enum e);
};
#endif
----------------------------
cat.h
----------------------------
#ifndef CAT_H
#define CAT_H
#include "dog.h"
class cat
{
public:
enum cat_enum
{
c0, c1, c2
};
void speak(dog *d, dog::dog_enum e);
};
#endif
My question is, how can "dog" see the cat_enum, which is re-inside cat?
I was understand that forward declaration for enum is not allowed in
c++.
Is there any workaround for this?
Thank you very much
|
|
|
|
|
I'm a noobie of visual c++ and currently using vc++ express 2005.
I'm creating an application to handle data from a device connected both
on a serial port and via tcp/ip networking and been successful with the work so far.
My problem is within the application interface.
I have a mdichild which will show data send from the device within the serial port and then
do some decoding and throw it as keystokes.
Within the mdichild I put a button which when it clicked it will send the data into another
mdichild form ( which will process the data, querying, bla.. bla..bla...)
How can I acomplish this ?
Thanks
|
|
|
|
|
Hi..error in reading...
void ReadModelDetail()
{
char FileBuffer[25] = {0}, TempString[15] ={0};
char cTagLength[5];
char tModelName[25]={0},tDesc[60]={0};
int Count=0,iCount=0;
CModelInfo *info;
if(!OpenReadModel())
{
return;
}
OModelList.RemoveAll();
memset(TempString,0,15);
memset(FileBuffer,0,20);
MdlFile.Read( FileBuffer, DEF_HEADERSIZE );//It reads "Esim"
MdlFile.Read( TempString,sizeof(int)); //it reads "6"
Count = atoi(TempString);
for(iCount=0; iCount< Count; iCount++)
{
memset(tModelName,0,25);
MdlFile.Read(tModelName,25); //It should read "PPS01" but it read "S01"
}
CloseReadModel();
}
The file looks like this ESIM 6 PPS01..
The Model name is PPS01..but it reads like tht it neglect first 2 characters in the name and read only "S01" if the model name is DT002 then it reads on ly "002"..
What can i do?
Anu
|
|
|
|
|
The problem is here:
Anu_Bala wrote: MdlFile.Read( TempString,sizeof(int)); //it reads "6"
That is false. sizeof(int) returns 4, so you read 4 characters ! You have to make a difference between the size of an integer (always 4 bytes) and the size of the string that represents this character (can vary depending of the number of digits).
If your integer is always smaller than 10, then you can read only one char. But if you don't know how many digits it will contain, then you are in trouble. It is better to store the complete line in a buffer and then scan it for white spaces inside it (like I suggested yesterday). Or use scanf as somebody suggested you also.
|
|
|
|
|
If MdlFile is a CStdioFile object, try:
CString strLine;<br />
MdlFile.ReadString(strLine);<br />
char a[25], c[25];<br />
int b;<br />
sscanf(strLine, "%s %d %s", a, &b, c);
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I've taken a bitmap into a DC and then i made some changes to the DC content. now can i save this DC content as a bitmp? if so how? plz help me.
-- modified at 3:20 Thursday 10th August, 2006
E-Ramu
|
|
|
|
|
Ramu.e wrote: now can i save this DC content as a bitmp
yes
create a temprory dc and a bitmap
say CDC CTempDc ; and
CBitmap bmpScreenContent ; ( u should call the createcompatiblebitmap and createcompatibledc ) of the above objects.
select the bmpScreenContent to the TempDc. bitblit from the screen dc to the TempDc. Now the bmpScreenContent contains ur screen
nave
|
|
|
|
|
And see CImage class maybe it is some helpful to you
|
|
|
|
|
|
hi all i had written text in event viewer and ,for that i had also written in the registry setting related to the services i.e
"SYSTEM\\CurrentControlSet\\Services\
\\EventLog\\Application\\SamplApp"
when i c that in rejistry sampleapp folder is created with its contents,text in the event viewer is aslo written but with the text follwing message also appear.
The description for Event ID ( 1 ) in Source ( NetBlocker ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. The following information is part of the event:
"08/10/06 10:48:50 Service Stoped",it is actual text above is the message which i want to skip.
what i m doing wrong first i created rej key and then write in event viewer which MSDN told.
Tasleem Arif
|
|
|
|
|
You have to create a dll. That dll contains the texts for the different Event ID's you use.
(There are ways to go around the creation of the dll, I think I saw an article about that here at CP a couple of years ago).
Search for "event log" in the articles section at CP. Or have a look here.[^]
|
|
|
|
|
Hi
can anybody give me a sample code regarding what we have to write in a virtual destructor of base & derived class.
What we have to write to call the destructor.?
bye
|
|
|
|
|
lavate malllik wrote: can anybody give me a sample code regarding what we have to write in a virtual destructor of base & derived class.
try http://www.parashift.com[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY-
|
|
|
|
|
thanks for reply..
can u give me a piece of code where it shows it has written something in destructor...?
i wnat to knwo what we have to write in a destructor of base & derived class when base class destructor is virtual?
are we have to write any thing is any one of destructor?
|
|
|
|
|
you write a destructor to deallocate te memory allocated dynamically during the object's life (from construction to now - destruction). the fact a destructor is virtual or not is a matter of inheritence and doesn't affect what you write in the destructor body.
and to call the destructor, you don't have to do anything much. an object is automattically when the execution goes out of the scope of the object.
|
|
|
|
|
SAY if my destructor body is empty & I call delete p.it will call destructor & ultimately it will destroy the object of base & derived irrespective of empty body of destructor....
|
|
|
|
|
Here is a very simple illustration on how they work:
class Base
{
public:
Base() { cout << "Base::Base()" << endl; }
virtual ~Base() { cout << "Base::~Base()" << endl; }
};
class Derived : public Base
{
public:
Derived() { cout << "Derived::Derived()" << endl; }
virtual ~Derived() { cout << "Derived::~Derived()" << endl; }
};
void main()
{
Base b;
Derived d;
}
Output:
Base::Base()
Base::Base()
Derived::Derived()
Derived::~Derived()
Base::~Base()
Base::~Base()
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
|
hello
i am working with automation in vc++6.0 .Can anyone tell me about how can i transfer bitmap images in the MS word using automation from my VC++6.0 application.If someone have sample application send me .I have already done this thing with the MS Excel .Now need in MSWord .Plz help me on this topic.
Sukhpreet
sukhpreet
|
|
|
|
|
I could execute 'C' code for serial port communication on DOS based environment. I need to do it using VC++. I am completely new to it. How should I start?
Inderpreet
|
|
|
|
|
There are some usefull articles and classes here[^]
|
|
|
|
|
I_arora wrote: I could execute 'C' code for serial port communication on DOS based environment. I need to do it using VC++. I am completely new to it. How should I start?
In addition to cedric.. i would like to recommend you CSerialPort class listed there!.. it is one of best freely available class for Serial Post Communitcation
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Re
|
|
|
|
|
I_arora wrote: I need to do it using VC++.
See here.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
It depends how hard you want to work!
If you want to work really hard, learn C++. Sure, it has long-term benefits, but it's a lot of work!
If you don't want to work so hard, use the C code you already know, and hack it to work under Windows. Start by making a console application, copy in your old code, fix compiler errors, etc. It's not pretty, but it may work!
Where you are likely to hit a problem is when you directly access I/O ports, but you can use a "port access" library. I have personally used inpOut32.dll http://www.logix4u.net/inpout32.htm[^]- works like a dream. This library provides inp32 and out32 functions, which allow you to directly access ports, as in DOS or Win9x.
|
|
|
|