Run only one instance of your application: Difference between revisions

From DataFlex Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 11: Line 11:


In the SRC file within the panel object put this piece of code:
In the SRC file within the panel object put this piece of code:
<pre>
<source lang="vdf">
Procedure Exit_Application
Procedure Exit_Application
     integer iVoid
     integer iVoid
Line 18: Line 18:
     Forward Send Exit_Application
     Forward Send Exit_Application
End_Procedure
End_Procedure
</pre>
</source>
 
And in a package that gets hit on startup:
And in a package that gets hit on startup:
<pre>
<source>
// Constants
// Constants
Define ERROR_INVALID_HANDLE        for 6    //  taken from error.h of VS7
Define ERROR_INVALID_HANDLE        for 6    //  taken from error.h of VS7
Line 54: Line 55:
// create the mutex
// create the mutex
Send Create_MuteX_Object
Send Create_MuteX_Object
</pre>
</source>


=== Using FindWindow WinAPI ===
=== Using FindWindow WinAPI ===
Line 61: Line 62:


Usage in SRC:
Usage in SRC:
<pre>
<source>
  Use myPanel,pkg
  Use myPanel,pkg
  Object Main is a myPanel
  Object Main is a myPanel
</pre>
</source>


Source myPanel.pkg
Source myPanel.pkg
<pre>
<source>
  ////////////////////////////////////////////
  ////////////////////////////////////////////
  //
  //
Line 104: Line 105:
       End_Procedure // End_Construct_Object
       End_Procedure // End_Construct_Object
  End_class
  End_class
</pre>
</source>


The FindWindow technique is also discussed in the book [http://www.starzen.com/Products/DataFlexVDF/Books/tabid/56/Default.aspx Mastering Visual DataFlex] from Starzen.
The FindWindow technique is also discussed in the book [http://www.starzen.com/Products/DataFlexVDF/Books/tabid/56/Default.aspx Mastering Visual DataFlex] from Starzen.


[[Category: Tutorials]]
[[Category: Tutorials]]