What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Plug-Ins » [VB6] Closing MSN messenger

3 votes - 2.67 average   [VB6] Closing MSN messenger
Author: Message:
Choli
Elite Member
*****

Avatar
Choli

Posts: 4714
Reputation: 42
43 / Male / Flag
Joined: Jan 2003
RE: [VB6] Closing MSN messenger
This is a bit offtopic, but my eyes hurt when I see this kind of code and I have to reply :P
quote:
Originally posted by Matty.
code:
Public Function closeAll()
Dim imwindowclass As Long
10  imwindowclass = FindWindow("imwindowclass", vbNullString)
    If imwindowclass <> 0 Then
        Call SendMessageLong(imwindowclass, WM_CLOSE, 0&, 0&)
        GoTo 10
    Else: Exit Function
    End If
End Function

Do not use GoTo unless it's strictly necessary. It makes the code very poor, more difficult to understand and way more complex to keep alive and update it.

All programs can be coded without goto lines. For example:
code:
Public Function closeAll()
Dim imwindowclass As Long
imwindowclass = FindWindow("imwindowclass", vbNullString)
While imwindowclass <> 0
        Call SendMessageLong(imwindowclass, WM_CLOSE, 0&, 0&)
        imwindowclass = FindWindow("imwindowclass", vbNullString)
Wend
End Function
and if you don't like the 2 FindWindow calls (why not?), use a Do While True .... Loop and put an If imwindowclass = 0 Then Exit Do
Messenger Plus! en espaņol:
<< http://www.msgpluslive.es/ >>
<< http://foro.msgpluslive.es/ >>
:plus4:
07-02-2004 05:33 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[VB6] Closing MSN messenger - by J-Thread on 07-02-2004 at 12:45 PM
RE: [VB6] Closing MSN messenger - by Wouter on 07-02-2004 at 12:59 PM
RE: [VB6] Closing MSN messenger - by Dempsey on 07-02-2004 at 01:11 PM
RE: RE: [VB6] Closing MSN messenger - by J-Thread on 07-02-2004 at 03:15 PM
RE: [VB6] Closing MSN messenger - by Choli on 07-02-2004 at 01:32 PM
RE: [VB6] Closing MSN messenger - by J-Thread on 07-02-2004 at 01:44 PM
RE: [VB6] Closing MSN messenger - by CookieRevised on 07-02-2004 at 01:56 PM
RE: RE: [VB6] Closing MSN messenger - by J-Thread on 07-02-2004 at 02:28 PM
RE: [VB6] Closing MSN messenger - by CookieRevised on 07-02-2004 at 02:31 PM
RE: [VB6] Closing MSN messenger - by J-Thread on 07-02-2004 at 02:33 PM
RE: [VB6] Closing MSN messenger - by CookieRevised on 07-02-2004 at 02:42 PM
RE: [VB6] Closing MSN messenger - by J-Thread on 07-02-2004 at 02:45 PM
RE: [VB6] Closing MSN messenger - by matty on 07-02-2004 at 03:04 PM
RE: [VB6] Closing MSN messenger - by matty on 07-02-2004 at 04:56 PM
RE: [VB6] Closing MSN messenger - by J-Thread on 07-02-2004 at 05:29 PM
RE: [VB6] Closing MSN messenger - by Choli on 07-02-2004 at 05:33 PM
RE: [VB6] Closing MSN messenger - by matty on 07-02-2004 at 05:34 PM
RE: [VB6] Closing MSN messenger - by J-Thread on 07-03-2004 at 08:29 AM
RE: [VB6] Closing MSN messenger - by Choli on 07-03-2004 at 09:21 AM
RE: RE: [VB6] Closing MSN messenger - by J-Thread on 07-03-2004 at 10:49 AM
RE: [VB6] Closing MSN messenger - by Choli on 07-03-2004 at 12:12 PM
RE: [VB6] Closing MSN messenger - by J-Thread on 07-03-2004 at 12:57 PM
RE: [VB6] Closing MSN messenger - by J-Thread on 07-05-2004 at 05:46 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