Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Getting the Combo Box selected item using Win32 API.

Getting the Combo Box selected item using Win32 API.

Scheduled Pinned Locked Moved C / C++ / MFC
questionjsonhelp
21 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P prasad_som

    jhwurmbach wrote:

    lParam Pointer to the buffer that receives the string. The buffer must have sufficient space for the string and a terminating null character. With your 100 TCHARS you might or might not be ok.

    True, It is just a quick fix.

    jhwurmbach wrote:

    TCHAR buff[nSize+1];::SendMessage(h,CB_GETLBTEXT,(WPARAM)nIndx,(LPARAM)buff);//buff will contain text returned

    Again, small correction here, need to allocate memory on heap.

     TCHAR \*buff = new TCHAR\[nIndx+1\];
    ::SendMessage(hCombo,CB\_GETLBTEXT,(WPARAM)0,(LPARAM)buff);
    //use delete \[\] buff; after use
    

    Prasad Notifier using ATL | Operator new[],delete[][^]

    J Offline
    J Offline
    jhwurmbach
    wrote on last edited by
    #21

    prasad_som wrote:

    Again, small correction here,

    In the end it doesn't pay to cut short on testing... :-O Thanks!


    "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups