|
Maybe you should switch into virtual list mode (LVS_OWNERDATA style) - you'd keep the strings in your own data structures and list would notify you that it needs repainting. You could even move message retrieval/storing into separate thread.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I currently have the message retrieval in a separate thread. I have reservations about changing the structures being used; the application currently works and has gone through the testing process and a structural change would mean more retesting time than is allotted for the project.
If you know of any other way, I would really appreciate it. I was kinda hoping that you would tell me about the little known "StopFlickering()" method.;)
Thanks a lot.
|
|
|
|
|
I'm trying to draw the caption of a dialog myself, but windows keeps painting the button on the caption bar.
Kilowatt said I had to put SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); in the WM_NCACTIVATE handler, but adding that doesn't work with me.
Probably I made a stupid mistake somewhere, or I forgot some obvious code, but simply adding the above code doesn't do anything at all. (SetWindowLong returns 0, when hDlg == m_hDlg)
[edit]
I forgot to mention that I return TRUE in WM_NCACTIVATE
[/edit]
What can I possibly be doing wrong, please help me.
Thanks a lot in advance!
|
|
|
|
|
What are you using to develop your code? MFC, SDK, WTL I will post an example.
Also, what exactly are you trying to accomplish, do you want to custom color the caption with different text and whatnot.
Are you trying to custom draw the buttons in the corner?
|
|
|
|
|
An example would be great! thanks!
I'm using MFC, I need to change the hight of the caption, and therefore I need to paint it myself. Also I'm thinking about moving/drawing the buttons, but that's not as important.
I think that covers about it, and again thanks.
|
|
|
|
|
See this article.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I read that article, but it didn't help me...
Only the caption of a CView is modified in that example, it's a bit different for a CDialog.
Thanks anyway
|
|
|
|
|
I do not have very much time, so here is a code snippet from a WTL dialog example, you should be able to simply translate teh code to MFC. This will not repaint any custom parts, however it will prevent any portion of the borders and caption from being painted.
LRESULT OnNCActivate(UINT , WPARAM , LPARAM , BOOL& )
{
::SetWindowLong(m_hWnd, DWL_MSGRESULT, FALSE);
return TRUE;
}
LRESULT OnNCPaint(UINT , WPARAM , LPARAM , BOOL& )
{
return TRUE;
}
|
|
|
|
|
Thanks for your reply.
I translated this part to mfc, with this as result:
LRESULT CAnothertestDlg::OnNCPaint(WPARAM wParam, LPARAM lParam)
{
::SetWindowLong(m_hWnd, DWL_MSGRESULT, FALSE);
return TRUE;
}
LRESULT CAnothertestDlg::OnNCActivate(WPARAM wParam, LPARAM lParam)
{
return TRUE;
}
This is pretty much the same as what you told me before and I still don't get it working.
I'm getting pretty desperate to get this working....
|
|
|
|
|
You have the examples backwards. it should be like this.
LRESULT CAnothertestDlg::OnNCPaint(WPARAM wParam, LPARAM lParam)
{
return TRUE;
}
LRESULT CAnothertestDlg::OnNCActivate(WPARAM wParam, LPARAM lParam)
{
::SetWindowLong(m_hWnd, DWL_MSGRESULT, FALSE);
return TRUE;
}
please run this and let me know what you see. You should see a window where the borders and caption never get painted. The minimize and maximize buttons will however still be painted.
By the way, the custom caption article that somebody else posted loks pretty good, teh key to making this work in the dialog is the SetWindowLong call in WM_NCACTIVATE.
|
|
|
|
|
Sorry, that was a typo, I compiled it with SetWindowLong in the other handler.
The SetWindowLong line doesn't make a difference, nothing happens at all. (at least nothing directly visual) Even without the SetWindowLong call the borders of the NC area aren't painted at all.
The border doesn't get painted, but that didn't happen in the first place, my problem was that not only the buttons were painted, but a small area around the buttons too, and there is a line drawn that seperates the client and the non-client area.
If I don't make a handler to NCACTIVATE at all windows paints the NC area as soon as it looses focus, otherwise not.
Maybe I didn't make myself entirely clear, but I would like windows to paint nothing at all outside of the client area, as windows refuses to draw the button without background.
Heh, this isn't as easy as I thought it would be, even explaining a simple problem can be quite hard.
|
|
|
|
|
Hi,
What is my trouble?
I would like to make ActiveX componet with more controls.
Something like child dialog - usable like ActiveX.
(like Calender in Windows) = one ActiveX,
for example with few Buttons, some Edits and so on.
(I don't need to resize it, just put it on some place.)
I am not ActiveX expert, and I don't know how to start...
Does anybody know how to start or some nice sample what should help me?
(Visual C++ and MFC will be welcome.
Thank you.
Viliam
|
|
|
|
|
The ATL appwizard will allow you to create a composite control.
I'm not sure if it supports MFC though.
Michael
|
|
|
|
|
When I've had to do this, I've created a simple ActiveX control, that draws nothing in it's OnPaint/OnDraw handler. Then, in it's OnCreate, create a child window with all of its associated controls. In the OnSize handler for the ActiveX control, simply resize the single child window.
There are more issues associated with this (such as checking for ambient background colour and TAB order) but this should give you a start.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
I'm having a similar kind of problem (see earlier thread). I want an ActiveX control that contains two tree controls, but I can't get it to display anything.
Like you've said my OnDraw handler is empty and I'm creating the trees in OnCreate, but still nothing
Any ideas?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
OK, here's some code I've pulled out of my ActiveX control:
void CMyControl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
if (m_ctrlDictSel.GetSafeHwnd())
{
if (m_tRect != rcBounds)
{
m_ctrlDictSel.MoveWindow(rcBounds, TRUE);
m_tRect = rcBounds;
}
else
{
m_ctrlDictSel.Invalidate(TRUE);
}
}
else
{
pdc->FillRect(rcBounds, CBrush::FromHandle((HBRUSH)GetStockObject(WHITE_BRUSH)));
pdc->Rectangle(rcBounds);
pdc->MoveTo(rcBounds.left, rcBounds.top);
pdc->LineTo(rcBounds.right, rcBounds.bottom);
pdc->MoveTo(rcBounds.right, rcBounds.top);
pdc->LineTo(rcBounds.left, rcBounds.bottom);
}
}
Are you sure your trees are being created correctly? In my OnCreate handler, all I've got is a call to m_ctrlDictSel.Create(...).
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Thanks for the code. I've actually got it sorted now. Nothing was showing up because I didn't have any items in the tree controls
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Hi, hope someone can help me.
I have placed a handful of controls (CEdit, CComboBox etc)in the main window of a CView based app. Everything works fine except, despite including the WS_TABSTOP windows style in the control CREATE function, tabbing does not work.
I'm not coming up with anything useful from the Library.
Has anyone come across this problem..and if so, how is it resolved.
Thanks in anticipation
Jim
Sonork ID: 100.13715 - 3bananas4
I have detailed files
|
|
|
|
|
WS_TABSTOP will work only if you host your control in a dialog - so for 'free' tabstops' you'll need to use CFormView (which is a dialog).
If you plan to keep CView, you'll have to check for WS_TABSTOP (in PreTranslateMessage, for example) and change the focus.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi,
I wonder, how much bytes or kilos will add to my ATL DLL file to include this handy header...
If I want to make a light weight component is a good idea to use it ?
Thanks, Bye !
Braulio
|
|
|
|
|
Hello Braulio:
As I know,adding some header files does not effect on size or performance of component so much.
I used ATLControls.h one time and I remember the realease version of component still very small.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Can I build an ActiveX that gives you ability to translate from one language to another language.
Hung Son
|
|
|
|
|
ActiveX can do everything,But for this purpose I don't think it is good idea to write it as ActiveX because the size of your ActiceX will become so huge(I can't imagine how much) and it caused very bad performane.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
But that's an exercise which my teacher give us !
Hung Son
|
|
|
|
|
You could use an ActiveX control to get the input and display the translated output. Using the ATL Appwizard is a good start. A composite control would probably be your best bet.
It would probably be better to build each seperate language as a COM server that could be called from your ActiveX control.
Michael
|
|
|
|