|
I am using an inherent TabCtrl class, which added in some extra function into the standard TabCtrl, like change tab tax color when mouse over it … so if someone knows how to solve this problem using TabCtrl then our problem will be solved, and by the way, our TabCtrl is constructed on a Dialog(MFC dialog project, not Doc/View, I found a solution for Doc/View already but quite complex, and all function is nested in one class, it’s not applicable on our project).
Maybe you can provide me with your email and I can do a screen capture of my program.
|
|
|
|
|
SetCurSel( GetCurSel( ) + 1);
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hi,
I want to have a normal CDialog as a child window in a mdi application. I am using Visual c++ 6.0.
Can somebody help me with that?
I would be very thankful,
MAX
|
|
|
|
|
What is the correct syntax for the use of an extractor for a _variant_t object?
For example assume a _varient_t object was constructed as follows:
short number = 100;
_variant_t((short) number, VT_I2);
The extractor in the VCPP documentation is specified as:
operator short()
What is the correct usage and syntax to extract 'number' from the _variant_t object using this function?
Thanks.
|
|
|
|
|
It's a standard C++ conversion operator:
short number = 100;
_variant_t v ((short) number, VT_I2);
short sh1 = (short) v;
short sh2 = v; Just be prepared to catch exceptions - the converter will throw if the _variant_t doesn't actually hold a short .
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Actual sign at the laundromat I go to: "No tinting or dying."
|
|
|
|
|
Mike,
Thanks for the answer.
I had put off giving any thought to catching exceptions until I had the operator part figured, but you have nicely filled in that part also.
Bill
|
|
|
|
|
screenshot:
http://www.guiicons.com/high/ICONS.jpg
preview and download xp icons please browse
http://www.guiicons.com
|
|
|
|
|
guiicons wrote:
preview and download xp icons please browse
No spam in the CodeProject forums - please tell someone.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|
|
I have two questions. First is, how can I read and write a text file? I've done this before with fstream, but that method doesn't seem to work at all with MFC.
Second, is there a way I can easily intergrate these text files into the executable? If not, then they could just be kept in the same folder, but it would clean it up a lot if they were apart of it.
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
fstream should work, but it's C. You should use iostreams to read and write text files. Plenty of tutorials on CP.
You should be able to integrate text using resources, depending on how big they are. I've not done it tho.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Can anyone suggest a solid example tutorial for using an MDI app to access a database?
|
|
|
|
|
Hi
I am looking to write a small VC++ utility which inserts possibly a few thousand records at a time into an Access database.
The primary criteria here is efficiency. Which is the more suitable candidate? ODBC or OLE DB?
Any input is appreciated.
thanks
Satheesh
Man Learns from History that he never learns from History
|
|
|
|
|
You wont see much of a performance difference between the OLE DB ODBC provider and using the ODBC API directly. OLE DB is based on COM and it doesnt introduce any overhead. OLE DB is basically to use COM so that we can have a plug-and-play architecture for application components.
|
|
|
|
|
You can choose OLEDB. because ODBC is a generailised interface it will take some more time than OLEDB.
all the best
|
|
|
|
|
What's the easiest way to read in a large file to parse out specific dat from. Sometimes this file can be over a meg. I know I can open it with CFile and read it that way. but then I need to find specific words (using a token). Is there another class that will allow me to read in the file line by line until I hit end of file?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
One solution is file-mapping given that you just want to read the file.
Kuphryn
|
|
|
|
|
yes there is one function in CRT (C runtime library) 'gets' function. it read a next line in the stream. befor using that, you have to set your default intput stream as your file stream. for change your file stream as the default input stream freopen.
The freopen function can be used to redirect the streams to disk files or to other devices.
1. open a file in read mode.
2. redirect the stdin input stream as the standart input stream.
3. use gets function for get a line of string from the file(upto \n char).
4. use while loop to go over the file until eof .
all the best
|
|
|
|
|
I figured it out. I'm using the CStdioFile class and reading in a line at a time. Works great. Thanks all
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Is it possible to use a list to store templated classes in C++? The compiler chokes and gives me a C3203 error in Visual C++.
|
|
|
|
|
Try using typedef.
Kuphryn
|
|
|
|
|
|
Here is the code
namespace mrg
{
template<class _Ty> class mrgFwdPt
{
public:
mrgFwdPt()
{
}
mrgFwdPt(_Ty v, Date dt) : _mVal(v), _mFwdDt(dt)
{
}
~mrgFwdPt()
{
}
inline void SetValue(_Ty v) { _mVal = v; }
inline void SetDate(Date d) { _mFwdDt = d; }
inline _Ty GetValue(void) { return _mVal; }
inline Date GetFwdDt(void) { return _mFwdDt; }
// these operators work on the date objects to allow
// sorting of the forward points by date
bool operator>(const mrgFwdPt<_Ty>& right) const;
bool operator<(const mrgFwdPt<_Ty>& right) const;
bool operator>=(const mrgFwdPt<_Ty>& right) const;
bool operator<=(const mrgFwdPt<_Ty>& right) const;
bool operator==(const mrgFwdPt<_Ty>& right) const;
bool operator!=(const mrgFwdPt<_Ty>& right) const;
protected:
_Ty _mVal;
Date _mFwdDt;
};
template<class _Ty> bool mrgFwdPt<_Ty>::operator>(const mrgFwdPt<_Ty>& right) const
{
return (_mFwdDt > right._mFwdDt);
}
template<class _Ty> bool mrgFwdPt<_Ty>::operator<(const mrgFwdPt<_Ty>& right) const
{
return (_mFwdDt < right._mFwdDt);
}
template<class _Ty> bool mrgFwdPt<_Ty>::operator>=(const mrgFwdPt<_Ty>& right) const
{
return (_mFwdDt >= right._mFwdDt);
}
template<class _Ty> bool mrgFwdPt<_Ty>::operator<=(const mrgFwdPt<_Ty>& right) const
{
return (_mFwdDt <= right._mFwdDt);
}
template<class _Ty> bool mrgFwdPt<_Ty>::operator==(const mrgFwdPt<_Ty>& right) const
{
return (_mFwdDt == right._mFwdDt);
}
template<class _Ty> bool mrgFwdPt<_Ty>::operator!=(const mrgFwdPt<_Ty>& right) const
{
return (_mFwdDt != right._mFwdDt);
}
//=========================== end of point class ==========================================//
template<class _Ty> class mrgFwdCrv
{
public:
mrgFwdCrv()
{
}
~mrgFwdCrv()
{
}
bool push_back(mrgFwdPt<class _Ty> fp)
{
_mList.push_back(fp);
return true;
}
bool test_sort(void);
private:
list<mrgFwdPt<class _Ty>> _mList;
};
template<class _Ty> bool mrgFwdCrv<_Ty>::test_sort(void)
{
Date d;
list <mrgFwdPt<class _Ty>>::iterator i;
for (i = _mList.begin(); i != _mList.end(); i++)
{
d = (*i)->GetFwdDt();
cout << d.DateString() << endl;
}
_mList.sort(less<mrgFwdPt<class _Ty>>());
for (i = _mList.begin(); i != _mList.end(); i++)
{
d = (*i)->GetFwdDt();
cout << d.DateString() << endl;
}
}
}
Class mrgFwdPt is a templated class. It works exactly as expected. When the second class mrgFwdCrv is added, the compiler chokes and I get all kinds of errors. What I would like to do is have the second class (mrgFwdCrv) handle a list of the mrgFwdPt classes. I thought about the typedef approach but wouldn't the compiler just make the substitutions I have here?
Thx
|
|
|
|
|
I did some corrections in your code, and now the below compiles with no errors.
Some operator overloadings are omitted ...
-------------------------------------------------------
#include <list>
namespace mrg
{
typedef int Date; // Assumption for this demo only.
template<class _Ty>
class mrgFwdPt
{
public:
mrgFwdPt()
{ }
mrgFwdPt(_Ty v, Date dt)
: _mVal(v)
{ }
~mrgFwdPt()
{ }
protected:
_Ty _mVal;
};
//=========================== end of point class ==========================================//
template<class _Ty>
class mrgFwdCrv
{
public:
mrgFwdCrv()
{
}
~mrgFwdCrv()
{
}
bool push_back(mrgFwdPt<_Ty> fp) // this line.
{
_mList.push_back(fp);
return true;
}
bool test_sort(void);
private:
std::list<mrgFwdPt<_Ty> > _mList;
};
template<class _Ty>
bool mrgFwdCrv<_Ty>::test_sort(void)
{
Date d;
list <mrgFwdPt<_Ty> >::iterator i;
for (i = _mList.begin(); i != _mList.end(); i++)
{
d = (*i)->GetFwdDt();
cout << d.DateString() << endl;
}
_mList.sort(less<mrgFwdPt<_Ty> >());
for (i = _mList.begin(); i != _mList.end(); i++)
{
d = (*i)->GetFwdDt();
cout << d.DateString() << endl;
}
}
}
void main()
{
mrg::mrgFwdPt<int> aa;
mrg::mrgFwdCrv<long> bb;
}
------------------------------------------------
------ Build started: Project: TestDos, Configuration: Debug Win32 ------
Compiling...
main.cpp
Linking...
Build log was saved at "file://d:\Tmp\TestEnv\VC7\DOS\TestDos\Debug\BuildLog.htm"
TestDos - 0 error(s), 0 warning(s)
---------------------- Done ----------------------
Build: 1 succeeded, 0 failed, 0 skipped
<b>Maxwell Chen</b>
|
|
|
|
|
Worked like a champ. Thanks very much.
|
|
|
|
|
I'd need help on converting a char* to a dword OR a byte[4]
thanks!
|
|
|
|