May 12th, 2003, 09:10 AM
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..
May 12th, 2003, 11:26 AM
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)
Suddenly noticed this was posted in the wrong forum. Please choose another forum next time, such as Genereal Chit Chat or Programming Scurity
May 12th, 2003, 12:01 PM
**Moved from Tutorials to General Chit Chat**
May 12th, 2003, 06:09 PM
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)
function testform(formname as form)
dim tempform as form
for each tempform in forms
if tempform is formname then
testform = true
testform = false
'end code listing
\"Knowledge is the Real Power\"
May 13th, 2003, 07:43 AM
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...
May 13th, 2003, 03:51 PM
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