485
edits
(Updated "createmutex succeeded" test to test for NULL not ERROR_INVALID_HANDLE as per Frank Cheng's recommendation see https://support.dataaccess.com/Forums/showthread.php?67791-Limiting-Dataflex-Instances-to-1-per-Laptop&p=368346#post368346) |
|||
Line 12: | Line 12: | ||
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: | ||
<source lang=" | <source lang="dataflex"> | ||
Procedure Exit_Application | Procedure Exit_Application | ||
integer iVoid | integer iVoid | ||
Line 22: | Line 22: | ||
And in a package that gets hit on startup: | And in a package that gets hit on startup: | ||
<source lang=" | <source lang="dataflex"> | ||
// 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 43: | Line 43: | ||
Move "Unique String For My Application" To sID | Move "Unique String For My Application" To sID | ||
Move (CreateMuteX(0,1,AddressOf(sID))) To ghMuteX | Move (CreateMuteX(0,1,AddressOf(sID))) To ghMuteX | ||
If (ghMuteX <> | If (ghMuteX <> 0) Begin | ||
Move (GetLastError()) To iErr | Move (GetLastError()) To iErr | ||
If (iErr = ERROR_ALREADY_EXISTS) Begin // program is already | If (iErr = ERROR_ALREADY_EXISTS) Begin // program is already | ||
Line 70: | Line 70: | ||
Usage in SRC: | Usage in SRC: | ||
<source lang=" | <source lang="dataflex"> | ||
Use myPanel,pkg | Use myPanel,pkg | ||
Object Main is a myPanel | Object Main is a myPanel | ||
Line 76: | Line 76: | ||
Source myPanel.pkg | Source myPanel.pkg | ||
<source lang=" | <source lang="dataflex"> | ||
//////////////////////////////////////////// | //////////////////////////////////////////// | ||
// | // |