Sendmessage

This is a discussion on Sendmessage within the C++ Programming forums, part of the General Programming Boards category; Hi. I'm trying to find the listitem of a listview control(mscomctl.ocx) from Visual FoxPro. The problem is, you can't declare ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    329

    Question Sendmessage

    Hi.
    I'm trying to find the listitem of a listview control(mscomctl.ocx) from Visual FoxPro. The problem is, you can't declare types in VFP, hence i can't use the SendMessage API directly from VFP..
    I've tried to create a c++ dll, but can't make it work..
    I know it has something to do with WPARAM, as you can see, i send the address of the pointer to the struct, but i don't think that's correct..?
    It only returns -1.

    Dll code:
    Code:
    #define DLLEXPORT __declspec(dllexport)
    #define LVW_FINDITEM 4153
    typedef struct lvwInfo{
      long lX;
      long lY;
      long lFlags;
      long lItm;
      long lSubItm;
    } LVWINFO;
    
    int DLLEXPORT CALLBACK getItem(HWND hWnd, int x, int y){
      LVWINFO lvMsg;
    
      // Send request to listview for listindex  
      lvMsg.lX = x;  
      lvMsg.lY = x;  
      SendMessage(hWnd, LVW_FINDITEM, 0, (WPARAM)&lvMsg);  
      return((lvMsg.lItm)?lvMsg.lItm: -1);
    }
    VFP Code, this returns -1:
    Code:
    iItem = getItem(List1.hWnd, x, y)

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Are you sure this bit is correct?:
    Code:
    lvMsg.lX = x;    
    lvMsg.lY = x;
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    329

    Thumbs up D'Oh!!

    Thx!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 03-19-2009, 03:15 AM
  2. SendMessage to 16bit program
    By khdani in forum Windows Programming
    Replies: 2
    Last Post: 09-02-2008, 03:37 AM
  3. Combobox problem
    By gargamel in forum Windows Programming
    Replies: 2
    Last Post: 05-06-2005, 02:37 PM
  4. WM_KEYDOWN and SendMessage
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 07-13-2002, 06:23 PM
  5. SendMessage causes an exception in release.
    By DS in forum Windows Programming
    Replies: 1
    Last Post: 11-27-2001, 11:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21