-
VB help!!
hi all,
i m trying to write a vb code(program)..
it is like if someone is already running the program then he will not be able to launch it again unless he terminate the program first.. for example like Windows Media Player
anyone knows pls reply.. thanks alot..
-
You have to to use the win32api to do that. Here's how:
1. Call EnumProcesses() to receive an array of all the running process IDs.
2. Call OpenProcess() to get a handle to the process.
3. Call EnumProcessModules() to get an array of process property identifiers (I guess)
4. Call GetModuelFileNameEx() with the first HMODULE from the list in nr 3. That will return a complete path to an executable.
The rest i bet you can figure out yourself. BTW, I haven't tried this, I'm just referring to a post on Google groups (http://groups.google.com/groups?hl=e....cz%26rnum%3D1)
Edit:
Suddenly noticed this was posted in the wrong forum. Please choose another forum next time, such as Genereal Chit Chat or Programming Scurity :)
-
**Moved from Tutorials to General Chit Chat**
-
hmm, don't know wether this is what you want
you can test whether a form of your application is already loaded
'begin code listing
private sub form_load()
msgbox "form2 is loaded" & testform(form2)
end sub
function testform(formname as form)
dim tempform as form
for each tempform in forms
if tempform is formname then
testform = true
exit function
end if
next
testform = false
end function
'end code listing
-
i haven't tried it yet.. but i will try later.. anyway, thanks alot guys...
O btw, i did look for the General Chit Chat forum but perpahs i overlook it.. sorry...
-
yes have a message box come up if he tries to open more than one, if you know a little about vb a msg_box code isn't that hard to make