I have splitted my Application window into two using createWindowEx().Now i have two windows...In my First window I need to display images as list of thumbnails,In another window i need to view the image as user selects the particular thumbnail from the first window.
My Question is How to display multiple images in a single window as thumbnails.
How to do this using only Win32API and c++.
You Have both given me Good idea about how to do this..
Can You also Explain me about the Following Questions:
Things I want to get clear:These Question may be silly but i need to get clear to proceed in my work since i am newbie in Win32api.
For Win32API I usually refer through the book "Programming Windows" by Charles Petzold.
But i couldnot find any information regarding about ListView control and Static Control so i have doubt whether it is Contained in win32api,because i should not use MFC concepts.
Q) Whether ListView Control and Static Control is contained in Win32API(i.e Whether it is Pure Win32api) because i am working in my project using win32api and c++.
Q)What is Resource Script Files(i.e resource.h and .rc files) whether we need to create and make use of resource files in order to use ListView Control and Static Control to create images and Displaying it in thumbnail window.this question i asked because this thumbnail window is like one of the user interface controls.
Q) What is ComCtl32.dll and what is its use.
Answers to these questions could Help me to Proceed.
I guess Mr. Petzold didn't feel the need to cover them all in his book.
2) The rc file basically describe the resources you want embedded in your EXE or DLL. Resources are things like bitmaps, icons, cursors, strings, and menus. You would use bitmap or icon resources for toolbar buttons and menu item images, for example.
You probably don't want to use resources in your case since I assume you want to display any images on disk and not just a specific set of images.
Resources are essential in large applications so you probably want to learn more about them at some point. This might be a good starting place:
Thanks knn9.You have given me clear explanation.
can you also explain me the following Questions
Is it possible to create ListView control and Static control for displaying List of Images in Thumbnail Window and Viewing it in Viewer Window without using Resource Script Files.
I have this doubt because Both ListView control and Static control uses WM_COMMAND message.
I ask this Question because Images are going to be selected by user(as this can be one of the UserInterface)
I have followed the Steps that you have suggested here:
one more doubt I have is:
do we need to have Listview control window for creating a ImageList control in it or can I use a normal window using CreateWindowEx without specifying WC_LISTVIEW?
1)I created ListView Window using CreateWindowEx(specifying WC_LISTVIEW)
2)For creating ImageList i Used ImageList_Create()
3)For Adding Images i used ImageList_Add()
4)For Drawing Images in it i used ImageList_Draw()
Now i need to apply some styles that will make ImageList looks like Adobe Reader Thumbnails,I should also highlight the selected image from the list.(i.e Like Adobe Reader Thumbnails exactly).
Please Suggest me how to achieve this.
Listview control is the window it contains listview item and iimages are created using Imagelist that have been placed Listview control(i.e subitems contain images)
But LVM_GETITEM gets the item index but the Imagelists are placed inside Listview item this means i need to get the subitem index of the item(i.e the image placed in listview item)
my code is :
case WM_NOTIFY :
According to the documentation for the LVITEM structure:
Index of the item's icon in the control's image list. This applies to both the large and small image list. If this member is the I_IMAGECALLBACK value, the parent window is responsible for storing the index. In this case, the list-view control sends the parent an LVN_GETDISPINFO notification code to retrieve the index when it needs to display the image.
So, you have to store the image index yourself and provide it when requested via LVN_GETDISPINFO.
1. I have a function called "populate_thumb_nails" which will create thumbnail images using ListView and ImageList control using below code.
2. There is no issues if I call this function from WM_Create in Windows 8 but in XP machine it's not creating thumbnails (Blank white background appearing).
3. To solve this I tried to call "populate_thumb_nails" function from WM_Paint in XP... its seems like working but thumbnails redrawing recursively.
4. Pls clarify my below doubts and suggest
1. Whether shoud I call this "populate_thumb_nails" function only once in WM_Create or should I call also in WM_Paint?
2. I have added two images in ImageList using "ImageList_Add() function but only one image has drawn instead of two.
if I did any mistake in code pls point it out.
//This will create thumb window and register the win proc for that window.
CreateWindowEx(WS_EX_WINDOWEDGE, className.c_str(), winName.c_str(),
WS_CHILDWINDOW | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL,
0, 0, (int)thumbnailWndSize.iWidth,
(int)thumbnailWndSize.iHeight, hParentWnd, NULL, hInstance, NULL ); //successfully created
//this is the corresponding window proc
LRESULT CALLBACK wnd_proc_thumbnail(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_CREATE :
return populate_thumb_nails(hWnd); //this function will create thumbnails using ListView and ImageList controls
return populate_thumb_nails(hWnd); //to solve xp issue denoted in point 2. is this preferred solution?
case WM_NOTIFY :
return DefWindowProc(hWnd, uMsg, wParam, lParam);