IPB

Welcome Guest ( Log In | Register )

3 Pages V  < 1 2 3 >  
Reply to this topicStart new topic
> How To Hook Msn Messenger In Visual Basic, updated tutorial
john
post Mar 22 2005, 12:25 AM
Post #21


Mess.bedbug
*

Group: Members
Posts: 26
Joined: 21-January 05
Member No.: 4,710



It seems it happens with any programs that use it. The DLL just fails to hook more than once.
Go to the top of the page
 
+Quote Post
Stigmata
post Mar 22 2005, 07:36 AM
Post #22


Mess.betterthanyours
Group Icon

Group: Supervisor
Posts: 1,951
Joined: 5-September 04
From: Uk
Member No.: 79



more then once??

do you mean when using polygamy?

if so:
QUOTE(the tutorial)
'**********note rest does not work with polygamy***********
  hHiddenWindowClass = FindWindow("MSNHiddenWindowClass", vbNullString)
        
  'If an instance is open
  If Not hHiddenWindowClass = 0 Then
If lProcessId = GetWindowThreadProcessId(hHiddenWindowClass, 0) Then
          If nCode = HCBT_CREATEWND Then
              Call OnWindowOpen(lProcessId, hWnd, sClassName)
          ElseIf nCode = HCBT_DESTROYWND Then
              Call OnWindowClose(lProcessId, hWnd, sClassName)
          End If
      End If
  End If
End Function
Go to the top of the page
 
+Quote Post
john
post Mar 22 2005, 02:18 PM
Post #23


Mess.bedbug
*

Group: Members
Posts: 26
Joined: 21-January 05
Member No.: 4,710



I mean when you close MSN, then re-open it. It doesn't seem to assign the hook the second time you try.

Do you not experience this problem?
Go to the top of the page
 
+Quote Post
SuNcO
post Mar 22 2005, 08:14 PM
Post #24


Windows Live Butterfly
***

Group: Members
Posts: 144
Joined: 31-December 04
From: Mazatlán, Sinaloa, México
Member No.: 4,134



Yep, i use that dll and i never check but if you close completely the Msn and run and hook again, it fails. Somethimes causes a VB crash

Well.. looking for another way, i see this and works very fine, without error and you dont need to hook the Main Window, just the "Msn Messenger (BETA)"

Need a Button and Text1. In Text1 you write the Hwnd (of course, just for test)

CODE

Private Const WM_COMMAND = &H111

Private Sub Command1_Click()
Hook.RemoveAllHooks
With Hook
   .TargethWnd = CLng(Text1)
   .AddMessage WM_COMMAND, "WM_COMMAND"
   .SetHook
End With

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Hook.RemoveAllHooks
End Sub

Private Sub Hook_PostedMessage(uMsg As Long, wParam As Long, lParam As Long)
'here is where our messages will arrive
'look for our special menu ID
'If (wParam And &HFFFF) = MENUID Then
   'our menu item has been selected
   MsgBox "Why did you do that?"
'End If
End Sub


The code is not mine, im found in HERE

This post has been edited by SuNcO: Mar 22 2005, 08:16 PM
Attached File(s)
Attached File  hookmenu.zip ( 14.16K ) Number of downloads: 375
 
Go to the top of the page
 
+Quote Post
anima
post Apr 5 2005, 07:44 PM
Post #25


Mess.bean
*

Group: Members
Posts: 6
Joined: 5-April 05
Member No.: 7,111



Hm... just a question. I'm using the default COM objets to "hook" MSN. What's the difference? msn_cry.gif

(For those people who don't use 'em in VB: search Messenger API, Private, Extension Lib and Lib. It's...different. and strange to use too. Here's a little code to get the mailbox for example...
QUOTE
Imports MessengerAPI
Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "
' blah blah blah...
#End Region
    Dim OMessengerWnd As MessengerAPI.Messenger
    Public Sub Draw()
        OMessengerWnd = New MessengerAPI.Messenger
        Dim DoubleMsg As String
        DoubleMsg = OMessengerWnd.MyFriendlyName
        MsgBox(DoubleMsg)

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Draw()
    End Sub
End Class


This being a simple example of MessengerAPI usage...

Can anyone tell me which way is better? with or without the hook? msn_rolleyes.gif

(sorry, I'm a BIG newb when it comes to hookin an app with VB...)

This post has been edited by anima: Apr 5 2005, 08:08 PM
Go to the top of the page
 
+Quote Post
Fr33Man
post Jul 26 2005, 11:12 AM
Post #26


Mess.bean
*

Group: Members
Posts: 1
Joined: 26-July 05
Member No.: 10,924



Hi,

I use the script of Stigmata.

Now i have added a extra menu option.
and added the following script to my project:


to the form_load i added:
CODE

With cboStatus
  .AddItem "Online"
  .AddItem "Busy"
  .AddItem "Away"
End With


i added a combobox to form and called it cboStatus, and addded the following code:
CODE

Private Sub cboStatus_Click()
If cboStatus.Text = "Online" Then
  msn.MyStatus = MISTATUS_ONLINE
ElseIf cboStatus.Text = "Busy" Then
  msn.MyStatus = MISTATUS_BUSY
ElseIf cboStatus.Text = "Away" Then
  msn.MyStatus = MISTATUS_AWAY
End If
End Sub


When i try to change the status, i'll get a error, and my project crash.
After i start my project again, the change status will work, but the menu does not work any more.

So what do i wrong ??

plz help !!!

Greetz,
Fr33Man


[edit]
Typo fix
[/edit]

This post has been edited by Fr33Man: Jul 26 2005, 11:15 AM
Go to the top of the page
 
+Quote Post
craig_2k5
post Sep 15 2005, 10:57 PM
Post #27


Mess.bee
**

Group: Members
Posts: 75
Joined: 23-August 05
Member No.: 11,785



ok ok msn_happy.gif neeed help wit this... i copied the code EXACTLY as it says... and i have put the 2 .dlls in the same folder as the project msn_rolleyes.gif bit it wont work i just get this error when trying to comile:

This post has been edited by craig_2k5: Sep 15 2005, 11:24 PM
Attached File(s)
Attached File  help.JPG ( 50.32K ) Number of downloads: 417
 
Go to the top of the page
 
+Quote Post
craig_2k5
post Sep 15 2005, 11:39 PM
Post #28


Mess.bee
**

Group: Members
Posts: 75
Joined: 23-August 05
Member No.: 11,785



sorry 2 double post wont let me edit msn_dunno.gif but i fixed it msn_tongue.gif just restarted VB and it works msn_confused.gif msn_grin.gif lol thanx
Go to the top of the page
 
+Quote Post
craig_2k5
post Sep 16 2005, 12:16 AM
Post #29


Mess.bee
**

Group: Members
Posts: 75
Joined: 23-August 05
Member No.: 11,785



wont let me edit again msn_disappointed.gif sumthing is seriusly up msn_rolleyes.gif any way pp.gif ill put it all in this time msn_happy.gif i have done the code got it to Hook on 2 msn but now i cannot get the menu options 2 actually do anything msn_confused.gif the

CODE
Public Function hookmenu(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
 Select Case wMsg
     Case WM_COMMAND
         Debug.Print wParam
If wParam = 2001 Then MsgBox "sorry cant open messenger chat logs......"
If wParam > Offset Then  
 Form1.Label1 = "SubMenu" & Trim$(wParam - Offset) & " was selected"
 Beep
 End If
 End Select
End Function
Dosent work msn_confused.gif nothing happens when i do it msn_confused.gif any1 help me msn_rolleyes.gif Using MSN 7.5
Go to the top of the page
 
+Quote Post
progns_386
post Dec 15 2005, 09:05 AM
Post #30


Mess.bean
*

Group: Members
Posts: 2
Joined: 15-December 05
Member No.: 15,249



Hi

Ive followed your instructions exactly, arent using polygamy.
The hook loads fine and the menu comes up, but the menu doesnt respond.
the hookmenu function does not respond at all, it isn't called at all.
Is there something I may be missing which calls that function?
Go to the top of the page
 
+Quote Post
XeroNL
post Jan 18 2006, 11:38 AM
Post #31


Mess.beanie
*

Group: Members
Posts: 10
Joined: 11-January 06
From: Amsterdam,The Netherlands
Member No.: 16,016



well, i tryid to fix it but it still wont work!
Can some1 give the fixed code?
Go to the top of the page
 
+Quote Post
deAd
post Jan 18 2006, 09:30 PM
Post #32


Hi.
*******

Group: Members
Posts: 996
Joined: 10-October 05
Member No.: 13,337



What about VB.NET? pp.gif
Go to the top of the page
 
+Quote Post
XeroNL
post Jan 18 2006, 09:43 PM
Post #33


Mess.beanie
*

Group: Members
Posts: 10
Joined: 11-January 06
From: Amsterdam,The Netherlands
Member No.: 16,016



I dont use vb.NET.
I dont like it pp.gif
Go to the top of the page
 
+Quote Post
deAd
post Jan 18 2006, 10:29 PM
Post #34


Hi.
*******

Group: Members
Posts: 996
Joined: 10-October 05
Member No.: 13,337



That doesn't help. Does anyone know?
Go to the top of the page
 
+Quote Post
psyko
post Jan 19 2006, 08:28 PM
Post #35


Anti-RIAA Fanatic
******

Group: *Valued Members
Posts: 773
Joined: 27-September 04
From: /usr/bin/root
Member No.: 345



You should be able to use VB.NET and convert the project code over. I have tried this at home again with VB6 and I get the same result - the menu is added and MSN is hooked, but the callback doesn't work at all.
Go to the top of the page
 
+Quote Post
XeroNL
post Jan 19 2006, 08:44 PM
Post #36


Mess.beanie
*

Group: Members
Posts: 10
Joined: 11-January 06
From: Amsterdam,The Netherlands
Member No.: 16,016



Well thats the same problem with VB6..
So if anyone know how to fix that...
Please let us know?
Go to the top of the page
 
+Quote Post
psyko
post Jan 20 2006, 12:43 AM
Post #37


Anti-RIAA Fanatic
******

Group: *Valued Members
Posts: 773
Joined: 27-September 04
From: /usr/bin/root
Member No.: 345



Has to be an interference with a name or something not referencing the callback. When I get a chance, I'll try to debug it, but maybe someone else will catch it before me.
Go to the top of the page
 
+Quote Post
twentytwo
post Apr 12 2006, 11:17 AM
Post #38


Mess.beanie
*

Group: Banned
Posts: 14
Joined: 6-April 06
Member No.: 18,270



Ive debugged this code til there was nothing left to debug, it simply dosn't work, the moment you minimize msn to the tray or close and reload msn the subclassing stops working.. the system hook works perfectly.

I would really appreciate it if somebody could point me in the right direction here, ive almost finished making a great application for messenger live and I don't want to use a silly tray icon.
Go to the top of the page
 
+Quote Post
psyko
post Apr 12 2006, 12:17 PM
Post #39


Anti-RIAA Fanatic
******

Group: *Valued Members
Posts: 773
Joined: 27-September 04
From: /usr/bin/root
Member No.: 345



I remember when I tried this code, the menu would stay no matter what, but the callbacks would never work. I looked at some other examples with pretty much the same code in it and their callbacks work, but the menu is destroyed upon closing. So, I wish I knew what to tell you...
Go to the top of the page
 
+Quote Post
Stigmata
post Apr 12 2006, 04:19 PM
Post #40


Mess.betterthanyours
Group Icon

Group: Supervisor
Posts: 1,951
Joined: 5-September 04
From: Uk
Member No.: 79



Well here goes, ive spent the last half an hour testing this over and over...

Closing, Opening, Closing, Opening etc etc..

the only problem i am coming up with is rehooking after messenger is complelty closed.

it rehooks after being closed to tray... etc etc and the call back is working fine..

if you want me to post the project, just ask..
Go to the top of the page
 
+Quote Post

3 Pages V  < 1 2 3 >
Reply to this topicStart new topic

 



RSS Lo-Fi Version Time is now: 13th November 2018 - 04:21 PM
© 2004-2008 Seb Skuse, mess.be.
MessForum v6.1.4 - created for, and for use only by mess.be.