Click here to Skip to main content
15,892,839 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on one project in win32 API. Here, I want the user to type a text in a search bar and the first corresponding words should pop-up. When the user is done with the typing or selects the word, clicking on the 'Process' button should display another message box.


I want each word to display a different message box when the user clicks on the 'Process' button. Implying that, the application must be able to store data such that it can be retrieved. So far, I have this code which can store data and be retrieved.

C#
HWND hWndComboBox = CreateWindow (TEXT("COMBOBOX"), TEXT (""),
           CBS_DROPDOWN| CBS_HASSTRINGS | WS_VSCROLL| WS_VISIBLE |WS_CHILD ,
            100, 20, 200, 70,
            hwnd ,(HMENU) NULL, NULL, NULL);

CreateWindow (TEXT("BUTTON"), TEXT ("Process "),
            WS_VISIBLE | WS_CHILD ,
            200, 100, 70, 20,
            hwnd,(HMENU) NULL, NULL, NULL);

SendMessage  (
    hWndComboBox  ,
    (UINT) CB_ADDSTRING,
    (WPARAM) 0, (LPARAM) TEXT ("Apple"));

SendMessage  (
    hWndComboBox ,
    (UINT) CB_ADDSTRING,
    (WPARAM) 0, (LPARAM) TEXT ("Apple juice"));

    SendMessage (hWndComboBox , CB_GETCURSEL , (WPARAM) 0, (LPARAM) 0);




Here, what I cannot do is that there is no default word like "Search Fruits" which clears when the user begins to type. Moreover, when the user selects 'Apple' and clicks on the 'Process' button, no dialog box is displayed. I do not know how to call the message box to respond depending on the user inputs. And also, the small search icon on the right of the search box.

Please what should I do? I am using win32 API Code:Blocks. Any further question for clarification is welcome. Any link or answer is most welcome. Thank you all.

What I have tried:

I have searched Google for solutions but to no avail. I have setup some codes myself too.
Posted
Updated 3-Apr-16 6:04am

1 solution

I think that this is what you are looking for

Win32 SDK C Autocomplete Combobox Made Easy[^]

Quote:
what I cannot do is that there is no default word like "Search Fruits" which clears when the user begins to type.


Once you got the handle of combobox's edit control you can send a EM_SETCUEBANNER message (Windows)[^] to it

but this requires minimum Windows Vista (and a common controls manifest )
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900