PDA

View Full Version : How to identify two instances of same exe?



shanu
12-03-2007, 09:41 PM
Hi,

I want to open two audio files in two separate instance of a same exe at a time.

What I want to do?

In excel sheet I have two columns, one is for wav file(wav column) and other for mp3 file(mp3column).I have a exe named Softest.exe.I can open two instance of this exe at a time.In the form there are two buttons ("wav button" & "mp3button").While click on the "wav button" wav file should open on the first instance and while click on the "mp3button" mp3file should open on the second instance.

Can anyone help me from this problem?

figment
12-04-2007, 10:45 AM
if you post the code your using to open softest.exe then i should be able to help.

shanu
12-04-2007, 09:10 PM
Sure figment, I will. But no need to open that exe through code.We have already open that exe manualy.Only we want to pass the data to that exe.

Private Sub UserForm_Initialize()

SpectraLABConnection
End Sub
Private Sub SpectraLABConnection()
'Start a DDE connection with SpectraLAB - You should already have opened the program.
ch = DDEInitiate("Softest", "data")

End Sub
Private Sub WaitForSecond(Seconds)
'wait seconds
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + Seconds
newTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait newTime
End Sub
Private Sub Out_btn_Click()
x = caseid_txt.Text
OutD = Worksheets("1").Cells(1, 3).Value + "\"
OutF = Worksheets("1").Cells(x + 5, 3).Value
OutT = OutD + OutF

OutDecoderWav = OutT
MsgBox OutT
'generate strings for command lines
DDEOpenOutDecoderWavStr = "[File Open " + OutDecoderWav + "]"
DDEStopRunStr = "[Run " + StopSec + "]"

DDEExecute ch, DDEOpenOutDecoderWavStr
DDEExecute ch, DDEStopRunStr
WaitForSecond (2)
DDEExecute ch, "[Set Overlay 1]"
WaitForSecond (1)

End Sub

shanu
12-04-2007, 09:17 PM
I have tried with creating another object mh jst like ch. And replaced ch with mh and pasted in the second button for sending data to second instance where the two instances are already open.But while clicking second button , it send the data to same instance where the previous button have already sent.It replaces the previous data in the first instance.The second instance remains same without reflecting anything.

mikerickson
12-04-2007, 11:01 PM
Cross post http://www.ozgrid.com/forum/showthread.php?p=402536#post402536

shanu
12-04-2007, 11:20 PM
Sorry I am not aware of that cross posting.I wont do that.:(

figment
12-06-2007, 06:29 AM
i dont have the softest software, or if i do i dont know i have it. but i would try opeing the first instance in code, rather then sending data to a user created instance, this way you could open two instances in code, each set to there own varable. as for finding two manulay created instances. thats system code beyond my experiance.

shanu
12-06-2007, 08:58 PM
OKie figment its fine, But Y i created code for passing data to a manually created instance, becuase while opening this softtest it will throw two info messages with ok button.So the user have to press "Enter " Button twice.To overcome this i did code like that.I am not aware of controlling keyboard buttons using vb.

Can you please write code for that to Enter buttons also, if you trying to open that instance through code. Thanks for the patience and effort.:-)

figment
12-18-2007, 11:21 AM
wow i thought i had rplyed to this way back when. sorry, for geting past the error messages, try useing the send key function