Difference between revisions of "PlugIn Development:GameEx Initialize Function"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
This function is called when GameEx initializes.<br />Using this function call, you can run code to do various things, like set up your log files or load your settings. I often use this function to run a thread when I need to download something in the background (or check for updates) and I don't need to wait for it to finish prior to GameEx launching.<br />You can return <span style="color:red;">'''TRUE'''</span> to continue processing the event or return <span style="color:red;">'''FALSE'''</span> and GameEx will not initialize your plugin. | This function is called when GameEx initializes.<br />Using this function call, you can run code to do various things, like set up your log files or load your settings. I often use this function to run a thread when I need to download something in the background (or check for updates) and I don't need to wait for it to finish prior to GameEx launching.<br />You can return <span style="color:red;">'''TRUE'''</span> to continue processing the event or return <span style="color:red;">'''FALSE'''</span> and GameEx will not initialize your plugin. | ||
<br /> | |||
== <span style="color:darkblue;">Code Examples</span> == | |||
== | === <span style="color:#003300;">VB.NET</span> === | ||
==== Structure ==== | |||
<span style=" | |||
<pre style="font-family:'Lucida Console', Monaco, monospace; border-color:#003300; background-color:#E0EEE0; border-style:dashed;"> | <pre style="font-family:'Lucida Console', Monaco, monospace; border-color:#003300; background-color:#E0EEE0; border-style:dashed;"> | ||
<StructLayout(LayoutKind.Sequential)> _ | <StructLayout(LayoutKind.Sequential)> _ | ||
Line 10: | Line 10: | ||
Public GameExVersion As String | Public GameExVersion As String | ||
End Structure</pre> | End Structure</pre> | ||
==== Function ==== | |||
<pre style="font-family:'Lucida Console', Monaco, monospace; border-color:#003300; background-color:#E0EEE0; border-style:solid;"> | <pre style="font-family:'Lucida Console', Monaco, monospace; border-color:#003300; background-color:#E0EEE0; border-style:solid;"> | ||
Public Function Initialize(ByVal InfoPtr As IntPtr) As Boolean | Public Function Initialize(ByVal InfoPtr As IntPtr) As Boolean | ||
Line 19: | Line 19: | ||
End Function</pre> | End Function</pre> | ||
<span style=" | === <span style="color:#003300;">C#</span> === | ||
==== Structure ==== | |||
<pre style="font-family:'Lucida Console', Monaco, monospace; border-color:#003300; background-color:#E0EEE0; border-style:dashed;"> | <pre style="font-family:'Lucida Console', Monaco, monospace; border-color:#003300; background-color:#E0EEE0; border-style:dashed;"> | ||
[ StructLayout( LayoutKind.Sequential )] | [ StructLayout( LayoutKind.Sequential )] | ||
Line 26: | Line 27: | ||
public string GameExVersion; | public string GameExVersion; | ||
}</pre> | }</pre> | ||
==== Function ==== | |||
<pre style="font-family:'Lucida Console', Monaco, monospace; border-color:#003300; background-color:#E0EEE0; border-style:solid;"> | <pre style="font-family:'Lucida Console', Monaco, monospace; border-color:#003300; background-color:#E0EEE0; border-style:solid;"> | ||
public bool Initialize(IntPtr InfoPtr) | public bool Initialize(IntPtr InfoPtr) | ||
Line 35: | Line 36: | ||
return true; | return true; | ||
}</pre> | }</pre> | ||
<br /> | |||
[[Category:PlugIn Development]] | [[Category:PlugIn Development]] |
Revision as of 06:10, 27 April 2014
This function is called when GameEx initializes.
Using this function call, you can run code to do various things, like set up your log files or load your settings. I often use this function to run a thread when I need to download something in the background (or check for updates) and I don't need to wait for it to finish prior to GameEx launching.
You can return TRUE to continue processing the event or return FALSE and GameEx will not initialize your plugin.
Code Examples
VB.NET
Structure
<StructLayout(LayoutKind.Sequential)> _ Public Structure GameExInfo Public GameExVersion As String End Structure
Function
Public Function Initialize(ByVal InfoPtr As IntPtr) As Boolean Dim Info As GameExInfo = DirectCast(Marshal.PtrToStructure(InfoPtr, GetType(GameExInfo)), GameExInfo)) 'This will output the current version of GameEx: Dim GameEx_Version As String = Info.GameExVersion Return True End Function
C#
Structure
[ StructLayout( LayoutKind.Sequential )] public struct GameExInfo { public string GameExVersion; }
Function
public bool Initialize(IntPtr InfoPtr) { GameExInfo Info = (GameExInfo) Marshal.PtrToStructure(InfoPtr, typeof(GameExInfo)); //This will output the current version of GameEx as a string: string GameEx_Version = Info.GameExVersion; return true; }