|
How can I get the column count of a list control ? By functions is good as by message !
Ex: I can get the row count with GetItemCount(), LVM_GETITEMCOUNT,
but there is no GetColumnCount, LVM_GETCOLUMNCOUNT ?
Hung Son
A Vietnamese student
i-g.hypermart.net
dlhson2001@yahoo.com
|
|
|
|
|
Use List View Header Control GetItemCount to fetch the number of columns.
CHeaderCtrl * pMyHeaderCtrl = MyListCtrl.GetHeaderCtrl();
ASSERT(pMyHeaderCtrl != NULL);
int nColumns = pMyHeaderCtrl->GetItemCount();
Hth,
Ramu
|
|
|
|
|
Hey, I never understood it when implementing OnMeasureItem in ownerdraw menus how to calculate width. Height is easy since ::GetSystemMetrics(SM_CYMENU) is available. In most textbooks I've seen they just take the height (::GetSystemMetrics(SM_CYMENU)) and multiply it with some magic number, like 4. In other examples i've seen the following: ::GetSystemMetrics(SM_CXMENUCHECK) * 5. Is there some easy way or is the correct way to count the number of pixels you need and use that for itemWidth in the MEASUREITEMSTRUCT?
Thanks, Patric
|
|
|
|
|
When you open explorer, then the column that the items are sorted after has an arrow after the column title telling whether the sorting is ascending or descending. Can i add such an arrow in my listview control?
|
|
|
|
|
time to get yourself a copy of the MSDN, or visit www.microsoft.com. this answer to this question (and most of your others) is right there waiting for you...
but, what you need to do is to pass an HDITEM struct to the header control (which is a child of the list control). the HDITEM has flags that you can use to turn on that arrow.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Yes, there are several articles available that show you how.
If you are targeting Windows XP (or greater), the HDF_SORTDOWN and HDF_SORTUP styles/flags may help you.
Peace!
-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
[Get Check Favorites 1.4 Now!]
|
|
|
|
|
Where should i set those flags? WHen i use them the compiler says unknown identifier. As far as i can see i use them for the header control. But, isn't it possible to use the properties in my List COntrol?
|
|
|
|
|
You set those flags in the HDITEM structure which is used to directly manipulate Header Control items. You can get the Header Control from a ListView Control by sending it a message (or using CListCtrl::GetHeaderCtrl() ).
The reason they are showing up as undefined identifiers is because you have to set your _WIN32_WINNT and WINVER identifiers to the correct values before including any Win32 header files. You will also need to have an updated installation of the Platform SDK.
If your app is going to be running on other version of windows besides XP, you should really take the Owner Draw aproach: it is not that hard, and there are some existing articles that will walk you through it.
Peace!
-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
[Get Check Favorites 1.4 Now!]
|
|
|
|
|
Yes. You can add your own image in the list control header.
An image (up or down) has to be custom drawn on subclassing list view header control. And you have to keep track on upside or downside arrow. There are examples avaiable on net. below URL example works fine for me
http://www.codeguru.com/listview/indicating_sort_order.shtml
Hth,
Ramu
|
|
|
|
|
Help!
I have an MFC SDI application. A splitter window defines two panes. On the left contains a CHtmlView. On the right contains a simple view for drawing images. How do I modify this application so that it can be instantiated inside Internet Explorer such that the CHtmlView uses the IExplore's webcontrol? Any pointers would help. I have looked already into two ideas: make MFC SDI into an Active Document Server or convert the MFC SDI into an ActiveX control. Are these the only ways?
|
|
|
|
|
If your application
- is tightly integrated with IE then you may opt for ATL/WTL based application.(this will give high performance)
- is a standalone application and IE plugin, then activex control.
- needs just the url or some simple information...MFC SDI should will do good.
If you are intrested only in MFC, then choose MFC document server.
You want both MFC windowing and ATL, then add ATL component to MFC SDI project.
Let us know where your application falls in ???
Thanks,
Ramu
|
|
|
|
|
I think I am faced with a very common problem. I need to exchange Data Between VB and C++ through a DLL. I have been successful in everything but (UDT's with Fixed Length Strings) and (UDT's with Variable Length Strings). I have tried many different things including using a typelib (exchangeable between VB and C++) and various packing (#pragma pack(1)) problems. Has anyone had success with this before. I am only passing the array by Reference from VB./
Ryan Baillargeon
Software Specialist
Fuel Cell Technologies Inc.
|
|
|
|
|
Hi.
I will begin work on a feature in a program to do a search on search engines such as Google and Yahoo. For example, the user will type in whatever phrase he/she wants such as "race & cars," and the program will do a search via Google and print the responses.
I am not sure what message I need to send and where to send it if I want to search from, for example, Google. Do I send this:
// "http://www.google.com/search?hl=en&lr=&ie=UTF8&oe=UTF8&q=race+%26+cars//
I pasted the code above directly from the URL when I did a search at Google.
Secondly, what data will the search engine return? For example, the search above came back with more than ten pages at Google. Will Google send back all pages or one page at a time?
Please add if you have any experience dealing with search engines and/or communicating with websites in general.
Thanks,
Kuphryn
|
|
|
|
|
man,
you can automate the process via microsoft Web Browser control...
just accept the serch parameters from your GUI and searches through that..and show all the pages ..user will chose from which of them are want to print..
Renjith-The CPian.
|
|
|
|
|
|
how can i store a bmp(actually the data of dat bmp i.e its colors ) of type COLORREF in an array.
looking forward from all the gurus of code
|
|
|
|
|
try searching on google for info on the bitmap format.
|
|
|
|
|
Hello, I have added a custom bitmap to the MS Word Toolbar to allow my application to save the information and exit MS Word. But I cannot find any document on what I need to do to figure out if my custom button has been pressed. Can anyone give any guidance on this? If the user presses my button, how will I know it? Things were going good up to this point...
|
|
|
|
|
Sink the button events(Office::_CommandBarButtonEvents) to handle the button clicks.
Steps:
1. Inherit Add-in from IDispEventImpl<1, Office::_CommandBarButtonEvents>
2. Call (myCookie = ) DispEventAdvise(m_spButton) after button is created.
3. Implement Event Callback for OnClick - SINK_ENTRY(1, 1, OnClick)
4. Call DispEventUnadvise(myCookie) when button goes out of scope.
check out similar outlook sample @ http://www.codeproject.com/com/outlookaddin.asp
Hth,
Ramu
|
|
|
|
|
Hi everybody,
Encountered a strange problem. When started, my application reacts properly on task bar events - it can be minimized by clicking on its task bar icon, and restored when the button is clicked again. But after I load a file into the app, the program will not minimize by task bar button, though the caption color changes to inactive. If I click on the caption, or use system menu to minimize the program, or just open the system menu, the normal behavior of task bar button is restored. Setting breakpoint in syscommand handler, I see that when the taskbar button is working correctly the program gets SC_MINIMIZE/SC_MAXIMIZE. After loading a file, it does not. Any idea on possible reason?
Thanks,
Yuri
|
|
|
|
|
If you are using MFC, make sure you are not dealing with taskbar icon in CMyDocument::OnNewDocument() or CMyDocument::OnCloseDocument() or CMyDocument::DeleteConetents(). Its better to handle taskbar add/remove operations in CWinApp derived class.
Just some wild guesses
Hth,
Ramu
|
|
|
|
|
Ramu Pulipati wrote:
If you are using MFC, make sure you are not dealing with taskbar icon in CMyDocument::OnNewDocument() or CMyDocument::OnCloseDocument() or CMyDocument::DeleteConetents(). Its better to handle taskbar add/remove operations in CWinApp derived class.
I do not actually handle any of taskbar events explicitly, nor I use tray icons. This is just regular taskbar button that does not work...
Thanks,
Yuri
|
|
|
|
|
Any idea, what is the best way to automatically implement opening last opened document in SDI ?
1. It's name is stored in registry under key ....\Recent File List\File1, but isn't there best way to get it from MFC ? ( i couldn't find any object's method for that)
2. where to place code for opening document ? CDocument::OnNewDocument() ? C..App::InitInstance() or somewhere esle ? How to open file in CDocument ?
Thanks
rrrado
|
|
|
|
|
Use InitInstance(), since this is the function which should be used for application startup.
Replace 'ParseCommandLine(cmdInfo);' in CMyXXXApp::InitInstance with
if(m_pRecentFileList->GetSize())
{
cmdInfo.m_nShellCommand = CCommandLineInfo::FileOpen;
cmdInfo.m_strFileName = (*m_pRecentFileList)[0];
}
Do a include of afxadv.h at the top.
Hth,
Ramu
|
|
|
|
|
This seems to be good idea,thank you, i'll try this
rrrado
|
|
|
|