I still don't know how to achieve this. Any help is very appreciated! Thanks in advance, Sebastian
------------------------------------------- My website: http://www.hartwork.org
I still don't know how to achieve this. Any help is very appreciated! Thanks in advance, Sebastian
------------------------------------------- My website: http://www.hartwork.org
In case you still need help: I recommend reading this article which answered all my questions on arrays in the past. Statically- and dynamically-allocated arrays are stored differently - keep this in mind and it will help you to find the solution to your problem. Good luck, Sebastian ------------------------------------------- My website: http://www.hartwork.org
No. The problem is the width can be much more than the text in it actually needs. If I want to center the checkbox I need the width of what the user sees, not the width of the window rect. Best regards, Sebastian ------------------------------------------- My website: http://www.hartwork.org
Btw in case you are the author of SpeedLoad - good work! :-D ------------------------------------------- My website: http://www.hartwork.org
This is it! It works! I'm so happy - Thank you very much! Best regards, Sebastian ------------------------------------------- My website: http://www.hartwork.org
More searching taught me that SM_CXMENUCHECK
and SM_CXMENUSIZE
seem to be what I was looking for. So my new problem is how do I tellGetTextExtentPoint32
to work with the new font and not the default one. Here's my code:
const TCHAR * const szNeverAgain = TEXT( "Do not ask again" );
SendMessage( hNeverAgain, WM_SETFONT, ( WPARAM )GetStockObject( DEFAULT_GUI_FONT ), ( LPARAM )TRUE );
const HDC hdc = GetDC( hNeverAgain );
SIZE size;
GetTextExtentPoint32( hdc, szNeverAgain, _tcslen( szNeverAgain ), &size );
ReleaseDC( hNeverAgain, hdc );
size.cx
is always the width for the old font. I need the new one - any ideas? ------------------------------------------- My website: http://www.hartwork.org
I have a button with BS_CHECKBOX
style and text. I want to center the checkbox with my dialog so I need to get the "real" width of the control (Checkbox + gap + text = full width). I know how to get the width of the text part but how do I get the width and height of the checkbox itself? I looked at GetSystemMetrics
and SystemParametersInfo
but didn't find any. Any ideas where to look at? The width of the gap between is also needed. I need a plain WinAPI solution that works on all versions of Windows (not XP only). Thanks in advance, Sebastian ------------------------------------------- My website: http://www.hartwork.org -- modified at 1:03 Sunday 5th March, 2006
SetScrollInfo
doesn't seem to help either. even GetScrollInfo
fails. please let me know if you find a way to make it work. best regards, sebastian ------------------------------------------- My website: http://www.hartwork.org
when my list view control (report mode) has too few items the vertical scrollbar is disappearing. i looked through these MSDN pages List-View Window Styles Extended List-View Styles Window Styles Extended Window Styles but i didn't find a style helping me to make the scrollbar stay. i'm using plain winapi, no MFC, no WTL. does anybody know how to solve this? thanks in advance, sebastian ------------------------------------------- My website: http://www.hartwork.org -- modified at 13:09 Friday 24th February, 2006
i'm really not sure at all but i think LGPL code in combination with a closed source project is possible. at least i got a probably promising pointer for you: there's a whole chapter called "The GPL, LGPL, and Mozilla Licenses" in the free openbook from o'reilly: >> Understanding Open Source and Free Software Licensing / Chapter 3 best regards, sebastian ------------------------------------------- My website: http://www.hartwork.org
i'm not sure if it got you right but i guess number 2 is what i meant i'll try again with more details: my column contains numbers from 1 to 4000. when the current view is at the very top you can only see numbers with one or tow digits. applying LVSCW_AUTOSIZE
now sets the size to two digits not four since the big number are out of view and ignored. maybe i should mention my column header has "#" as title so it is even shorter than the numbers. i'm not sure what happens if the header text is longer than all the row text. i'm using the control in virtual/getdispinfo mode maybe that's also playing in here!? btw i had trouble with two-digit numbers shown as "1..." so the current text width code is
const int iWidth = res ? ( int )( size.cx * ( _iDigits + 0.25f ) ) : 120;
i hope i put it clearly. i'm not a native speaker. best regards, sebastian ------------------------------------------- My website: http://www.hartwork.org
funny we are working on the same thing at the same time. i found a function calculating the width of a string on MSDN. the column here contains numbers only so my code is
HDC hdc = GetDC( _hView );
SIZE size;
BOOL res = GetTextExtentPoint32( hdc, TEXT( "0" ), 1, &size );
ReleaseDC( _hView, hdc );
const int iWidth = res ? ( size.cx * _iDigits ) : 120;
this function can be still helpfull when you want to size for the largest string of all, not just the visible ones (which LVSCW_AUTOSIZE
does). also i found out you can size the last column to take as much space as possible without adding the horizontal scrollbar (unlike LVSCW_AUTOSIZE_USEHEADER
):
RECT r;
GetClientRect( _hView, &r );
const int iWidth = ListView_GetColumnWidth( _hView, 0 );
ListView_SetColumnWidth( _hView, 1, r.right - r.left - iWidth );
best regards, sebastian ------------------------------------------- My website: http://www.hartwork.org
thanks for you quick reply! i am using LVM_GETNEXTITEM
now. i stumbled over the line "The specified item is itself excluded from the search" on MSDN, and modified my code so it works with top-down deletion:
iWalk = SendMessage( _hView, LVM_GETNEXTITEM, iWalk - 1, LVNI_SELECTED );
------------------------------------------- My website: http://www.hartwork.org
thanks for your quick reply! i overlooked LVM_FINDITEM
somehow... DavidCrow suggested LVM_GETNEXTITEM
instead: i compared these two and LVM_FINDITEM
seems more powerful so expect more speed from LVM_GETNEXTITEM
. also thanks for the tip on redrawing! ------------------------------------------- My website: http://www.hartwork.org
i'm using plain winapi and i'm trying to find out which items are selected in a multi-selection listview window. i need this for "remove all selected items" functionality. (1) i could walk down all items and check if an item is selected. but that would take very long with big lists (linear time) (2) i could also track selection changes inside the window procedure but i guess this would slow down selecting/unselecting items noticebly. also it would be a lot of extra coding. isn't there some easy, fast and elegant way to get a list of all selected items? a listbox provides a message for this - listview does not? please help! thanks in advance, sebastian ------------------------------------------- My website: http://www.hartwork.org
i don't know of a funtion doing this but have you tried using a global mousehook? are you familiar with window hooks? i copuld imagine catching WM_SETCURSOR will do this but i'm not sure. some links: WM_SETCURSOR SetWindowsHookEx() MouseProc() good luck! ___________________________________________ http://www.hartwork.org