|
Your columns probably get created with a size 0. So as suggested debug your code and watch the nColInterval variable.
Or try creating the listctrl with hard coded values for the nColInterval:
<br />
m_wndListCtrl.InsertColumn(0, _T("Item Name"), LVCFMT_LEFT, 100);<br />
m_wndListCtrl.InsertColumn(1, _T("Value"), LVCFMT_LEFT, 100);<br />
m_wndListCtrl.InsertColumn(2, _T("Time"), LVCFMT_LEFT, 100);<br />
If this works you know its the size parameter
Good luck
|
|
|
|
|
I'm building a service that uses named pipes, and I want the connectnamedpipe to return immediately a connection occurs, or to timeout after a period of time.
Is it best to
A) set the timeout period vey small, and be continuosly looping/waiting for a client to connect. THis was if I signal the service to stop, at the end of the loop, I can just bail out.
B) set the timeout period to quite high, and from the main thread, if I want the service to stop, I signal the event that the Connectnamedpipe is waiting on. And then bail, BUT the signal looks just like a client has connected.
I've looked at the PJNaughter articles, but none of these deal with Overlapped operation.
Are there any other options that I may be missing??
|
|
|
|
|
Doesn't matter, found this excellent article
http://www.codeproject.com/win32/overlappedio.asp
|
|
|
|
|
Hello,
I am using VC++ .Net Standard on Windows XP Professional, and I have just
written an application for which I now want to create HTML Help. To
shortcut the procedure I have generated another new application with the
application wizard, including the help files. I now want to cut these files
out from the wizard application, and put them into my original app, where I
can develop them.
I have noted that in the .Net IDE, in the Solution Explorer, there are
supposed to be two sections in the tree for HTML Help: one for the project,
contents and index files, and then one for all the help topic .htm files.
But I can't seem to add the help project to my current app so that all the
files are correctly analysed. If I do Project -> Add Existing Item, the
files are not put under the HTML Help section. Come to that, I can't seem
to create the HTML Help section in the Solution Explorer.
I would be very grateful for hints on how to add a complete help project to
an existing app, so that it appears correctly, and runs as it should.
Thanks,
Trimtrom
|
|
|
|
|
Hi,
I'm kind of new to MFC so I really hope this isn't a stupid question. Anyway I have some code which basically declares a member function for message mapping as:
afx_msg void DoSomething (BOOL bVar = TRUE);
With the corresponding in the cpp file:
ON_BN_CLICKED(IDC_DOSOMETHING, DoSomething)
Now this compiles fine with VC6 but with VS.Net I get a compile error about not being able to do a static_cast and I was wondering if some behaviour about mapping to functions with arguments has changed in MFC 7. The ON_COMMAND macro gives the same error. So I've changed the code and I think it's better now but I wonder if I was just doing it wrong (bad style) all along or if this change caught many people off gaurd.
Thanks.
|
|
|
|
|
You should not have a parameter in the command handler. All command handlers must take the form afx_msg void OnSomeCmd(); VC.NET has better compile-time checking of these macros, so that's why it reports the error.
Dave
|
|
|
|
|
Dave Bryant wrote:
You should not have a parameter in the command handler. All command handlers must take the form afx_msg void OnSomeCmd(); VC.NET has better compile-time checking of these macros, so that's why it reports the error.
Dave
Thanks Dave. That's what I suspected but I just wanted to make sure I was doing it wrong all along.
|
|
|
|
|
Hello.
Does anyone know how can i retrieve window area that closed by other window.
Ex:First window is a calculator and second window is "Registry Editor" ,and "Registry Editor" is partialy on top of the calculator.
I need to retrieve the area of the calculator that is currently under the "Registry Editor".
The area that the user is not seeing because the "Registry Editor" is on top of it.
Thank you.
|
|
|
|
|
I think you can use GetWindowRgn() to get the region that corresponds to the window's visible portion.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
|
I wrote my own handler for OnCommand in my CDialog class. In it I I did this:
if (LOWORD(wParam)==IDOK && lPAram==0)
{
CWnd* p = GetFocus();
if( *p == m_combo)
{
stuff
}
return OnCommand etc
}
When I hit enter after entering some text in the editpart of the combobox, and try to debug, the code never goes into the if (*p block....
How do I fix this? What am I doing wrong?
Appreciate your help,
ns
|
|
|
|
|
You need to compare HWND s, not CWnd objects.
if ( p->GetSafeHwnd() == m_combo.GetSafeHwnd() )
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Which comes first, the bug or the stress?" -- Chris Maunder
|
|
|
|
|
Thank you!
Appreciate your help,
ns
|
|
|
|
|
Well,
I did compare the safeHWnds like you said, but it still never says they are equal and never goes into the if. What I want to do is do something after I hit enter in a combobox edit part. SO I was overriding OnCommand:
OnCommand(..)
{
if(LOWORD(wParam==IDOK &&lParam ==0)
{
CWnd* p = GetFocus();
if ( p->GetSafeHwnd() == m_combo.GetSafeHwnd() )
{......
<code> never goes in here when I hit Enter in combo</code>
}
}
}
Appreciate your help,
ns
|
|
|
|
|
On My CDialog I have a CListCtrl and a combobox. When I click on an item in the listCtrl, in the OnItemChanged handler I put in m_combo.SetFocus().
Now while I am holding the selection down in the listCtrl, the focus cursor blinbks in the editbox part of the combobx. As soon as I let the mouse go, the focus shifts back to the listCtrl where the selection I just made gets highlighted. How do I keep the focus on the combo?
Appreciate your help,
ns
|
|
|
|
|
Try replacing the m_combo.SetFocus() in the OnItemChanged() handler with PostMessage (WM_COMMAND, CMD_SET_FOCUS_TO_COMBO) . Then write a handler for the hidden CMD_SET_FOCUS_TO_COMBO command which simply does m_combo.SetFocus() .
This should allow the OnItemChanged() to complete normally and then cause focus to be set to the combo box.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
|
Damn, it feels good to be hacking again.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I tried your slick trick, but couldnt convince the focus to stay put. It momentarily flickers in the editpart of the combo but then returns to the listctrl and highlights the item I selected....
Appreciate your help,
ns
|
|
|
|
|
Try calling GotoDlgCtrl (GetDlgItem (IDC_MyCombo)) .
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
stubborn thing - still no luck! Thanks for trying though.....
Appreciate your help,
ns
|
|
|
|
|
Does anyone know if it is possible to place the vertical scrollbar within the tree control on the left-hand side of the window, rather than the right (while still displaying left-to-right text)?
Dave
|
|
|
|
|
I don't know if it's possible to retrieve the scrollbars provided by the tree control to set the SBS_LEFTALIGN style (I once read a discussion about, but I don't remember the conclusion...)
However, you could always do the following:
a) make the tree control big enough to be without scroll bars (you need to calc the "ideal height" for it anyway - but that's no big problem)
b) create your own scroll bar with SBS_LEFTALIGN
c) set the correct clipping style for the parent (I think it should be WS_CLIPCHILDREN)
d) handle the scroll events by moving the tree control's y position
e) Handle selection changes correctly, so the selection is always inside the tree
---
f) TVM_GETITEMRECT will prove invaluable for all these tasks
g) if you expect a horizontal scrollbar as well, you should implement it on your own in a similar way. it looks dead ugly otherwise
Yeah, a lot of work (and I don't really see the benefit of an left-aligned scrollbar over it's "non-standardness". But you decide )
If you go to war, you will destroy a great country a stoned greek chick to the richest man of the world
sighist | Agile Programming | doxygen
|
|
|
|
|
I didn't think it was easy...
The reason i wanted one was because i have two tree controls next to each other and i'm drawing lines between them - the scrollbar is sort of in the way.
Dave
|
|
|
|
|
I need to redistribute SAPI5.1 speech files [^]for my program (OS's other than XP).
It looks like I can only use the .msm files.
In plain english (MSDN was no help to me) how do I deploy these files with my app setup?
I am currently using InnoSetup[^] 3.0
But does this mean I must use Visual Studio Installer?
and if so, does it automatically install the .msm files?thanks, this is all new to me.
Later, JoeSox www.joeswammi.com It's not easy facin' up when your whole world is black Rolling Stones
|
|
|
|