Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Multiple Instances Of VB6 ActiveX Dll


Hi. If I need to install multiple instances of VB6 activeX dll:

1) one copy at with setting A: C:Program FilessoftwareA
2) another copy at with setting B : C:Program FilessoftwareB

since I build the installer I need to register it, is it possible the softwareA and softwareB can identify it correctly?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
ActiveX Dll - Multiple Instances!
Hey all,

I am using the INET control to download files...
I would like to call my downloader DLL with a given URL

I have one main form to call the dll as follows:

Dim obj As New Project1.Class1
Set obj = CreateObject("Project1.Class1")
obj.start_dll (Text1.Text) 'Assign number
Set obj = Nothing

Problem is, this does not open multiple instances.
Even when I place another sub with everything renamed to "obj2" it still doesn't open a second instance of my dll.

I want to be able to send a number to each and every instance so they can be closed.

What would be the best method:
To...

Call the same DLL multiple times (NEW INSTANCE)
Be able to close them later by a number that will be assigned when the instance is created.

Thanks for your help!
Jeffrey

Multiple Instances Of ActiveX?
I have an app where I need to create multiple "instances" of an ActiveX.

For example, I can add the activex to my project as "actx".

Then I'd like to be able to do something like this:

dim myactx() as actx
Redim myactx(4)
...code....
erase myactx
redim myactx(10)
etc, etc.

Right now the activex works with files, and it seems that it does not "release" the directory containing the file (so I can delete the directory) properly. I release the file (actx.src=""), and can then delete the file, but not the containing directory.

I'm hoping I can fix this by "deleting" or erasing the instance of the activex so that the directory is released.

Thanks for any help you can provide....

Multiple Instances Of ActiveX At Runtime???
I'd like to know if I can create/add multiple instances of an ocx at runtime?

The ocx is third party - I have a license for it, but not the source code.

I'd like to be able to do something like this (Pseudo-code):

Code:
Dim ocxArray() as TheActiveX

Redim ocxArray(2)

ocxArray(0).Load "C:myfile"
ocxArray(1).Load "C:yourfile"
ocxArray(2).Load "C:ourfile"

...etc....

I've tried "CreateObject":
Dim junk as Object
Set junk=CreateObject("TheActiveX")
but I get "Runtime error 429 ActiveX can't create object"

I've tried "Controls.Add"
Dim junk as Control
Set junk=Control.Add("TheActiveX", "myname")
but I get "Runtime error 711 Invalid class string Looking for object with ProgID TheActiveX"

Can anyone help???

Multiple Instances Of ActiveX At Runtime?
I'd swear I've seen this done, but can't remember how.

I'd like to create an array of an activex component at runtime so that I can access multiple instances of it.

Something like this pseudo-code:


Code:
Dim AXarray() as myActiveX

Private Sub Form_Load()
ReDim AXarray(2)

AXarray(0).load "myfile"

AXarray(1).load "yourfile"

AXarray(2).load "ourfile"
End Sub


Can someone please help?

Thanks.

Loading Multiple Instances Of An Activex EXE From A Standard EXE
Hi,

I am working on an Application in Visual basic, I will explain what I need and what I am doing.

1. I have a main Standard EXE
2. I have a DLL
3. I have a ActiveX EXE

From the Main standard EXE I want to invoke the Activex EXE. I am using the DLL in both the standard and the ActiveX Exe, I am able to communicate from the main to the Activex EXE, In this case I am able to load only one Instance of the ActiveX EXE, but I want to load multiple Instances.

I tried out different ways one such way is In the standard EXE I have a container form (I am instanciating the form for every call in which I have the reference to the DLL and using the New key word I am creating the new Instance) that would Interface with the DLL and then Invoke the Activex EXE, Every time I am calling the Activex here I am using Createobject in the DLL to create the object of the Activex exe and then load the forms. The second time I call the forms are not being loaded on debugging thru the code I see that Form_Load event is not being fired as the form is already loaded in the memory. Why is not creating another Instance of the Activex EXE, any light on this would really help me. Or If any one has a better Idea can help me solving this problem out.

Thanks in advance
Raj

Allow Multiple Instances?
I am using the code below to run a script. The VB executes the script, waiting for it to finish before moving on. The problem is when more than one person uses this, only the person that pressed the execute button first gets the script to run. Is there a way to modify the code to allow multiple users to run scripts at the same time? Sorry if this is a dumb question, but I'm a VB noob. Thanks!


Code:

Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type

Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type

Private Declare Function WaitForSingleObject Lib _
"kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds _
As Long) As Long

Private Declare Function CreateProcessA Lib "kernel32" _
(ByVal lpApplicationName As Long, ByVal lpCommandLine As _
String, ByVal lpProcessAttributes As Long, ByVal _
lpThreadAttributes As Long, ByVal bInheritHandles As Long, _
ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, _
ByVal lpCurrentDirectory As Long, lpStartupInfo As _
STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) _
As Long

Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject _
As Long) As Long



Public Sub ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim ret As Integer

' Initialize the STARTUPINFO structure:
start.cb = Len(start)

' Start the shelled application:
ret = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)

' Wait for the shelled application to finish:
ret = WaitForSingleObject(proc.hProcess, INFINITE)
ret = CloseHandle(proc.hProcess)
End Sub

Multiple Instances Of .exe
I created an .exe file to do some processing and called it from an outside program via the Shell function. The exe does its job wonderfully. However, it does not end after it finishes its processing. I ran the program and it called the .exe file (via the shell function) 3 times, then when I check the server, 3 instances of the executable are running and seems like the code is never terminating.

What could I have done wrong? I can copy paste my code if someone wishes to look at it.

Thanks

Multiple Instances
How can I create multiple instances of MyForm?

Multiple Instances
Hey guys I have a program that uses unload me to exit. But sometimes when i load it again and take a look in task manager I can see the program there several times. is there a way to make it only have one instnace?

thanks

Multiple Instances
Hello,

Is it possible to have multiple instances of this control on a form? I've been trying to use a control array (using; load ctrlUserControl(1)) and this is causing an error and crashing VB.

Thanks

Laurence

Multiple Instances Of Ie
hey guys found another issue and did some reading but haven't found an answer so hopefully you guys can help I've got my program that controlls IE however if the user opens a new window the program will not control that new window I know there is a way to do this because I have seen it before but does anyone know how to do this?

Multiple Instances
hi guys,

I am making a chat kind of thing.
When One user1 PM's another user2, I open a form to display this message, now in the meantime another user3 PM's user2 also. then I open another form to display the message to the user2.

Prob:
But one The user1 again sends the message to user2 - how do I "access" the first form window which I opened for him to display the message.

I hope I havent confused u people - am Confused myself with the q I put.

ANyone help me?

Multiple Instances
Ok, I've got a weird question here.... I want to connect to a document in a certain application...no problem... I'll give an example of what I'm using to connect to the current "AutoCAD" drawing....


Code:
Dim myApp As AcadApplication
Dim myDoc As AcadDocument

Private Sub Form_Load()
Set myApp = GetObject(, "AutoCAD.Application")
Set myDoc = myApp.ActiveDocument
Me.Caption = "Connected to AutoCAD drawing (" & myDoc.Name & ")"
End Sub


My question is... "If there are multiple instances of AutoCAD open, how can I connect to each one?" The way it works now is it grabs the first instance of AutoCAD, I need to have either a document variable for each instance of AutoCAD or one instance of my program for every instance of AutoCAD...

Thanks in advance if anyone can help....

Multiple Instances
hello
how can have multiple instances of my form
i want to open several instance of my form at the same time
how can i do it?
can anyone give suggestions.

Multiple Instances
Been bouncing an idea around in my head for a while now. Looking like I need some help with it.

So, basically my process right now looks something like this:

Copy a ZipFileA from Remote Server --> Process ZipFileA locally --> Send ZipFileA to another Remote Server

Simple, right? The problem is that we're talking around 60 zip files from various remote servers in various subfolders.

What I'd love to do is start downloading ZipFileB while I'm processing ZipFileA locally.

That make sense?

Everything is completely modular, and everything is processed via various subroutines in those modules.

How is this possible? I'm sure it would involve the DoEvents function, but how would you handle it specifically?

TIA for the advice.

Tristan Wolf

Confucious say, "Man who fight salmon should use right hook."

Instances Of A Control In Activex Dll
I created an activex dll

This contains a class and form , which would be shown modally once a function of my class in the dll is called. it has some parameters

Now the form contains an activex control ( a custom command button ) ( total 8 such controls )


Depending on the parameter of the function , the form decides which custom button(s) has to be shown on the form and where to place them .

After compeleting the development work , I conluded the following :

1. if i am using object variables of the activex control type ( custom button in this case ) , the activex dll results in illegal operation some time or the other .

2. if the dll is tested in a project group ( in same ide ) . it works with no problems.

3. Just to make sure the problem is not really with custom button or my actvex dll ,
I tested the same for richtextbox control in a differnt dll project .
I used object variables of richtextbox type and the same illegal opration message

Sometimes it shows pagefault in msvbvm60.dll and sometimes in kernel32.dll

Somehow i have developed what i want .

But the message really is horrifying .

why there is a problem in using runtime instances of a control in activex dll ?
Anybody else faced these problems ? Any suggestions ?

Thanks

Multiple Communication Instances
Hi Guys,
I have a GUI that serially communicates with a board and gets memory content continously(monitoring the content at run-time) based on the memory location input by the user. Now, I wanna have multiple instances of the GUI that can accomplish the same task(get memory contents for different memory locations at the same time).Any ideas, please let me know.

Best Regards,
Swapna

Multiple Excel Instances
HI,

I have a Visual basic program that create 2 instances of excel running. These instances are hidden from the taskbar so the user will not know it is running. When the program closes normally the instances of excel created by my program will close and exit excel.

My problem is if the program crashes, how to i get an object handle to the hidden instances of excel? Getobject will only get the first instance of excel, how do i get the second, and what happen if the user has an instance of excel running when the program crashes, you have 3 instances. If i could get an object handle to each to of the instances in turn i could work out whcih need to be closed and which shouldn't. I can get there PID number but form there how to i get an object handle to the process?

My idea was to work thourgh all the PID's of excel running and work out if they were from a crash of my program or are the users instances.

Peter

Multiple Form Instances
I'm using the following code to open multiple instances of a form:


Code:
Public FormJob() As frmJobDetail
.........................................................
FormJobCnt = FormJobCnt + 1
ReDim Preserve FormJob(FormJobCnt)
Set FormJob(FormJobCnt) = New frmJobDetail
FormJob(FormJobCnt).Tag = Str(FormJobCnt)
FormJob(FormJobCnt).Show
How can I loop through the instances of FormJob that are open? FormJob contains a public variable (JobNum) that I want to look at for each open form. If that job is already open, then I don't want to open another instance of it.
I've tried:

dim frm as Form
for each frm in FormJob

but I get an error "For Each control variable on arrays must be a variant"

Multiple Instances Of The Same Dialog Box
Hi All...

Normally I program in VC++ and not in VB. So I have a rather basic question for you: How can I show i.e. 5 times the same dialog box(but with different data inside) on my screen at the same time? I need it as I receive data from an external program and need to change this data as soon as I receive it (the dialogboxes help to apply changes to these data).

I created a cls and a form for my dialogbox. But when I create a new instance of the class which instantly creates and shows a new dialogbox, it overwrites the old dialogbox which was already on the screen. In VC++, when I create a new object from my class, it creates a new instance and shows nicely 2 the same dialogboxes on my screen. Not in VB.

Can someone help me in this?

Thanks already!

Multiple Instances Of A Program....
I can use EnumProcesses, EnumProcessModules, and GetModuleFileNameEx to determine how many of my ActiveX exe's are running.

But how do I then set an object in VB 6 to one of those instances?

Multiple Instances Of A Form
In my MDI application, a user can open multiple instances of the same form, (Public POForm() As New frmPODetail). Each of these forms can open another form (frmPOItem, non-child, modal). frmPOItem needs to return data to the form that called it.

How do I determine which instance of POForm called it?

I tried creating a public variable "CallingForm AS Form" and using this statement: Set frmPOItem.CallingForm = ME. If I then check CallingForm.Name, it is "frmPODetail", not POForm.

Multiple Instances Of Excel??
Hello again,

so here is the problem, and example of my code will follow the message...I have a file..I am looping through it, if this current record is of type "a" then it should be written to excel file1 if it is of type "b" then it should be written to excel file2. I have tried to open one excel application and then have initialized 2 different workbooks, and 2 worksheets, and 2 ranges...everything appears to be running smoothly until the 2nd "call objws.saveas" is executed. I get an error saying that the saveas function failed...here is my code where am i going wrong. and can I just have a second worksheet with one excel app and one excel workbook?? thanx in advanced you guys rule!!!!


Dim objExcel As Excel.Application
Dim obj2Excel As Excel.Application

Dim objWB As Excel.Workbook
Dim obj2WB As Excel.Workbook

Dim objWS As Excel.Worksheet
Dim obj2WS As Excel.Worksheet

Dim objRng As Excel.Range
Dim obj2Rng As Excel.Range

et objExcel = New Excel.Application
Set objWB = objExcel.Workbooks.Open("p:arieltestRSICharolette.XLT") '("p:arieltestTest604.XLT")
Set objWS = objWB.Worksheets(1)
objWS.Range("A:Z").Clear

Set obj2Excel = New Excel.Application
Set obj2WB = objExcel.Workbooks.Open("p:arieltestRTCCharolette.XLT")
Set obj2WS = objWB.Worksheets(1)
objRTCWS.Range("A:Z").Clear

then here would be my loops and conditional testing which is all running ok...then i try to save here

Call objWS.SaveAs(fileName:=RSIFileName) '
objWB.Close savechanges:=True

'this next line is where i get the error!!!!!!!!!!!!!
Call obj2WS.SaveAs(fileName:="p:arieltestATTA011b.xls") '
obj2WB.Close savechanges:=True

objExcel.Quit
Set objWB = Nothing
Set objWS = Nothing
Set objExcel = Nothing

obj2Excel.Quit
Set obj2WB = Nothing
Set objRTCWS = Nothing

Set obj2Excel = Nothing

Multiple Instances Of Dll Classes
Hi, I've written an application that loads several other VB dlls as plugins. You drop some into a folder and are loaded and initialized at startup.

I also also want it to be possible to create several instances of the dll classes. Right now I've coded this:


Code:
Set .plugin = CreateObject(dllfilename & ".clsPlugin")
Where .plugin is the object in which I store the class, for example to call ".plugin.ShowWindow", which shows a form thru the class "clsPlugin" in the dll.

But the problem is, when I have several instances of the structure (which includes .plugin) and I call .plugin.ShowWindow" it comes up with the same form as all other instances. If I check one checkbox on the form, it also shows up on the other ones.

That's because I only set ".plugin = clsPlugin", right?

How can I create a new copy of that class like you can with normal classes, e.g.?:

Code:
Set .plugin = New clsPlugin

Multiple Instances Of A Program
Hi, I have just completed a visual basic program that is installed in my company computer. The program must be only have 1 instance of it running only. Does anyone knows what to add or change in my program to prevent multiple instances of it running?

regards

Multiple Form Instances
I am making a instant messaging program and I need to know how to create multiple instances of my IM form with each IM that comes thru. I know how to create a new instance but I don't know how to check if there is already an instance in memory from that user. So, my current code just opens a new IM window with every IM, even if there is one already open from that particular user. Any ideas?

Multiple Instances Of The Same Form
Still working on my lan messenger program and now i have a new problem:

When a user is sent a message the frmMessage is opened. But if the user doesnt close this window and another messagebox is sent then nothing happens!! I was wondering if any of the experts out there knew a way to open multiple instances of the same form simultaneously

Thanks

Lucas

Multiple Form Instances
Hi all,
Im currently making a program that needs to open a certain form more than once (at the same time). Whenever I do Form2.Show, it loads the form like it should, but doing it again just closes the open one and opens it again.

How can I have multiple instances of the same form open from within the program?

The form I wish to open more than once has a Winsock control on it. If I open more than one do I need to create some sort of control array? How would this be done?

Thanks

Closing Multiple Instances
If I use:
AppActivate ("Microsoft Internet Explorer")
SendKeys "%{F4}", True

That will close IE, how can I get it to do this (pseudo code is in between *

*Check if more than one instance ofInternet Explorer is open*
*If yes, close the most recent one or ones that are open using*
AppActivate ("Microsoft Internet Explorer")
SendKeys "%{F4}", True

Stoping Multiple Instances
Heya All,

I want to keep users from starting two copies of my application. I have seen this code around before, but can't seem to find it when I need it. It just searched all windows for the window handle, and if it finds it, brings the window to the front, otherwise executes as normal (since it would be the only instance). Any suggestions are greatly appriciated!

Cheers-
Austin

Prevent Multiple Instances Of The Same VB App
This may just be a Windows question...

How do I prevent my VB app from being opened multiple times on the same machine? Say - the user has the app open, and then opens it again - I'd like Windows to just switch to the open app and not open another.

Multiple Instances, Different Contents.
I have a question. Is it possible to have 6 or more different instances of the same window open on the screen at the same time, each having different contents in a label on it? (Or any control for that matter) How could I do that?

Thanks!

How Do I Do Multiple Instances Of The Same Form?
hi again,

could anyone tell me how do i do multiple instances of the same form? i am making an instant messaging program, and would like to have a form open for each person you are talking to, and so i will need to have that private message form load many times....unless there is another way to achieve this.

thanks for any help guys,

bratch

Multiple Application Instances
Hi all,

Firstly, apologies if this is in the wrong board, but it was the nearest board description that I could find for this particular problem.

I'm trying to find out how to prevent multiple instances of a program from happening from another user on the same computer. I can detect for instances on a local machine using the following code:

If App.PrevInstance Then
If DuplicateInstance = True Then
MsgBox "Application is already running"
End
End If
End If

DuplicateInstance is basically a function, that returns a boolean, that checks to see if a duplicate instance is already running.

However, I'm looking for some code that checks to see if another user on the same computer is running the program - causing a multiple instance.

Any help would be greatly appreciated.

RosscoPK

Prevent Multiple Instances?
Hey guys Is there a way so when I run my program it will check it see if it is already loaded and if so have a msgbox say its already open?

Thank you.

Multiple Instances Of A Class
I am making a video slotmachine game in VB6

One of the class modules is called "Images". The class contains public functions and subs.

In the application I have this

Code:
'
'
'
Public fruits() as Images
Public victoryImage As Images
Public DefeatImage As Images
Public coin As Images
Public background As Images
'
'
'
ReDim fruits(8)
Set fruits(1) = New Images
Set fruits(2) = New Images
Set fruits(3) = New Images
Set fruits(4) = New Images
Set fruits(5) = New Images
Set fruits(6) = New Images
Set fruits(7) = New Images
Set fruits(8) = New Images
'
'
'
Set victoryImage = New Images
Set DefeatImage = New Images
Set coin = New Images
Set background = New Images
'
'
'
For i = 1 To 8
'
'
fruits(i).getImage getCodeBase(), "Images/" & i & ".gif"
'
'
'
Next i
'
'
coin.getImage getCodeBase(), "Images/coin.gif"
'
'

My question is how can getImage() know which instance is being processed.

Multiple Instances Of Ole Server
Hi,

I am using VB application as OLE Client (VB form with ole container) and OLE server (out-process - exe) as VC++ ATL (exe) application. OLE server is REGCLS_SINGLEUSE. For each OLE client, OLE server instacne is getting launched and client requests are working fine. The problem is, after sometime (sporadic) second OLE server getting launched.

What i am expecting is once the OLE Server is instantiated for OLE client, it should be there until unless OLE Client is not shutdown and there should be only one OLE Server instance running for a each OLE client.

Please suggest what could be the problem. thanks for ur help.

Thanks,
~ Arun

Multiple MSCOMM Instances
Hi Guys,
I have a GUI that serially communicates with a board and gets memory content continously(monitoring the content at run-time) based on the memory location input by the user. Now, I wanna have multiple instances of the GUI that can accomplish the same task(get memory contents for different memory locations at the same time).Any ideas, please let me know.

Best Regards,
Swapna

Multiple Instances Of Same Form
Is it possible to "clone"/make many instancess of the same form? like msn. Msn can have unlimited windows. I didnt find any Index property in the properties window. please help.

Thanks in advance

Multiple Instances Of OCX Control
I created an OCX control and placed it into a VB project. When I placed 2 of the controls on a form it only showed 1 of them at run time. Any help would be appreciated.

Multiple Application Instances
Am calling a particular application from VB6 and i want to open only one window of that application so that if i try opening it when it's already open, no new window opens. help. am using the shell comand.

the code am using is below
VB Code:
Private Sub mnuReportService_Click()      app = Shell("D:\KAMUNDIS\Fixedasset Exes\pmtasklist2.exe", 1)End Sub

-----and when i close the parent application i waant to close this application too.

Multiple App Instances ... Stop It !!!!
Firstly ... before anyone shouts me down for being too lazy to use the Search facility (which is normally 100% accurate) can I just say I HAVE.

OK here goes ...

I have an app running, lets call it App. A
It has a button.
If the user presses a button, I load a new app, App B.
So far so good.

Now ... if the user presses the button in "App A" again, and App B is already loaded, then I want a messagebox to tell them they are dull (or words to that affect).
At the moment, the second button press does nowt, which to me is not very tidy.

Anyone ? (Probably Hack as he seems to answer ALL my stupid questions !)

Parsing Multiple Instances
I'm having a bit of trouble grasping a way to parse multiple results from a webpage source. The source looks like:

'misc html code here

<div id="resultsLine"><li class="name"><a href="resultpage1.html" tabindex="150">SCORPIO</a></li>

'misc html code here

<div id="resultsLine"><li class="name"><a href="resultpage2.html" tabindex="160">LEO</a></li>

'misc html code here

<div id="resultsLine"><li class="name"><a href="resultpage31.html" tabindex="170">ARIES</a></li>

'misc html code here

I want to parse out the words SCORPIO, LEO, and ARIES from this page. The words/results won't always be SCORPIO, LEO, and ARIES.

Thanks for any help.

Multiple Instances Of Excel
I have some VB code that opens up Excel using the SHELL command. If Excel is already open, the code opens up a new instance of Excel, which is what I want it to do. The problem is, I cannot figure out how to access that new instance. When I use Appactivate, I can only get to the original instance that was open before the code ran.

Is there any way to activate the most recent instance that was opened?

Thanks!

Multiple Instances Of Mozilla
I need to be able to run multiple instances of Mozilla FireFox because it leaks memory worse than is imagineable. However, by default it doesn't let me. I know there is a way around this with VB. Back in the day of VB3 a friend of mine came up with a way to get AIM to run multiple times, but I don't remember how he did it.

I did a search for this, but came up with nothing. There is a patch for Linux to allow multiple instances, but not without a rebuild. I really don't think I can manage to recompile Mozilla under Windows (only have VB6, yes I know the compilers are free to download, but that is probably beyond my skill level).

Anyone know how to do this, or know of code that allows this?

You can see my problem at http://www.vbforums.com/showthread.p...readid=292524, fourth post on page?

Using Multiple Instances Of Same Form...
I am using this code to spawn an instance of a form:

Public Sub New_Form()
Dim NewForm As Form2
Set NewForm = New Form2
NewForm.Show
End Sub

Is there some way that vb indexes each instance of the form so that they can be referred to from other forms?
I have a control array of winsocks on my main form and every time an instance of the form is loaded it is assigned a winsock control. How do i tell each winsock in the array which instance of the form it is associated with, in order to send the correct data to each form upon the data arrival event??

Multiple Instances Of Application
I don't want two or more instances of my application to run.

Ii use app.previnstance to detect that and it works out ok.

But I would like to end the second instance and pass control to the one running.

I have used the FindWindow function to get a handle on the window of the good app and it worked out ok.

But what do I do after that ? I want to set the focus the this app and close the second instance. The good application could be in either normal or minimized state. I've tried a mix of ShowWindow and AppActivate and nothing works. Any help is appreciated.

Private Sub Form_Load()

Const SW_MAXIMIZE = 3
Const SW_RESTORE = 9

Dim xAppName$
If App.PrevInstance Then
xAppName = "FormA"
xhwnd = FindWindow(0&, xAppName) ' Find the good instance
If xhwnd <> 0 Then
ShowWindow xhwnd, SW_RESTORE ' Restore it.. or else ??
AppActivate "FormA", False ' Activate it ?? Set focus to it ??
xhwnd = ShowWindow(xhwnd, SW_SHOWNORMAL) ' Show it in normal state ??
End ' End the current one ??
End If
End If
end

VB 6.0 Multiple Instances Of Forms
How can you open the same form multiple times on the same sceen with different information in them? (Different Instances of same form)) in MS VB 6.0?

Mdi Children Multiple Instances
I have a toughie (I think).

I have an MDI program running with several MDI children windows. Each of these children windows is sort of a "module" that does a specific part of the program (obviously).

My question is this: is it possible to spawn (initiate) a second instance of the MDI *child* window (in other words, a second copy of the module)?

For example, let's say I have an MDI child window that is a calculator. The user has the option to spawn more calculators within the MDI program.

My next question would be: how do I keep track of and reference the new "calculators" once they have been spawned? Are the forms then assigned an array at run time, or a whole new name alltogether?

Thanks for your help.

Copyright 2005-08 www.BigResource.com, All rights reserved