What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Plug-Ins » Button in chat window

Pages: (2): « First « 1 [ 2 ] Last »
Button in chat window
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Button in chat window
You declared it wrong (Atleast this is what Microsoft says it should be after a VB6 form being upgraded to .Net)
code:
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Integer, _
                                                 ByVal nCmdShow As Integer) _
                                                 As Integer


And as well dont set the oMessenger object to MessengerApi.Messenger as this will cause the Windows Messenger application to actual run. Instead set it to oMessenger when you actually make the plugin.

This post was edited on 11-29-2005 at 09:19 PM by matty.
11-29-2005 09:17 PM
Profile E-Mail PM Find Quote Report
posseke
New Member
*


Posts: 14
41 / Male / –
Joined: Nov 2005
O.P. RE: Button in chat window
code:
    Private Sub oMessenger_OnIMWindowCreated(ByVal pIMWindow As Object) Handles oMessenger.OnIMWindowCreated
        Dim newBtn As Object
        Dim imhwnd As System.IntPtr
        newBtn = New FragMsnIMButton ' create a copy of FragMsnIMButton
        imhwnd = pIMWindow.hwnd
        Me.Parent = SetParent(newBtn.btnFrag.hwnd, imhwnd)
        GetWindowRect(pIMWindow.hwnd, R)
        newBtn.btnFrag.left = R.Height - 200 'Moving the textbox under the display picture
        newBtn.btnFrag.right = R.Width - 100
    End Sub


I have one problem here, when I open a IM window, the code executes untill

code:
...
imhwnd = pIMWindow.hwnd


executes this last line, shows the window, and then stops executing the rest of the code...

Any ideas?
11-29-2005 10:03 PM
Profile E-Mail PM Web Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: Button in chat window
That line's a simple assignment, so should work fine. Are you sure it's not hanging on the SetParent?
[Image: spartaafk.png]
11-29-2005 10:14 PM
Profile PM Web Find Quote Report
posseke
New Member
*


Posts: 14
41 / Male / –
Joined: Nov 2005
O.P. RE: Button in chat window
SetParent is also giving the same problem...
11-29-2005 10:16 PM
Profile E-Mail PM Web Find Quote Report
posseke
New Member
*


Posts: 14
41 / Male / –
Joined: Nov 2005
O.P. RE: Button in chat window
OK, solved one part of the problem, the code now executes untill setParent, but this last method won't work because the button I put on the form doens't have a 'hwnd'...


code:
Try
            SetParent(newBtn.btnFrag.hwnd, imhwnd)
        Catch ex As Exception
            MsgBox(ex.Message.ToString)
        End Try


It's all about conversion from VB6 -> VB.NET . I found in this last error that one must use the button.Handle method to obtain the correct pointer for that object.

So now I'm still converting code :p

BTW, I'm using VS 2005 Professional, in case you're wondering.
Built on the 2.0 NET Framework
11-29-2005 10:45 PM
Profile E-Mail PM Web Find Quote Report
posseke
New Member
*


Posts: 14
41 / Male / –
Joined: Nov 2005
O.P. RE: Button in chat window
Hi, I'm here with the last error I think will come up:

Everything goes well, the setParent works, but i can't see the button I just added to the IM window.

When looking closer, I see there is an error while processing
the 'GetWindowRect(pIMWindow.hwnd, R)' statement(at bottom of code sample).
What am I doing wrong?? please, this is probably my last error, so I appreciate your help!

code:
Imports MessengerAPI
Public Class FragMsnIMButton

    Private WithEvents oMessenger As Messenger
    Private Declare Function SetParent Lib "user32.dll" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
    Public Declare Function GetWindowRect Lib "user32.dll" (ByVal hwnd As Long, ByVal lpRect As RECT) As Long

    Public Structure RECT
        Dim x As Long
        Dim y As Long
        Dim Width As Long
        Dim Height As Long
    End Structure

    Public R As RECT
    Public newBtn As Object

    Private Sub FragMsnIMButton_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        oMessenger = New Messenger
    End Sub

    Private Sub oMessenger_OnIMWindowCreated(ByVal pIMWindow As Object) Handles oMessenger.OnIMWindowCreated
        '
        Try
            newBtn = New FragMsnIMButton ' create a copy of FragMsnIMButton
            Dim child As System.IntPtr = newBtn.btnFrag.Handle.ToString
            Dim par As System.IntPtr = pIMWindow.hwnd.ToString
            '
            SetParent(child, par)
            '
            Try
                GetWindowRect(pIMWindow.hwnd, R)
            Catch ex As Exception
                MsgBox(ex.Message.ToString)
            End Try
            '
            newBtn.btnFrag.left = 13500 'Moving the textbox under the display picture
            newBtn.btnFrag.right = 2800
        Catch ex As Exception
            MsgBox(ex.Message.ToString)
        End Try

    End Sub

End Class

11-29-2005 11:36 PM
Profile E-Mail PM Web Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On