Announcement

Collapse
No announcement yet.

Loading images and image lists with MemoryEx

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Code:
    User32Library = Library.Load("user32.dll");
    ComboBoxEx = {}
    ComboBoxEx.GetChildPointer = function(SWnd)
      local CBEM_GETCOMBOCONTROL = 0x406;
      local x = User32Library.SendMessageA(SWnd,CBEM_GETCOMBOCONTROL,0,0)
      return x
    end;
    ComboBoxEx.GetEditPointer = function(SWnd)
      local CBEM_GETEDITCONTROL = 0x407;
      local x = User32Library.SendMessageA(SWnd,CBEM_GETEDITCONTROL,0,0)
      return x
    end;
    ComboBoxEx.ClearSelection = function(CWnd)
      local CB_SETCURSEL = 334;
      local x = User32Library.SendMessageA(CWnd,CB_SETCURSEL,-1,0)
      return true , "OK"
    end;
    ComboBoxEx.GetSelection = function(CWnd)
      local CB_GETCURSEL = 0x0147;
      local x = User32Library.SendMessageA(CWnd,CB_GETCURSEL,0,0)
      return true , x
    end;
    ComboBoxEx.GetText = function(hWnd,Inx)
      local B = ComboBoxEx.GetTextLenght(hWnd,Inx)
      if B == 0 then 
       return true, "" 
      end
      local Bu = MemoryEx.Allocate(B + 1)
      if(Bu)then
       local CB_GETLBTEXT = 0x0148;
       local x = User32Library.SendMessageA(hWnd,CB_GETLBTEXT,Inx,Bu)
       local t = MemoryEx.String(Bu,-1, MEMEX_ASCII)
       MemoryEx.Free(Bu)
       return true, t or ""
      else
       return false, "Can't create buffer"
      end
    end;
    ComboBoxEx.GetTextLenght = function(hdl,Inx)
      local CB_GETLBTEXTLEN = 0x0149;
      return User32Library.SendMessageA(hdl,CB_GETLBTEXTLEN,Inx,0)
    end;
    ComboBoxEx.BringToTop = function(SWnd)
      if tonumber(User32Library.BringWindowToTop(SWnd)) == 0 then
       return false, "Can't bring ComboBox to top"
      else
       return true, "OK"
      end
    end;
    --------------Subclass
      --MainHandle = returned from cretewindoex
      --ChildHandle = returned from ComboBoxEx.GetChildPointer
      local s = Subclass.Create(Application.GetWndHandle(), function(hWnd, uMsg, wParam, lParam)
       if(uMsg == 0x0111)then--WM_COMMAND
        if (lParam == MainHandle) then
         local wmEvent = Bitwise.And(Bitwise.ASR(wParam, 16), 0xFFFF);
         if (wmEvent == 1) then
          local x, idx = ComboBoxEx.GetSelection(ChildHandle)
          local x, y = ComboBoxEx.GetText(MainHandle,idx)
          Dialog.Message(idx,y) 
         end
      return Subclass.OldWinProc(hWnd, uMsg, wParam, lParam);
      end)
    Best Ive got so far is the 'On Select' event, think is down to using the correct handle as there is three of them, got to pop out to the shops now but I'm having a go at that event when I come back

    Comment


    • #17
      I tried to get the message through processing the WM_PAINT message. But it seems that I really have to handle the WM_COMMAND message. Thx.

      Comment


      • #18
        I apologize, I processed not WM_PAINT message, and WM_NOTIFY. :lol

        Comment


        • #19
          Who could provide an example.apz already thank you?




          Comment

          Working...
          X