Protocols/MSNP/Activities/SDK/Techref/Promo/Code: Difference between revisions

From NINA Wiki
Jump to navigation Jump to search
(Created automatically by Anima Importer)
 
(Created automatically by Anima Importer)
Line 1: Line 1:
<!-- Generated @ 08/12/2022 23:43:09 +01:00 using Anima's CHM converter based on techref/promo/code.htm -->
<!-- Generated @ 08/12/2022 23:45:43 +01:00 using Anima's CHM converter based on techref/promo/code.htm -->
{{Protocols/MSNP|section=Activities}}
{{Protocols/MSNP|section=Activities}}
__NOTOC__= Calling the MSN Messenger Client Directly =  
__NOTOC__= Calling the MSN Messenger Client Directly =  

Revision as of 22:45, 12 August 2022


MSNP Protocol
Activity SDK
Introduction to the MSN Messenger Activity API
Key Requirements for a MSN Messenger Activity
Introduction to MSN Messenger Activity API
Overview of MSN Messenger Activity API
Activities Menu
System Requirements
Standard vs. Advanced Applications
Supported Countries and Languages
MSN Messenger Activity API Support
Copyright Information
Glossary
MSN Messenger Activity API Process
MSN Messenger Activity Process Overview
Supporting Documentation
Requesting Usage of Special Permissions
Submitting Pre-compliance Testing Results
MSN Requirements for Developing an Activity API Application
Additional Activity API Application Development Requirements
Selecting Development Options
Activity API Restrictions
Developing a MSN Messenger Activity
Development Considerations
Getting Started
Required Definitions
Document Body Basics
Single-User Application
Multiuser Application
Designing MSN Messenger Activity Graphics
Testing an Activity
Testing Overview
The Local XML File
Test Environment Setup
Increasing MSN Messenger Activity Usage
Understanding How to Increase Activity Usage with MSN
Design Considerations for Increased Activity Usage
Calling the MSN Messenger Client Directly
Calling the MSN Messenger Client from a URL
Using the MSN Messenger Variables
Technical Reference
Obtaining Access to Restricted Features
Permission Flags
ActiveX Flag
EnableIP Flag
PassportSiteID Flag
ReceiveIM Flag
ReplaceIM Flag
SendFile Flag
SendIM Flag
UserProperties Flag
The Activity Object Model
Enumerations
ConnectionType Enumeration
FileStatus Enumeration
Methods
CloseApp Method
Objects
Channel Object
Events
OnAppClose Event
OnDataError Event
OnDataReceived Event
OnFileProgress Event (Restricted)
OnFileReceived Event (Restricted)
OnIMReceived Event (Restricted)
OnRemoteAppClosed Event
OnRemoteAppLoaded Event
OnSendFileCancelled Event (Restricted)
OnTypeChanged Event
Methods
CancelSendFile Method (Restricted)
EnterIM Method (Restricted)
Initialize Method
SendData Method
SendFile Method (Restricted)
SendIM Method (Restricted)
SendIMAsUser Method (Restricted)
Properties
Data Property
Error Property
FileInfo Property (Restricted)
Type Property
IM (read-only) Property (Restricted)
IM (read-write) Property (Restricted)
Error Object
Type Property
Data Property
FileInfo Object
Path Property
Size Property
Progress Property
Incoming Property
Status Property
Messenger Object
Options Method
Phone Method
User Object
EMail Property (Restricted)
GlobalIP Property (Restricted)
LocalIP Property (Restricted)
Name Property (Restricted)
PUID Property (Restricted)
Users Collection
Item Method
_NewEnum Method
Count Property
Me Property
Inviter Property
Overview
IntroductionTermsClients
Reference
Error ListCommandsRelying Party SuiteSpotlife
Services
XMPPHTTP GatewayTabsActivities
Documentation
Development ToolsMSNP Grid
PolygamyURLs used by MSN
Documents
Protocol Versions
Version 21
Version 18
Version 16
Version 15
Version 14
Version 13
Version 12
Version 11
Version 9
Version 8
Version 2
MSNC
IntroductionP2PObject DescriptorDisplay PicturesFile Transfer
Scenarios
Microsoft Messenger for Mac
MSNP on WebTV (MSNTV)

Calling the MSN Messenger Client Directly

You can invoke the MSN® Messenger client directly from a Web page by adding script to the Web page. You can start by creating a new HTML page, or you can add script code to an existing HTML page. This script calls an ActiveX� control that invokes the MSN Messenger client application directly. You can design your script to pass two optional string variables to the ActiveX control, or if you prefer, you can pass either of the variables, or none. The variables that are passed to the ActiveX control are the AppID variable and the BOT variable. Both the AppID and the BOT variables are string variables, with the BOT variable being a string in the form of an e-mail address. In the code sample presented below, the BOT variable is assigned the emailID variable name.

The behavior of the MSN Messenger client when it is invoked depends on the following items:

  • Which of the two variables you pass to the ActiveX control
  • The state of the MSN Messenger client at the time the MSN Messenger ActiveX control is called (whether the MSN Messenger client is active or not)
  • Which version of the MSN Messenger client or Microsoft� Internet Explorer browser is installed on the user's system


For more information about the effect of the variables on the behavior of the MSN Messenger client, see Using the MSN Messenger Variables.

The main call that invokes the MSN Messenger ActiveX control is the following in the script area:

obj.LaunchApp(AppID, emailID);

                

However, visitors with versions of Internet Explorer earlier than version 5.01 will not be able to access the MSN Messenger client. Similarly, if their version of the MSN Messenger client is earlier than version 6.2, this method will fail.

For this reason, it is important to add code that verifies the following:

  • The visitor is using Internet Explorer 5.01 or later.
  • The visitor is using MSN Messenger 6.2 or later.


In the first case, you should add a dialog box that plainly states that visitors' browsers do not support ActiveX controls. In the second case, you should add an error message that provides information that tells visitors that they need a later version of MSN Messenger.

The following sample code (in the script area) illustrates how to programmatically call the ActiveX control that invokes MSN Messenger:

<script type="JavaScript">
<!--

var obj;
var winModalWindow;
var AppID = "10331003";
var emailID = "";
//In the code variable declarations above, the AppID variable is assigned the value of the game Hexic (1003) for users
//within the US (1033). You should substitute the correct value assigned to your application (by the Support team)
//for your desired market.

function TryItNow(AppID)
{
    // Test #1: Launch with no email variable value causing the user to have to select another user to interact with.
    CheckMessenger();
    LaunchApp(AppID, "");
}

function LaunchApp(AppID, emailID)
{
    if (obj != null)
    {
        obj.LaunchApp(AppID, emailID);
    }
}
function CheckMessenger()
{
    eval ('try {obj = new ActiveXObject("MSNMessenger.P4QuickLaunch"); } catch (e) {obj = null;}');
    var strErrorPage = "http://" + [HOSTNAME] + "/Error.aspx"
    
    
    if ([Browser is not IE])
    {
        ShowWindow(strErrorPage, 410, 130);     
    }   
    else if (obj == null)
    {
        ShowWindow(strErrorPage, 410, 225);
    }
    
}


 
function IgnoreEvents(e)
{
  return false
}
 
//Display error message if the MSN Messenger client 6.2 is not installed or the browser is not Internet Explorer
function ShowWindow(strError, width, height)
{
  if (window.showModalDialog)
  {
   
    window.showModalDialog(strError,null,
    "dialogWidth="+width+"px;dialogHeight="+height+"px;help=no;dialogLeft=160")
  }
  else
  {

    var ah = screen.availHeight;

    var y = (ah - height) / 2;

    window.top.captureEvents (Event.CLICK|Event.FOCUS)
    window.top.onfocus=HandleFocus 
    winModalWindow = window.open (strError,"ModalChild",
       "dependent=yes,width="+width+",height="+height+",top="+y+",left=160,screenX=160,screenY="+y)
    winModalWindow.focus()
  }
}

 
function HandleFocus()
{
  if (winModalWindow)
  {
    if (!winModalWindow.closed)
    {
      winModalWindow.focus()
    }
    else
    {
      window.top.releaseEvents (Event.CLICK|Event.FOCUS)
    }
  }
  return false
}



</script>