Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
No. of people using a DBF
Message
From
31/03/2005 10:58:12
 
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Environment versions
Visual FoxPro:
FoxPro Dos
Miscellaneous
Thread ID:
00999886
Message ID:
01000346
Views:
45
Can you post the code for intrandrange()


>Hi Craig
>
>I have tried something like the following but have a problem is that at times the 2nd-3rd user is allowed to FCREATE() the file already assigned to the prev user ie. 1st-2nd resp. How to avoid allowing to use the same filename. I have tried it on the same machine seperate DOS boxes.
>
>Please advise.
>
>
        *** seed and ignore the first returned value
>        m.zfilename = intrandrange(00000000, 99999999, 87654321)
>
>
>        FOR m.zusercount = 1 TO m._vsomaxuser
>                *** get an integer for use as a filename
>                m.zfilename = ALLTRIM(STR(intrandrange(00000000, 99999999))) + ".acu"
>                m.zfh       = FCREATE(m.zfilename)
>wait window "1" + str(m.zusercount) + " " + m.zfilename + str(m.zfh)
>
>                IF m.zfh > -1
>                        *** Person is no longer using the application and did not
>                        *** log out properly, now that we have the open handle keep it
>                        *** open and exit
>                        EXIT
>                ENDIF
>        ENDFOR
>
>
>wait window "2" + str(m.zusercount) + " " + m.zfilename + str(m.zfh)
>        IF (!m.nomore) AND (m._vsolan AND m.zusercount > m._vsomaxuser AND m._vsomaxusers > 0)
>                * WARNING !!! Maximum
>                * users Allowed; Close Idle Instances of this Applcation before
>                * ReStarting; If a Node was Hanged or ReBooted Please ReStart ALL
>                * Instances again
>
>                m.nomore = .T.
>        ENDIF
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform