Print Page | Close Window

Run only one client(My way)

Printed From: Mirage Source
Category: Tutorials
Forum Name: Approved Tutorials
Forum Discription: All tutorials shown to actually work with MSE are moved here.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=42
Printed Date: 20 December 2006 at 6:01pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Run only one client(My way)
Posted By: Dragoons Master
Subject: Run only one client(My way)
Date Posted: 07 February 2006 at 6:04pm
Thats a better way to make sure players do not use multi clients.


Only Client side.

Add this into modGameLogic header:
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long


Add this on top of Sub Main():
Call MultiClient


Add this sub into modGameLogic:
Sub MultiClient()
    Dim GameClient As Long
    Dim OldAppName As String
    OldAppName = App.Title
    App.Title = ""
    GameClient = FindWindow(vbNullString, OldAppName)
    App.Title = OldAppName
    If App.PrevInstance = True Or GameClient <> 0 Then
        Call MsgBox("Client already running!", vbExclamation, "Error")
        End
    End If
End Sub


This will make sure that 2 clients will never be open on the same computer at the same time.



Replies:
Posted By: Sync
Date Posted: 07 February 2006 at 6:07pm
Approved




Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info