| |
|
|
Michael Wodrich | because I one Weilchen needed, it from the Ärmel To shake...
Best wishes Michael Wodrich |
|
|
| Programmieren, das spannendste Detektivspiel der Welt. | 09/07/06 ▲ |
|
|
|
|
Michael Wodrich | and to Info of TS-Soft another Mutex-Variante from the Phorum of Ragnar Rehbein.
Gibts yet further Opportunities?
Best wishes Michael Wodrich |
|
|
| Programmieren, das spannendste Detektivspiel der Welt. | 09/07/06 ▲ |
|
|
|
|
| [quote:1532fb2073=Michael Wodrich] Gibts yet further Opportunities?
Best wishes Michael Wodrich[/quote:1532fb2073] clear CreateSemaphore(...) z.B. findeste somewhere in MSDN or PSDK But the Mutex not unähnlich. for the Mutexstring use I mostly a GUID. |
|
|
| |
|
|
|
| |
|
| |
|
|
|
Uwe ''Pascal'' Niemeier | Hello people!
here another Possibility by FileMapping. thereby won't only the new instance automatically exits, separate too The ongoing instance by Usermmessage informed, so tappt im dunkeln itself possibly into Vordergrund settle can. The principle can so strain, that possible Parameter, The with Calling the 2. instance transfer go, on The 1.instance weitergereicht go.
!
$H Messages.ph
$H windows.ph
declare MapHandle&,ViewHandle&
MapHandle&=~OpenFileMapping(~FILE_MAP_ALL_ACCESS,0,"Programm 1.1")
if MapHandle&--MappedFile present (contains %hwnd of already laufender instance)
ViewHandle&=~MapViewOfFile(MapHandle&,~FILE_MAP_ALL_ACCESS,0,0,32)
messagebox("Programm runs bereits","Meldung",0)
sendmessage(long(ViewHandle&,0),5066,0,0)--Message on 1. instance
~UnmapViewOfFile(ViewHandle&)
end
else--These Instant is The first > MappedFile lay out!
MapHandle&=~CreateFileMapping($FFFFFFFF,0,~PAGE_READWRITE,0,32,"Programm 1.1")
ViewHandle&=~MapViewOfFile(MapHandle&,~FILE_MAP_WRITE,0,0,32)
window 100,100-600,400----first here becomes the Window created!!
long ViewHandle&,0=%hwnd--lever in MappedFile write
endif
usermessages 16----WM_CLOSE
usermessages 5066--some worth, the high enough is for selbstdefinierte Msg.
while 1------------Eingabeschleife
waitinput
case %umessage=16:break--end
if %umessage=5066--------User Message of new instance
shownormal
setactivewindow(%hwnd)
setfocus(%hwnd)
print "Aktivierung through new Instanz"
endif
----further Eingabeabfragen
endwhile
--ought to with end access go:
~UnmapViewOfFile(ViewHandle&)
~CloseHandle(MapHandle&)
HTH Pascal |
|
|
| |
|
|
|
| good idea! and here the same only kürzer and without nötige Headerfiles:
|
|
|
| |
|
|
|
Jac de Lad | I find The best method is still by Mutex:
Jac |
|
|
| Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE) Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP | 09/07/06 ▲ |
|
|
|
|
Ragnar Rehbein | I use as mutexnamen (or. with filemapping) meanwhile with almost all programmen par$(0), means whom programmnamen inkl. way. but pay attention, that the backslsh raustranslatet becomes! I have almost always The demand, that one Program not twice launched go can, one start unterschiedlicher konfigurationen from different verzeichnissen or. through umbenenn the program should possible his. for terminalserverumgebungen is yet the prefix Global and Local interestingly (here must the backslash beiben!). so can z.b. prevented go, that one Program in several sessions carryed out becomes (z.b. a einplatzlizenz).
r.r. |
|
|
| |
|
|