// -------------------------------------------------------------------------- // ========================================================================== // File: TDPApplicationDesc.CPP // Authors: BCB_Code_Generator v1.70, // Darren Dwyer (source code, documentation, demos, website), // Hugh Edwards (documentation, icons), // Brian Austin (some source code, documentation) // Description: This file contains the code for the TDPApplicationDesc // Component // // "TDx_Play_Library v1.70" // (c) 2003 BCB-Tools.com Pty. Ltd., Sydney, Australia. // All Rights Reserved. // // Refer to the 'Licence.Txt' file for licencing & copyright information. // ========================================================================== // -------------------------------------------------------------------------- // #includes ... // -------------------------------------------------------------------------- #include #pragma hdrstop // -------------------------------------------------------------------------- #include "TDPApplicationDesc.H" // -------------------------------------------------------------------------- #pragma link "TDx_Library_Defns" #pragma link "TDx_Library_Functions" #pragma link "TDx_Play_Library_Defns" #pragma link "TDx_Play_Library_Functions" // -------------------------------------------------------------------------- // Object Registration... // -------------------------------------------------------------------------- #if (__BORLANDC__ >= 0x0530) // BCB Version 3+ #pragma package(smart_init) #endif // -------------------------------------------------------------------------- static inline void ValidCtrCheck(TDPApplicationDesc*) { new TDPApplicationDesc(NULL); } // -------------------------------------------------------------------------- namespace Tdpapplicationdesc { #if (__BORLANDC__ >= 0x0530) // BCB Version 3+ void __fastcall PACKAGE Register() #else void __fastcall Register() #endif { TComponentClass classes[1] = {__classid(TDPApplicationDesc)}; RegisterComponents("TDx_Play", classes, 0); } } // -------------------------------------------------------------------------- // Constructor: TDPApplicationDesc::TDPApplicationDesc() // Description: The default constructor for the TDPApplicationDesc object. // -------------------------------------------------------------------------- __fastcall TDPApplicationDesc::TDPApplicationDesc(TComponent* Owner) : TComponent(Owner) { Clear(); } // -------------------------------------------------------------------------- // Destructor: TDPApplicationDesc::~TDPApplicationDesc() // Description: The destructor for the TDPApplicationDesc object. // -------------------------------------------------------------------------- __fastcall TDPApplicationDesc::~TDPApplicationDesc() { } // -------------------------------------------------------------------------- // Property: AppLauncherName // Description: The AppLauncherName property references the name of the // launcher executable, stored as a unicode string. // // Once started by the lobby, the launcher application is // responsible for launching the application described in // TDPApplicationDesc::ApplicationName. // The launcher application must reside in the same directory as // the application. // -------------------------------------------------------------------------- AnsiString __fastcall TDPApplicationDesc::FGetAppLauncherName() { if ((LPWSTR)fAppLauncherName.c_str()!=fDPAPPLICATIONDESC2.lpszAppLauncherName) fAppLauncherName = fDPAPPLICATIONDESC2.lpszAppLauncherName; return fAppLauncherName; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetAppLauncherName( AnsiString pAppLauncherName ) { fAppLauncherName = pAppLauncherName; fDPAPPLICATIONDESC2.lpszAppLauncherName = (LPWSTR) fAppLauncherName.c_str(); } // -------------------------------------------------------------------------- // Property: AppLauncherNameA // Description: The AppLauncherNameA property references the name of the // launcher executable, stored as an ANSI string. // // Once started by the lobby, the launcher application is // responsible for launching the application described in // TDPApplicationDesc::ApplicationName. // The launcher application must reside in the same directory as // the application. // -------------------------------------------------------------------------- AnsiString __fastcall TDPApplicationDesc::FGetAppLauncherNameA() { if ((LPSTR)fAppLauncherNameA.c_str()!=fDPAPPLICATIONDESC2.lpszAppLauncherNameA) fAppLauncherNameA = fDPAPPLICATIONDESC2.lpszAppLauncherNameA; return fAppLauncherNameA; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetAppLauncherNameA( AnsiString pAppLauncherNameA ) { fAppLauncherNameA = pAppLauncherNameA; fDPAPPLICATIONDESC2.lpszAppLauncherNameA = (LPSTR) fAppLauncherNameA.c_str(); } // -------------------------------------------------------------------------- // Property: Application // Description: The Application property identifies the application launching // the session. // // This identifier should be the same as // TDPSessionDesc::Application when hosting an application. // -------------------------------------------------------------------------- GUID __fastcall TDPApplicationDesc::FGetApplication() { return fDPAPPLICATIONDESC2.guidApplication; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetApplication( GUID pApplication ) { fDPAPPLICATIONDESC2.guidApplication = pApplication; } // -------------------------------------------------------------------------- // Property: ApplicationName // Description: The ApplicationName property references the applications // name, stored as a unicode string. // // This is a non-localized property, use // TDPApplicationDesc::DescriptionA and // TDPApplicationDesc::Description for localization of the // application name. // -------------------------------------------------------------------------- AnsiString __fastcall TDPApplicationDesc::FGetApplicationName() { if ((LPWSTR)fApplicationName.c_str()!=fDPAPPLICATIONDESC2.lpszApplicationName) fApplicationName = fDPAPPLICATIONDESC2.lpszApplicationName; return fApplicationName; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetApplicationName( AnsiString pApplicationName ) { fApplicationName = pApplicationName; fDPAPPLICATIONDESC2.lpszApplicationName = (LPWSTR) fApplicationName.c_str(); } // -------------------------------------------------------------------------- // Property: ApplicationNameA // Description: The ApplicationNameA property references the applications // name, stored as an ANSI string. // // This is a non-localized property, use // TDPApplicationDesc::DescriptionA and // TDPApplicationDesc::Description for localization of the // application name. // -------------------------------------------------------------------------- AnsiString __fastcall TDPApplicationDesc::FGetApplicationNameA() { if ((LPSTR)fApplicationNameA.c_str()!=fDPAPPLICATIONDESC2.lpszApplicationNameA) fApplicationNameA = fDPAPPLICATIONDESC2.lpszApplicationNameA; return fApplicationNameA; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetApplicationNameA( AnsiString pApplicationNameA ) { fApplicationNameA = pApplicationNameA; fDPAPPLICATIONDESC2.lpszApplicationNameA = (LPSTR) fApplicationNameA.c_str(); } // -------------------------------------------------------------------------- // Property: CommandLine // Description: The CommandLine property references command line arguments // passed to the executable when launching from a lobby, stored // as a unicode string. // -------------------------------------------------------------------------- AnsiString __fastcall TDPApplicationDesc::FGetCommandLine() { if ((LPWSTR)fCommandLine.c_str()!=fDPAPPLICATIONDESC2.lpszCommandLine) fCommandLine = fDPAPPLICATIONDESC2.lpszCommandLine; return fCommandLine; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetCommandLine( AnsiString pCommandLine ) { fCommandLine = pCommandLine; fDPAPPLICATIONDESC2.lpszCommandLine = (LPWSTR) fCommandLine.c_str(); } // -------------------------------------------------------------------------- // Property: CommandLineA // Description: The CommandLine property references command line arguments // passed to the executable when launching from a lobby, stored // as an ANSI string. // -------------------------------------------------------------------------- AnsiString __fastcall TDPApplicationDesc::FGetCommandLineA() { if ((LPSTR)fCommandLineA.c_str()!=fDPAPPLICATIONDESC2.lpszCommandLineA) fCommandLineA = fDPAPPLICATIONDESC2.lpszCommandLineA; return fCommandLineA; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetCommandLineA( AnsiString pCommandLineA ) { fCommandLineA = pCommandLineA; fDPAPPLICATIONDESC2.lpszCommandLineA = (LPSTR) fCommandLineA.c_str(); } // -------------------------------------------------------------------------- // Property: CurrentDirectory // Description: The CurrentDirectory property references the current // directory path, stored as a unicode string. // // In most circumstances, this will be identical to // TDPApplicationDesc::Path or TDPApplicationDesc::PathA. // -------------------------------------------------------------------------- AnsiString __fastcall TDPApplicationDesc::FGetCurrentDirectory() { if ((LPWSTR)fCurrentDirectory.c_str()!=fDPAPPLICATIONDESC2.lpszCurrentDirectory) fCurrentDirectory = fDPAPPLICATIONDESC2.lpszCurrentDirectory; return fCurrentDirectory; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetCurrentDirectory( AnsiString pCurrentDirectory ) { fCurrentDirectory = pCurrentDirectory; fDPAPPLICATIONDESC2.lpszCurrentDirectory = (LPWSTR) fCurrentDirectory.c_str(); } // -------------------------------------------------------------------------- // Property: CurrentDirectoryA // Description: The CurrentDirectory property references the current // directory path, stored as an ANSI string. // // In most circumstances, this will be identical to // TDPApplicationDesc::Path or TDPApplicationDesc::PathA. // -------------------------------------------------------------------------- AnsiString __fastcall TDPApplicationDesc::FGetCurrentDirectoryA() { if ((LPSTR)fCurrentDirectoryA.c_str()!=fDPAPPLICATIONDESC2.lpszCurrentDirectoryA) fCurrentDirectoryA = fDPAPPLICATIONDESC2.lpszCurrentDirectoryA; return fCurrentDirectoryA; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetCurrentDirectoryA( AnsiString pCurrentDirectoryA ) { fCurrentDirectoryA = pCurrentDirectoryA; fDPAPPLICATIONDESC2.lpszCurrentDirectoryA = (LPSTR) fCurrentDirectoryA.c_str(); } // -------------------------------------------------------------------------- // Property: Description // Description: The Description property references the localized description // of the application, stored as a unicode string. // // This value should be set to NULL if no localized unicode // application description is required. // // TDx_PlayLobby::EnumLocalApplications() will return this value // if present, otherwise TDPApplicationDesc::DescriptionA will // be converted to unicode and returned. If neither exist, // TDPApplicationDesc::ApplicationName will be returned. // -------------------------------------------------------------------------- AnsiString __fastcall TDPApplicationDesc::FGetDescription() { if ((LPWSTR)fDescription.c_str()!=fDPAPPLICATIONDESC2.lpszDescriptionW) fDescription = fDPAPPLICATIONDESC2.lpszDescriptionW; return fDescription; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetDescription( AnsiString pDescription ) { fDescription = pDescription; fDPAPPLICATIONDESC2.lpszDescriptionW = (LPWSTR) fDescription.c_str(); } // -------------------------------------------------------------------------- // Property: DescriptionA // Description: The DescriptionA property references the localized // description of the application. // // This value should be set to NULL if no localized ANSI // application description is required. // // TDx_PlayLobby::EnumLocalApplications() will return this value // if present, TDPApplicationDesc::ApplicationNameA will be // returned. // -------------------------------------------------------------------------- AnsiString __fastcall TDPApplicationDesc::FGetDescriptionA() { if ((LPSTR)fDescriptionA.c_str()!=fDPAPPLICATIONDESC2.lpszDescriptionA) fDescriptionA = fDPAPPLICATIONDESC2.lpszDescriptionA; return fDescriptionA; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetDescriptionA( AnsiString pDescriptionA ) { fDescriptionA = pDescriptionA; fDPAPPLICATIONDESC2.lpszDescriptionA = (LPSTR) fDescriptionA.c_str(); } // -------------------------------------------------------------------------- // Property: ErrorValue // Description: The ErrorValue property contains the last error value // returned from a call to a TDPApplicationDesc method or // fget/fset. eg. DP_OK or DDERR_SURFACELOST or TDX_ERROR // -------------------------------------------------------------------------- HRESULT __fastcall TDPApplicationDesc::FGetErrorValue() { return fErrorValue; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetErrorValue( HRESULT pErrorValue ) { fErrorValue = pErrorValue; } // -------------------------------------------------------------------------- // Property: Filename // Description: The ApplicationName property references the file name of the // executable being launched, stored as a unicode string. // // The main executable should be launched, even if this requires // bypassing a stub executable. // -------------------------------------------------------------------------- AnsiString __fastcall TDPApplicationDesc::FGetFilename() { if ((LPWSTR)fFilename.c_str()!=fDPAPPLICATIONDESC2.lpszFilename) fFilename = fDPAPPLICATIONDESC2.lpszFilename; return fFilename; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetFilename( AnsiString pFilename ) { fFilename = pFilename; fDPAPPLICATIONDESC2.lpszFilename = (LPWSTR) fFilename.c_str(); } // -------------------------------------------------------------------------- // Property: FilenameA // Description: The ApplicationName property references the file name of the // executable being launched, stored as an ANSI string. // // The main executable should be launched, even if this requires // bypassing a stub executable. // -------------------------------------------------------------------------- AnsiString __fastcall TDPApplicationDesc::FGetFilenameA() { if ((LPSTR)fFilenameA.c_str()!=fDPAPPLICATIONDESC2.lpszFilenameA) fFilenameA = fDPAPPLICATIONDESC2.lpszFilenameA; return fFilenameA; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetFilenameA( AnsiString pFilenameA ) { fFilenameA = pFilenameA; fDPAPPLICATIONDESC2.lpszFilenameA = (LPSTR) fFilenameA.c_str(); } // -------------------------------------------------------------------------- // Property: Path // Description: The Path property references the path to the executable being // launched, stored as a unicode string. // -------------------------------------------------------------------------- AnsiString __fastcall TDPApplicationDesc::FGetPath() { if ((LPWSTR)fPath.c_str()!=fDPAPPLICATIONDESC2.lpszPath) fPath = fDPAPPLICATIONDESC2.lpszPath; return fPath; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetPath( AnsiString pPath ) { fPath = pPath; fDPAPPLICATIONDESC2.lpszPath = (LPWSTR) fPath.c_str(); } // -------------------------------------------------------------------------- // Property: PathA // Description: The Path property references the path to the executable being // launched, stored as an ANSI string. // -------------------------------------------------------------------------- AnsiString __fastcall TDPApplicationDesc::FGetPathA() { if ((LPSTR)fPathA.c_str()!=fDPAPPLICATIONDESC2.lpszPathA) fPathA = fDPAPPLICATIONDESC2.lpszPathA; return fPathA; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetPathA( AnsiString pPathA ) { fPathA = pPathA; fDPAPPLICATIONDESC2.lpszPathA = (LPSTR) fPathA.c_str(); } // -------------------------------------------------------------------------- // Property: Size // Description: The Size property contains the size in bytes of the internal // DPAPPLICATIONDESC2 structure. // -------------------------------------------------------------------------- dword __fastcall TDPApplicationDesc::FGetSize() { return fDPAPPLICATIONDESC2.dwSize; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetSize( dword pSize ) { fDPAPPLICATIONDESC2.dwSize = pSize; } // -------------------------------------------------------------------------- // Method: Clear() // Description: The Clear() method can be used to clear the contents of the // TDPApplicationDesc's internal DPAPPLICATIONDESC2 structure. // Note: if you have manually linked a structure member to a // chunk of memory, make sure you release this memory before // calling Clear(). // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::Clear() { ZeroMemory(&fApplication,sizeof(_GUID)); fErrorValue = DP_OK; fDPAPPLICATIONDESC2.dwSize = sizeof(DPAPPLICATIONDESC2); } // -------------------------------------------------------------------------- // Internal Structure Access // -------------------------------------------------------------------------- DPAPPLICATIONDESC2* __fastcall TDPApplicationDesc::FGetInternal_DPAPPLICATIONDESC2_Ptr() { return &fDPAPPLICATIONDESC2; } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::FSetInternal_DPAPPLICATIONDESC2( DPAPPLICATIONDESC2* pDPAPPLICATIONDESC2 ) { if (pDPAPPLICATIONDESC2==NULL) { fErrorValue = TDX_ERROR; if (FOnError) FOnError(this, "TDPApplicationDesc::FSetInternal_DPAPPLICATIONDESC2()", "TDX_ERROR", "The supplied DPAPPLICATIONDESC2* was NULL" ); return; } CopyMemory( &fDPAPPLICATIONDESC2, pDPAPPLICATIONDESC2, sizeof(DPAPPLICATIONDESC2) ); Internal_DPAPPLICATIONDESC2_Update(); } // -------------------------------------------------------------------------- void __fastcall TDPApplicationDesc::Internal_DPAPPLICATIONDESC2_Update() { } // --------------------------------------------------------------------------