Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Sep 2007
    Posts
    54
    Thanks
    7
    Thanked 1 Time in 1 Post

    Outlook 2010: Create customized ribbon and attach C# macros to VB add-in

    I am trying to create a customized ribbon in Outlook using a VB6 Addin. There are two macros from an outside vendor that I want to have on my ribbon. I asked the vendor to provide me with the coding for those macros and this is what they gave me:

    Having said that, the Worldox DLL is an ATL Based Com Add-in written in C. The button Methods are CopyButtonClicked and MoveButtonClicked. The class name we are using is CConnect.
    We do not know if you can call it directly (as we’re not a VB/C# macro, but if you want to emulate what we are doing this is what you would need to do (in the language of your choice):
    HWND hwndWorldox = FindWindow (“WORLDOX_Frame”,NULL)
    if (0 == hwndWorldox)
    {
    hwndWorldox = FindWindow (“WDSAAS_Frame”,NULL)
    }
    //10303 is copy, 11301 is move
    SendMessage (hwndWorldox, 1036,10303,0)
    }


    I converted it to this:

    Code:
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As Long) As Long
    Private Declare Function SendMessage Lib "user32.dll" (ByVal hWnd As Long, ByVal msg As Integer, ByVal wParam As Long, ByVal lParam As Long) As Long
    Sub WorldoxMain()
      Dim hwndWorldox As Long
      Dim strSendMessage As Object
      hwndWorldox = FindWindow("WORLDOX_Frame", 0)
      If hwndWorldox Then
         strSendMessage = SendMessage(hwndWorldox, 1036, 10303, 0)
         
      End If
    End Sub
    But I get a "Can't find DLL entry point SendMessage in user32.dll. I probably didn't convert it correctly, but can't figure out what I am doing wrong? I honestly have never tried to do this before and am struggling to understand the process. Any help would be very much appreciated.

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    The second parameter of SendMessage should be a Long, not an Integer.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    Star Lounger
    Join Date
    Sep 2007
    Posts
    54
    Thanks
    7
    Thanked 1 Time in 1 Post
    I'm still getting the same error "Can't find DLL entry point SendMessage in user32.dll" Without actually understanding what these actually mean, I'm struggling trying to get it to work. Any other ideas?

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    Sorry - I overlooked a key part:

    Code:
    Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal msg As Integer, ByVal wParam As Long, ByVal lParam As Long) As Long
    Regards,
    Rory

    Microsoft MVP - Excel

  5. The Following User Says Thank You to rory For This Useful Post:

    maverik (2015-10-20)

  6. #5
    Star Lounger
    Join Date
    Sep 2007
    Posts
    54
    Thanks
    7
    Thanked 1 Time in 1 Post
    I could kiss you!
    Thank you so, so much!!!

  7. #6
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    You're welcome.
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

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