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 Part 2

Button in chat window Part 2
Author: Message:
posseke
New Member
*


Posts: 14
41 / Male / –
Joined: Nov 2005
O.P. Button in chat window Part 2
Hi, a while ago I posted a thread about how to implement my own command button on a IM window of MSN.

This seems to work, at least the part of showing the button on the window.

I'm having problems with positioning the new button into the window:

[Image: msnfragbutton.JPG]

The button is allways in the upper left corner of each window, and no matter what code i write to position the button, it doesn't work...

frustrating, I know :d

Maybe good to know: I'm programming in VBNET so the code I'm giving you is probably a lil different from VB6 syntax

code:
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 IntPtr, ByVal lpRect As RECT) As IntPtr

    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 = New RECT
    Public newBtn As FragMsnIMButton

    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 = Me.btnFrag.Handle
            Dim par As System.IntPtr = pIMWindow.hwnd.ToString
            '
            SetParent(child, par)
            '
            Try
                'GetWindowRect(par, R)
            Catch ex As Exception
                MsgBox(ex.Message.ToString)
            End Try
            '
            newBtn.Left = 13500
            newBtn.Top = 2800
            '
        Catch ex As Exception
            MsgBox(ex.Message.ToString)
        End Try

    End Sub


So that is my main concern. Another concern is the error I'm getting while executing the 'GetWindowRect(par, R)' method.
It's something like 'attempt to overwrite protected memory'... If anyone knows anything about that, all help is welcome.


Thanks,

Kenny

12-27-2005 01:19 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Button in chat window Part 2 - by posseke on 12-27-2005 at 01:19 PM
RE: Button in chat window Part 2 - by TheBlasphemer on 12-27-2005 at 01:50 PM
RE: Button in chat window Part 2 - by J-Thread on 12-27-2005 at 02:55 PM
RE: Button in chat window Part 2 - by posseke on 12-27-2005 at 02:58 PM
RE: Button in chat window Part 2 - by J-Thread on 12-27-2005 at 03:53 PM
RE: Button in chat window Part 2 - by posseke on 12-27-2005 at 04:12 PM
RE: Button in chat window Part 2 - by J-Thread on 12-27-2005 at 04:16 PM
RE: RE: Button in chat window Part 2 - by CookieRevised on 12-27-2005 at 04:23 PM
RE: Button in chat window Part 2 - by posseke on 12-27-2005 at 05:17 PM


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