Results 1 to 3 of 3

Thread: sendMessage--> char[260] to long

Hybrid View

  1. #1

    Thread Starter
    Hyperactive Member MPrestonf12's Avatar
    Join Date
    Jun 1999
    Location
    NY
    Posts
    330

    sendMessage--> char[260] to long

    What im trying to do is send a string from the find file structure to a listbox. heres the code I am using

    Code:
    SendMessage(listbox,LB_ADDSTRING,NULL, fd.cFileName);
    the error I get is:
    cannot convert parameter 4 from 'char [260]' to 'long'
    This conversion requires a reinterpret_cast, a C-style cast or function-style cast

    Any help is greatly appreciated! Thanks
    Matt

  2. #2
    jim mcnamara
    Guest
    It needs an address. Not sure what cd.cFileName is, assuming a LPCSTR

    like:
    Code:
    LPCSTR tmp;
    //copy the fd.cFileName to tmp pointer
    
    SendMessage(listbox,LB_ADDSTRING,NULL,(LPARAM) tmp);

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    You don't need the tmp:
    SendMessage(listbox,LB_ADDSTRING,NULL, (LPARAM)fd.cFileName);
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width