|
Hi all..
Iam developing an application where in ,the application sends data to the server and need to calculate the bandwidth.I want to find the Time difference in milliseconds between the data sent and received..Is there any member function which will help be to find the time difference in milliseconds.
|
|
|
|
|
Have a look at QueryPreformanceCounter() and QueryPerformanceFrequency()
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Have a look at GetTickCount()
|
|
|
|
|
Before you get too excited about lack of resolution, read this article.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Given the code below why am I getting the following error message?
point3d.cpp(26) : error C2660: 'setZ' : function does not take 0 parameters
#include "Point3D.h"
#include <iostream>
using std::cout;
using std::ostream;
Point3D::Point3D(void)
{
setX(0);
setY(0);
setZ(0);
}
Point3D::Point3D(double xValue, double yValue, double zValue)
{
setX(xValue);
setY(yValue);
setZ(zValue);
}
Point3D::Point3D(const Point3D& p)
{
setX(p.getX());
setY(p.getY());
setZ(p.setZ());
}
double Point3D::getZ() const
{
return z;
}
void Point3D::setZ(double zValue)
{
z = zValue;
}
ostream& operator<<( ostream& o, const Point3D& p)
{
o << "(" << p.getX() << ", " << p.getY() << ", " << p.getZ() << ")";
return o;
}
Thanks, i appreciate it
|
|
|
|
|
You might want to take a closer look at your overloaded constructor.
setZ(double zValue) takes a single parameter of type double. You're not passing in any kind of value (double) when you call setZ in your overloaded constructor.
<code>
Point3D::Point3D(const Point3D& p)
{
setX(p.getX());
setY(p.getY());
setZ(p.setZ());
}
void Point3D::setZ(double zValue)
{
z = zValue;
}
</code>
Regards,
|
|
|
|
|
do I need to do something similiar as below in point2d.cpp
//Point2d.cpp
#include <iostream>
using namespace std;
#include "Point2D.h"
Point2D::Point2D()
{
setX(0);
setY(0);
}
Point2D::Point2D(double a, double b)
{
setX(a);
setY(b);
}
Point2D::Point2D(const Point2D& p)
{
setX( p.getX() );
setY( p.getY() );
}
Point2D Point2D::getPoint() const
{
return (*this);
}
double Point2D::getX() const
{
return x;
}
double Point2D::getY() const
{
return y;
}
void Point2D::setX(double a)
{
x = a;
}
void Point2D::setY(double b)
{
y = b;
}
void Point2D::setPoint(const Point2D& p)
{
setX( p.getX());
setY( p.getY());
}
Point2D Point2D::operator+(const Point2D& p)
{
return Point2D( getX()+p.getX(), getY()+p.getY());
}
Point2D Point2D::operator-(const Point2D& p)
{
return Point2D( getX()-p.getX(), getY()-p.getY());
}
bool Point2D::operator<(const Point2D& p) const
{
return (getX() < p.getX() || getY() < p.getY());
}
bool Point2D::operator>(const Point2D& p) const
{
return (getX() > p.getX() || getY() > p.getY());
}
bool Point2D::operator==(const Point2D& p) const
{
return (getX() == p.getX() && getY() == p.getY());
}
Point2D& Point2D::operator++(void)
{
setX(getX()+1);
setY(getY()+1);
return *this;
}
Point2D Point2D::operator++(int dummy)
{
Point2D p = *this;
setX(getX()+1);
setY(getY()+1);
return p;
}
ostream& operator<<( ostream& o, const Point2D& p)
{
o << "(" << p.getX() << ", " << p.getY() << ")";
return o;
}
Thanks
|
|
|
|
|
In the copy constructor:
Point3D::Point3D(const Point3D& p)<br />
{<br />
setX(p.getX());<br />
setY(p.getY());<br />
setZ(p.setZ());<br />
}<br />
The last line calls p.setZ() when it should call p.getZ() . So the copy constuctor should be:
Point3D::Point3D(const Point3D& p)<br />
{<br />
setX(p.getX());<br />
setY(p.getY());<br />
setZ(p.getZ());<br />
}<br />
|
|
|
|
|
Hello, everyone,
In my current project, I am using BHO. I need a function to be called when the size of IE browser window changes.
In the IDispatch::Invoke function, I tried to use DISPID_WINDOWSETWIDTH, DISPID_WINDOWSETWIDTH and DISPID_WINDOWRESIZE. But none of them fires when the IE browser window size changes?
What should I do?
Thanks a lot in advance.
Bin
|
|
|
|
|
I also tried DISPID_WINDOWSETLEFT, but it doesn't work.
|
|
|
|
|
Mini-Project on "CT Movers"
CT Movers is a small company that specializes in transporting people and moving goods. It has an extensive fleet of vehicles consisting of mini buses, buses and Lorries. Transport services are charged either on an hourly rate or per trip, based on the vehicle capacity.
Write a program that allows the administrator to confirm bookings of vehicles for a particular day. When the program is invoked, the administrator can view the list of vehicles available, and select one for booking. The administrator can then key in the total number of hours or total number of trips, respectively, based on the charge type. The system will then calculate and display the total transport charge, and mark the vehicle as booked and no longer available for the day. The administrator should also be allowed to display the complete list of vehicles in the fleet, their status (booked or available) and the booking details, if booked.
Design and implement a class VehicleInfo in your program. The VehicleInfo class will contain the vehicleID, vehicleType and vehicleCapacity. Two derived classes BusInfo and LorryInfo will inherit from VehicleInfo class. BusInfo will contain vehicleCapacity in terms of number of passengers allowed, and services are charged on an hourly rate. LorryInfo will contain the length, breadth and height of the boxed lorry and services are charged based on the number of trips. You will need to keep track of other data such as the booking status, and the total charges.
The fleet of vehicles available is as follows:
Vehicle Type Capacity Charges Number available
Mini Bus 15 passengers 80 per hour 5
Bus 30 passengers 120 per hour 2
Small Lorry 10'x5'x12' 200 per trip 2
Large Lorry 16'x6'x15' 300 per trip 2
You are required to exercise creativity in your program design and may add other features such as special discounts. You should make your program as friendly as possible to the users
abdul
|
|
|
|
|
Ah, I remember that class, it's called Intro to Object Oriented Programming using C++.
Do you have a specific question? If this is an assignment from a CS course in college the solution is relativly simple. Furthermore, class projects in CS courses generally don't get any easier than this. If someone did give you the complete solution to this problem they wouldn't be doing you any favors.
Try and find a solution to your problem on your own. If you get stuck and have a specific question come back and ask away, I'm sure you'll get alot better reception.
If you just don't know where to start, try contacting your instructor, or re-read your homework assignment.
Good Luck,
|
|
|
|
|
Note: Visual C++ not .net.
How do you load an image from a URL in GDI+?
I have looked at the FromStream function but I don't seem to understand it.
|
|
|
|
|
Is there a way to set the dialog program so that when it run, it read input file (config, ini, txt, data, mdb...). And let say that the file containt an int. if it is 1, the screen will show 1 button, if 2, 2 button and so forth. Also same for string, can the program take in a string and put it up on screen as button label?
thank you!
|
|
|
|
|
You can use INI files or registry to store your settings. Read them on application initialization and apply the settings as per your application's needs. Both INI and registry supports integers and strings.
Gurmeet S. Kochar If you believe in God, it's because of the Devil
My CodeProject Articles: HTML Reader C++ Class Library, Numeric Edit Control
|
|
|
|
|
I am writing a application that connect to a server (first time working with sockets) So I have a class calls CCommunication, my include directives (#include <afxsock.h>) and have a pointer to the CSocket declared as private, now I am iplementing the interface, and here is where the problem starts, when I try to use the pointer m_pTheSocket, I get the following error:
error C2065: 'm_pTheSocket' : undeclared identifier
what wrong here?
class communication :publice CSocket
{
...
...
private
CSocket* m_pTheSocket;
};
bool connect()
{
m_pTheSocket->Create()
...
...
}
I get an error????
|
|
|
|
|
connect() is not a method of communication:public CSocket.
Try this
class communication :publice CSocket
{
...
...
private:
CSocket* m_pTheSocket;
public:
bool connect()
{
m_pTheSocket->Create()
...
...
}
};
Also, here is a nice article for you.
http://tangentsoft.net/wskfaq/articles/csocket.html
|
|
|
|
|
|
I have small CHtmlView - based application. If opens a page with Java or JavaScript error, the debugger (InterDev) pops up automatically. I believe In MSIE Internet Options / Advances "Disable script debugging" is checked. Is there a way to prevent it from doing so ?
|
|
|
|
|
Can anyone please explain me how to change font in CEdit.
I tried with CWnd::SetFont() but it doesn't work.
|
|
|
|
|
You need to ensure that the font exists for the life of the CEdit control. Suppose you're changing the font in the OnInitDialog() handler for your class:
BOOL MyDialog::OnInitDialog()
{
CFont myFont;
myFont.CreatePointFont(120,"Arial");
myEdit.SetFont(&myFont);
} This won't work, because as soon as the OnInitDialog function exits, the myFont variable is destroyed, which destroys the font and the edit control reverts to using the standard font.
You fix this by making the myFont value a member of the dialog:
class MyDialog : public CDialog
{
CFont myFont;
};
BOOL MyDialog::OnInitDialog()
{
myFont.CreatePointFont(120,"Arial");
myEdit.SetFont(&myFont);
} Since the myFont variable is a member of the dialog class, it exists for as long as the dialog object, and therefore the edit control.
Software Zen: delete this;
|
|
|
|
|
|
I do apologize if this question has been asked a thousand fold but here I go again with it. Is it possible to compile a VC++6.0 project in VC++ .NET? After some looking I'm thinking .NET is a whole new framework and that it I wrote my project in VC++ 6 than it stays as a VC++ 6 unless I rewrite it? Is that a logical assumption or is there a way to convert it over painlessly.
thanks!
|
|
|
|
|
Yes, you can compile your VS6 project just fine in VS.NET. When you open your old project, you'll be asked to convert it into a VS.NET project. A common mistake for people is to think that VS.NET is .NET only, but you can create just normal C++ programs with it, just like in VS6.
Be sure that everything is compatible with VS.NET though. The company I work for uses OmniORB 3.xx for example, and that won't compile with VS.NET. But normally, there shouldn't be any problems.
|
|
|
|
|
VC.Net will convert your 'project' files. Generally if your source code is conservative then it will just compile with the new compiler and libraries. If you've exploited undocumented features of ATL or MFC then you may have to do some tweaking. Similarly if your use of the standard library was somewhat non-standard then VC.Net may complain.
IME it generally works well. Take care to preserve your original files.
Paul
|
|
|
|