Software-OK
≡... News | ... Home | ... FAQ | Impressum | Contact | Listed at | Thank you |

  
HOME ► Faq ► FAQ - Windows-CPP-und-C ► ««« »»»

Listview set thumbnails size!


You can quickly set the size of the thumbnails in the list view, and there are no restrictions on the size!!



 

This example demonstrates using the CreateNewImageList function to create an ImageList and associate it with a ListView control. You can then add images to the ImageList and display them in the ListView control. Please note that creating and sharing the image list, as well as adding images, is not fully implemented in this example; you will need additional functions and steps in your application.





// This function creates a new Imagelist
// and associates it with a Listview control (m_hWnd).
 
HIMAGELIST CreateNewImageList(HWND m_hWnd, int cx, int cy) {
 // Set flags for configuring the Imagelist.
 UINT uFlags = ILC_COLOR32 | ILC_MASK;
 // Number of images in the Imagelist.
 int cImages = 1;
 
 // Create the Imagelist with
// the specified width (cx) and height (cy) for the images.
 HIMAGELIST m_hImageList = ImageList_Create(cx, cy, uFlags, cImages, 1);
 
 // Associate the created Imagelist
 // with the Listview control (m_hWnd).
 // The constant LVM_SETIMAGELIST
 // is used to establish the linkage.
 SendMessage(m_hWnd, LVM_SETIMAGELIST, 0, (LPARAM)m_hImageList);
 
 // Return the created Imagelist.
 return m_hImageList;
}
 
LRESULT CALLBACK
WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
 
    switch (uMsg)
    {
   case WM_CREATE:
   // Create the Listview control.
   HWND listViewHandle =
     CreateWindowEx(0, WC_LISTVIEW, L"",
    WS_VISIBLE | WS_CHILD | LVS_ICON,
        0, 0, 200, 200,
        hWnd, NULL, GetModuleHandle(NULL), NULL);
 
   // Call the CreateNewImageList function to create an Imagelist
   // and associate it with the Listview control.
   HIMAGELIST imageList = CreateNewImageList(listViewHandle, 16, 16);
 
   if (imageList != NULL) {
    // Here, you can use the
    // created Imagelist to add and display images.
    // After you finish working with//
    // the Imagelist, you should release it
    // to avoid memory leaks.
    // This is not fully implemented in this example.
 
    // An example of adding images:
    // ImageList_Add(imageList, hBitmap, NULL);
   }
   break;
 
  case WM_DESTROY:
   PostQuitMessage(0);
   return 0;
 
  default:
   return DefWindowProc(hWnd, uMsg, wParam, lParam);
 }
 return 0;
}
 
int WINAPI
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
        LPSTR lpCmdLine, int nCmdShow)
{
 
 
WNDCLASS wc = { 0 };
 wc.lpfnWndProc = WindowProc;
 wc.hInstance = hInstance;
 wc.lpszClassName = L"MyWindowClass";
 
 if (!RegisterClass(&wc))return -1;
 
 HWND hWnd =
 CreateWindow(L"MyWindowClass", L"My Window", WS_OVERLAPPEDWINDOW,
 100, 100, 400, 400, NULL, NULL,
 hInstance, NULL);
 
 if (!hWnd) {
  return -1;
 }
 
 ShowWindow(hWnd, nCmdShow);
 
 MSG msg = { 0 };
 while (GetMessage(&msg, NULL, 0, 0))
 {
  TranslateMessage(&msg);
  DispatchMessage(&msg);
 }
 
 return 0;
}
(Image-1) Listview set thumbnails size!
Listview set thumbnails size!

-
▲ Back to the top ▲




FAQ 8: Updated on: 1 November 2023 13:50 Windows
Windows-CPP-und-C

ShellExecuteEx function, search in LPCITEMIDLIST!


The solution is very easy to start with the ShellExecuteEx function, search for File in in LPCITEMIDLIST The provided code defines a function called SearchCmdLPCITEMIDLIST,
Windows-CPP-und-C

Reserve virtual memory C++, Windows?


The solution is very simple if you want to reserve virtual memory with C++ under Windows  Contents: 1. The program command to reserve virtual memory
Windows-CPP-und-C

What is the difference between float and double?


There are key differences between float and double, even though both are floating point numbers Contents: 1. The difference between float and double
Windows-CPP-und-C

Difference between IExtractImage2 and IExtractImage?


You want to implement IExtractImage or IExtractImage2 and register it as a Windows Shell extension Simply implement IExtractImage2, this is required to
Windows-CPP-und-C

Defender slows down the development of applications, programs and APPs!


It is in fact the case that the Defender greatly hinders the development of applications, programs and APPs, slows it down and is no fun to work with  
Windows-CPP-und-C

C++ query whether a string or char ends with a specific character?


The Solution is Simple: Checking if a String or Character Array Ends with a Certain Substring in C++ The provided C++ functions are designed to perform operations
Windows-CPP-und-C

Publish desktop applications in the MS Store using the Desktop Bridge!


It is easy to publish existing desktop applications in the MS Store using the Desktop Bridge Info: You can convert your existing desktop application into

»»

  My question is not there in the FAQ
Asked questions on this answer:
Keywords: windows, listview, thumbnails, size, quickly, list, view, there, restrictions, this, example, demonstrates, using, createnewimagelist, Questions, Answers, Software




  

  + Freeware
  + Order on the PC
  + File management
  + Automation
  + Office Tools
  + PC testing tools
  + Decoration and fun
  + Desktop-Clocks
  + Security

  + SoftwareOK Pages
  + Micro Staff
  + Freeware-1
  + Freeware-2
  + Freeware-3
  + FAQ
  + Downloads

  + Top
  + Desktop-OK
  + The Quad Explorer
  + Don't Sleep
  + Win-Scan-2-PDF
  + Quick-Text-Past
  + Print Folder Tree
  + Find Same Images
  + Experience-Index-OK
  + Font-View-OK


  + Freeware
  + Bitte.Wenden
  + CoronaKO
  + MatriX.CoronaKO
  + Find.Same.Images.OK
  + 3D.Benchmark.OK
  + PhotoResizerOK
  + Office.Files.Images
  + Film.Strip.Explorer
  + WinScan2PDF
  + PAD-s


Home | Thanks | Contact | Link me | FAQ | Settings | Windows 10 | English-AV | Impressum | Translate | PayPal | PAD-s

 © 2025 by Nenad Hrg softwareok.de • softwareok.com • softwareok.com • softwareok.eu


► WINDOWS SETTING MS SETTINGS YOURINFO ◄
► What is data privacy? ◄
► What are wildcards? ◄
► WINDOWS SETTING MS SETTINGS REGIONLANGUAGE ◄


This website does not store personal data. However, third-party providers are used to display ads,
which are managed by Google and comply with the IAB Transparency and Consent Framework (IAB-TCF).
The CMP ID is 300 and can be individually customized at the bottom of the page.
more Infos & Privacy Policy

....