AspenInit()

 

Related Items

 

 

Purpose

Initialize the Aspen library for use.

 

 

Syntax

#include <aspen.h>

...

int AspenInit(

   unsigned long flags,

   unsigned long eventSemaphore,

   int           *maxConnections );

 

 

Parameters

flags

flags contains flags to control the configuration of the Aspen API. Currently this parameter is unused.

 

eventSemaphore

eventSemaphore is a unsigned long that contains a platform-specific semaphore to be used to signal the application that an Aspen event has been queued. When this semaphore is signaled, the AspenEvent() routine should be called to process the event.

 

To disable signaling in single-threaded applications, this parameter should be set to NULL. The eventSemaphore parameter is only used on multi-threaded operating systems. This parameter is ignored on single-threaded platforms like Windows 3.1. For more information on the usage of the eventSemaphore parameter, see Aspen Event Notification System.

 

*maxConnections

*maxConnections is a pointer to an integer that receives a value that indicates the maximum number of sessions that can be established with this version of the Aspen API.

 

 

Remarks

AspenInit() must be the first Aspen function called (excepting AspenVersion()). AspenInit() initializes all internal structures, and verifies that a network transport service is available.

 

 

Return Value

ASPEN_OK

if successful

 

 

See Also

AspenExit()

AspenEvent()

Aspen Event Notification System

 

 

Example

BOOL CHistoryEditDemoDlg::OnInitDialog()

{

   int retval;

   int MaxConnections;

   CString strText;

   CDialog::OnInitDialog();

 

   // Add "About..." menu item to system menu.

   // IDM_ABOUTBOX must be in the system command range.

   ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);

   ASSERT(IDM_ABOUTBOX < 0xF000);

   CMenu* pSysMenu = GetSystemMenu(FALSE);

   if (pSysMenu != NULL)

   {

      CString strAboutMenu;

      strAboutMenu.LoadString(IDS_ABOUTBOX);

      if (!strAboutMenu.IsEmpty())

      {

         pSysMenu->AppendMenu(MF_SEPARATOR);

         pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);

      }

   }

   // Set the icon for this dialog.  The framework does this automatically

   // when the application's main window is not a dialog

   SetIcon(m_hIcon, TRUE); // Set big icon

   SetIcon(m_hIcon, FALSE); // Set small icon

 

   // Subclass the history edit control

   m_HistoryEdit.SubclassDlgItem(EDIT_HISTORY, this);

   // Initialize the ASPEN library

   m_AspenSemaphore = CreateSemaphore(NULL, 0, 1000, "Global\\AspenEventSemaphore");

   retval = AspenInit(0,

                      (unsigned long)m_AspenSemaphore,

                      &MaxConnections);

   if(!retval)

   {

      strText = "Initialized";

      SetDlgItemText(EDIT_INIT,strText);

   }

   CHistoryEditDemoDlg::OnMenuLogin();

   return TRUE;  // return TRUE  unless you set the focus to a control

}

 

©2006 Aspen Research Group, Ltd. All rights reserved. Terms of Use.