'How to filter combobox by textsearch input WIN32 API

I'm trying to filter my combobox by text input and hide other options that are not similar. I have been playing around with the combobox control messages but it doesn't hide other options in the combobox. I'm not sure what to do, I have read about WM_COMPAREITEM but I don't understand what to do with it. Please refer to the images below:

How it is vs How I want it to be

How it is How I want it to be

void addFunc(HWND hwnd)
{
HWND hwndCombo;

CreateWindow(TEXT("static"), TEXT("Print size: "), WS_CHILD | WS_VISIBLE,
    75, 10, 90, 25, hwnd, NULL, NULL, NULL);
hwndCombo = CreateWindow(TEXT("combobox"), NULL, WS_VISIBLE | WS_CHILD | WS_VSCROLL | 
CBS_DROPDOWN | CBS_SORT,
    75, 35, 120, 110, hwnd, NULL, g_hinst, NULL);

SetWindowText(hwndCombo, items[4]);
for (int i = 0; i < 8; i++)
    SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)items[i]);
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source