|
I have created a lsitbox control, and got a database into MFC application. i am trying to display data from a particular field into the listbox.when i did this
CListBox* pListBox = static_cast<clistbox*> (GetDlgItem(IDC_COURSE));
pListBox->AddString(m_pSet->m_Course);
it is only showing the first one. how can i make display all, and let me choose from it.please let me know
|
|
|
|
|
swerajan wrote:
pListBox->AddString(m_pSet->m_Course);
it is only showing the first one. how can i make display all,
How about a loop?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
One solution is InsertItem().
Kuphryn
|
|
|
|
|
Which would be for a list control, would it not?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
how to convert LPCOLESTR to CString and viceversa ?
|
|
|
|
|
|
Hi!
I have a dialog based project.
The first dialog is the login, the second the menu.
When I exit from the login (cancel), my thread exits with code 0.
But when I exit from the menu, I close my menu dialog with cancel, and automaticaly my login dialog with CDialog::OnOK(), and the thread exits with code 13.
I don't know where is my bug...
Thanks
|
|
|
|
|
Thread exit codes can be whatever you want. The fact that it's non-zero doesn't necessarily indicate an error, and in fact the return code of the main thread of a GUI app is generally not useful.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|
|
Hi,
I've subclassed a an edit control from CEdit.
below is what's in the header file:
class CMyEdit: public CEdit<br />
{<br />
public:<br />
void ChangeColour(const unsigned long &bg, const unsigned long &fg);<br />
protected:<br />
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);<br />
<br />
DECLARE_MESSAGE_MAP()<br />
private:<br />
CBrush m_brush;<br />
unsigned long TextColour;<br />
unsigned long BKColour;<br />
CFont m_TextFont;<br />
};<br />
<br />
}<br />
the methods in my C++ files are:
HBRUSH CMyEdit::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <br />
{<br />
HBRUSH hbr = CEdit::OnCtlColor(pDC, pWnd, nCtlColor);<br />
<br />
pDC->SetTextColor(TextColour);<br />
<br />
return m_brush;<br />
}<br />
<br />
void CMyEdit::ChangeColour(const unsigned long &fg, const unsigned long &bg)<br />
{<br />
TextColour = fg;<br />
BKColour = bg;<br />
m_brush.DeleteObject();<br />
m_brush.CreateSolidBrush(BKColour);<br />
Invalidate();<br />
My problem is why the method OnCtlColor is NOT being called?
Any explanations
Thanks, Alton
|
|
|
|
|
Have you set a reflection mapping up (ON_WM_CTLCOLOR_REFLECT) in the class's message map?
Steve S
|
|
|
|
|
In my Cdialog based class, I have three buttons arranged vertically and centered in the dialog at design time. I dont do anything special to the class when I run it. It shows up with the right side of the dialog larger than the left side, i.e. the buttons are no longer horizontally centered. I can I guess do a runtime positioning with MoveWindow etc but am wondering why this is happening. ANything short of runtime positioning I can do at designtime to fix this?
Thanks,
ns
|
|
|
|
|
ns wrote:
It shows up with the right side of the dialog larger than the left side,
That shouldn't happen. Windows won't move/align your controls by itself.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
DragAcceptFiles is basically a legacy API - this is how Windows 3.1 File Manager used to indicate a file drop onto an application.
Explorer uses the full OLE drag-and-drop protocol. See Transferring Shell Objects with Drag-and-Drop and the Clipboard[^] for some basic information and pointers on how to register for OLE drag-and-drop.
|
|
|
|
|
To start my internal net is 100mbit.
I need to read a lot of data ( couple of Gigs ) over the net very frequently.
So I need a program that copies the data and I want to go as fast as possible.
If I copy the files over FTP I get over 10MB/s in transfer speed and task manager shows network usage at 98-99% witch is really great. But I don’t want to use FTP.
I want to read the file from a network share.
And if I do, I only get like 6.5MB/sec so I made my test program to read/write threaded.
Triple buffers and read/write at the same time and stuff. And now I get like 7-7.5 MB (not much of a performance gain)
Anyway network usage only gets up to about 56-59% if I read from network share. I tried reading with different chunk sizes but did not make any difference.
If I copy the file with windows drag'n'drop I get also low speed but a little better, network usage of 62%
I understand that doing a lot of readfile(...) and stuff will generate more io request then receiving data over FTP. But should it really drop so much.
Anyone have any idea of why I can’t get close to 100% network usage when reading from a network share?
/Mathias
|
|
|
|
|
The problem depends on the design and implementation of the actual application.
Kuphryn
|
|
|
|
|
Hi.
The callback function is called when it receives some data. But it receives huge amount of data that requires a lot of time to copy. So I want to put this function to some thread. How to do this? I tried to inherit some class from CWinThread :
class MyThread : public CWinThread
{
.....
void SomeCallBack(...);
}
then MyThread m* = new MyThread; m->CreateThread();
but the thread creates and then completed. Why?
How to solwe my problem(how to create thread class that finished existence when I need)? Please, send example if it is possible.
Thankful in advance.
|
|
|
|
|
snmail wrote:
but the thread creates and then completed. Why?
Does the newly created thread do anything? Just curious, but why aren't you using AfxBeginThread() ?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
There are several solutions including AfxBeginThread() and __beginthreadex(). Post the code in the thread. I suspect that the thread callback function does nothing and just returns.
Kuphryn
|
|
|
|
|
Is there a tool/software that will parse my existing C++ classes and produce a diagram (drawing) of the class/objects hierarchy?
|
|
|
|
|
UML Studio from http://www.pragsoft.com/ is actually quite good. You are allowed to evaluate it before registering/paying too. However if I had VC7 with everything then I would use Visio.
|
|
|
|
|
Visio does, but it's not free
|
|
|
|
|
|
Absolutely! Use Doxygen - it's fast, flexible, and free! It rocks!
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I was not very clear in my first post, so let me clarify here:
Say I have 4 classes, CBiggestObj, CBigObj, CSmallObj1 and CSmallObj2 and the code looks like this:
class CBiggestObj : public CDontCare
{
CBigObj m_bigobj;
}
class CBigObj : public CWhatever
{
CSmallObj1 m_obj1;
CSmallObj2 *m_pobj2;
}
I need some software that will show me visually (with balloons and
arrows, like in a diagram) that CBiggestObj has a member CBigObj object and that CBigObj has 2 members, an object of CSmallObj1 and a pointer to a CSmallObj2. I don't need to know where the classes are inherited from.
|
|
|
|
|
Yep, Doxygen will do that for you. Be sure to install the (free) Graphviz package that draws all the pretty diagrams.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|