Originally Posted By: DEATHJ0KER
Clicking Exit, the client should just propose the dialog without taking action towards any function, but this is not the case

to evade the dcx dll, you can create an event on "exit" that uses the alias?
or you can force the close behavior so that it does not propose the choice though in mirc options is enabled this function?

alias load_dcx {
if ($dll(dcx.dll)) return
dll dcx.dll LoadDCX | ; replace this with the line to initialize dcx
}



Thanks argv0


Unloading a DLL

You can unload a loaded DLL by using the -u switch:
/dll -u <filename>
You can browse the list of loaded DLLs by using:

$dll(N/filename) returns the Nth loaded DLL

mIRC will automatically unload a DLL if it is not used for ten minutes, or when mIRC exits.

You can also define an UnloadDll() routine in your DLL which mIRC will call when unloading a DLL to allow it to clean up.

int __stdcall UnloadDll(int mTimeout);

The mTimeout value can be:

0 UnloadDll() is being called due to a DLL being unloaded with /dll -u.

1 UnloadDll() is being called due to a DLL not being used for ten minutes. The UnloadDll() routine can return 0 to keep the DLL loaded, or 1 to allow it to be unloaded.

2 UnloadDll() is being called due to a DLL being unloaded when mIRC exits.



Code:
/*!
 * \brief mIRC DLL Load Function
 *
 * This function is called when the DLL is loaded.
 *
 * It initializes all what the DLL needs and links mIRC received information to the mIRCDLL \b mIRCLink
 * data structure to be used later in various functions in the DLL.
 *
 * \param load mIRC Load Structure Pointer
 */

void WINAPI LoadDll( LOADINFO * load ) {

  mIRCLink.m_hFileMap = CreateFileMapping( INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, 4096, "mIRC" );     
  mIRCLink.m_pData = (LPSTR) MapViewOfFile( mIRCLink.m_hFileMap, FILE_MAP_ALL_ACCESS, 0, 0, 0 );
  mIRCLink.m_mIRCHWND = load->mHwnd;

  g_OldmIRCWindowProc = (WNDPROC) SetWindowLong( mIRCLink.m_mIRCHWND, GWL_WNDPROC, (LONG) mIRCSubClassWinProc );

  WNDCLASS wc;
  ZeroMemory( &wc, sizeof( WNDCLASS ) );
	wc.hInstance = GetModuleHandle( NULL );
  wc.lpszClassName = XPOPUPMENUCLASS;
  wc.lpfnWndProc = XPopupMenu::XPopupWinProc;
	RegisterClass( &wc );

	mhMenuOwner = CreateWindow( XPOPUPMENUCLASS, NULL, 0, 0, 0, 0, 0, 0, 0, GetModuleHandle(NULL), 0 );

  g_mIRCPopupMenu = new XPopupMenu( NULL );
  g_mIRCMenuBar = new XPopupMenu( GetMenu( mIRCLink.m_mIRCHWND ) );
}

/*!
 * \brief mIRC DLL UnLoad Function
 *
 * This function is called when the DLL is unloaded.
 *
 * It initializes all what the DLL needs and links mIRC received information to the mIRCDLL \b mIRCLink
 * data structure to be used later in various functions in the DLL.
 *
 * \param timeout Unload trigger indicator (0 = timeout unload after 10 min - 1 = exit or /dll -u)
 */

int WINAPI UnloadDll( int timeout ) {

  // DLL unloaded because mIRC exits or /dll -u used
  if ( timeout == 0 ) {

    SetWindowLong( mIRCLink.m_mIRCHWND, GWL_WNDPROC, (LONG) g_OldmIRCWindowProc );

    g_XPopupMenuManager.clearMenus( );

    delete g_mIRCPopupMenu;
    g_mIRCMenuBar->cleanMenu( GetMenu( mIRCLink.m_mIRCHWND ) );
    delete g_mIRCMenuBar;

    if ( mhMenuOwner != NULL )
      DestroyWindow( mhMenuOwner );

    UnregisterClass( XPOPUPMENUCLASS, GetModuleHandle( NULL ) );

    UnmapViewOfFile( mIRCLink.m_pData );
    CloseHandle( mIRCLink.m_hFileMap );

    return 1;
  }
  // keep DLL in memory
  else 
    return 0;
}

/*!
 * \brief blah
 *
 * blah
 */


A Creative & Interactive mIRC Scripting