|
Thanks a lot for ur help.
well i shall try it now.
ComputerNewton
|
|
|
|
|
Friends,
I want to associate some value with every row added in CListCtrl. For this purpose i am using SetItemData() and GetItemData() .
But the problem is that i want to associate data not only per column basis, but i also want to associate data in each column of a row and later retrieve it.
How can i do so ?
|
|
|
|
|
Rather than storing your data directly in the list control's "itemdata", define your data elsewhere in your code, perhaps as classes or structures, and then store pointers to that data. This allows you to store much more complex information for each row of your list control. It's then upto you how you want to arrange and manipulate that data in relation to the current selection in the list. In this case, the SetItemData/GetItemData functions simply insert/retrieve the pointers to your "data" storage.
HTH
|
|
|
|
|
Store data for columns to some array and use SetItemData to store pointer to this array for each row in the list
rrrado
|
|
|
|
|
SetItemData() will set the item data for the entire "row." If you want a data item for each subitem too, use SetItem() .
int nItem = InsertItem(...);
SetItemData(nItem, ...);
SetItem(nItem, 0, LVIF_PARAM, "", 0, 0, 0, lParam);
SetItem(nItem, 1, LVIF_PARAM, "", 0, 0, 0, lParam);
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I'm using MSHTML for browsing and parsing HTML in my application.
How can I get image data of some element after it is downloaded (or file name of this image downloaded in temporary internet files) ?
Thank you !
rrrado
|
|
|
|
|
I have a CTreeCtrl, I need to change the color of the node that was previously selected. How do I do this.
Also I can get the previous node to be bold, but then how do I reset the same when I click on some other node.?
|
|
|
|
|
Look into the MSDN documentation for the NM_CUSTOMDRAW message. That allows you to manipulate the visual appearance of the tree control without having to resort to full-blown owner-drawn implementations. Michael Dunn has done some nice articles on the subject elsewhere at CG - I suggest you search for them.
HTH
|
|
|
|
|
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
|
|
|
|