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

Multiple Instances Of A Single User Class

Hi Friends,

can u plz throw some light on the following error

The V.Basic Developmetn Enviornment can't provide multiple instances of a single use class ..

This happens when i try to run my application
like i have a menu which has a menu item : create package
open package

now both of this share the same userinterface

the user interface form is defined in the open package project and i assume that create package calls that form .

so i was trying to debug the code and i tried to open a package and debug it
and then again i simple tried runnin the projct and triedf to create a package by clicking that create package ............. but throws me the erro

now if i restart my comp then it will work fine if i start with creating a package

thansk in advance

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Multiple Instances Of A Single Form?
Dim Form1 As New frmMain

How To Open Multiple Instances Of Sheets In A Single Excel Application
Hi all

I am trying to automate excel using vba, now i have writtent the code using which i can retrieve the information from the database and show the data in multiple instances of excel application. Now my problem is instead of showing it in multiple instances of the excel application, i want the data to be shown in single instance of excel application but in multiple worksheets.

How to open multiple worksheets in excel application through vba.



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

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 Class
I'm trying to get the hwnd of a button in a program, I get the parent hwnd fine, but when I get the hwnd of the button, I get another one. There's quite a few buttons with the class "Button" can I specify which one?

Using A Class Wrapper With Multiple Control Instances<RESOLVED>
I have seen a lot of user controls that make hotlinks out of label controls...I decided that just for fun I would use a different method and create a class wrapper for a label. Assuming it works, when I want to make a label a hotlink I will just create an instance of the class and assign the control to the class.

Can you tell me if this technique will work for multiple controls? This is how I am connecting the class to a single label named Label1...
Private objLink As clsLinkLabel

Private Sub Form_Load()
    Set objLink = New clsLinkLabel
    objLink.HookCtrl Label1
    objLink.Ctrl.ForeColor = vbRed
End Sub

Say I had 3 labels that I wanted to make hotlinks...would I just declare and create 3 separate instances of the class??


<EDIT> Nevermind! I was able to answer my own question, it works great. Using WithEvents I can delegate the label's events to the class module. I am also using the LoadCursor API to display the 'Official Hand Pointer' so I didn't have to use the cheesy custom mouse icon workaround...I am also capturing the mouse events from the class so I didn't have to mess with a timer for changing the link state. So far I am really happy with the result, I will post it once I am sure I am done with it.

God Bless America

Edited by - IDontKnow on 9/28/2003 1:10:28 PM

Preventing Multiple Instances Across User Accounts
Hi all,

I'm posting this query in the General board since no-one's really looked at my API board posting.

Basically, I require some code that can detect whether another instance of a program is running on another user account - like if I was running a program in an Admin account, I wouldn't want a guest user to be able to run it if they took over the computer, logging on to a different account.

Currently, I'm using code that prevent multiple instances on the same account using:

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

Where DuplicateInstance is a function, which checks for a multiple instance (besides other stuff), that returns a boolean variable.

Any help with this would be greatly appreciated!


Select Single Instances's
I'm populating a combo box from a column in a table through DAO. I was just wondering if there is anything i can do through an sql stament or some code to select just one of each occurance in a column. eg this column


would return


I could then put this in the combo box

Thanks a lot for the help

Class Instances Please Help
I need to be able to create an instance of a list class to store instances of an employee class.

my employee class is:

Public Class Employee
Public EmployeeID As Integer
Public EmployeeType As Integer
Public EmployeeName As String
Public EmployeeAddress As String
Public EmployeeSSN As Double
End Class

I really appreciate it in advanced

Instances Of A Class
I've created a small class (clsBase) containing 5 simple properties (strings and integers).
In my main form I declare two variables (i and j) as objects of this class.
I create i as an instance of clsBase and assign its properties.
Now, I want to create j as another instance of clsBase, and I want j's properties to be same as i's properties. However, if I use
set j = i

i and j are essentially identical, eg. if I then change one of j's properties, the corresponding property of i will change accordingly.
So, is it possible to assign the properties of one instance to be the same as the properties of another instance in one line of code instead
of assigning the properties individually, and still have the instances behave independently (ie. if I change the property of one of them,
the corresponding property of the other instance remains unchanged)...?

/Kim (

Copying Class Instances ?
How do you copy the contents of a class to another instance?

I have tried this, but it only seems to rename the instance, meaning that any changes to the new variable affect the original contents.

VB Code:
Dim test as clsTestDim testArr(1) as clsTest testArr(0).Test1 = 1testArr(0).Test2 = "a" testArr(1).Test1 = 2testArr(1).Test2 = "b" Set test = testArr(1)test.Test1 = 3 Msgbox testArr(1).Test1 'Displays 3  

I also tried doing simply

VB Code:
test = testArr(1)

which generates an error...

Is there any way to do this, without copying each property serarately?????? I need to copy the contents only, and don't want the original class instance to change when the new one does...

Thanks in advance!

How To Search Class Instances

I have a class and I want to search thorugh each instance of that class for
those instances that have a variable set to a specific value.

Does anyone have to code to do this?


How To Count Instances Of A Class

i have a class members

i want each member to have an id automatically assigned to it

i was thinking that i could count how many instances of the class (how many
members) there are and then add one to that for the id

but i don't know how to do this
can anyone help?


Updating Multiple Records Using Single Field Multiple Values..

i have a flex in whcih i am displaying records.

lets say there are 5 records in the flex, with srno 1, 2, 3, 4, 5 and out of these 5 records i want to update 3 records srno 1, 3, 5.

srno date

1 01/12/2005
2 02/12/2005
3 10/12/2005
4 10/12/2005
5 11/12/2005

Like in delete statement we use this syntax.

delete * from tablename where fieldname in ("fieldvalue")

can we use the same concept for updating single field date in my case

can we use update like given below

update tablename set date = " & "'" & Format(Date, "dd-MM-yyyy") & "'" & " where srno in ("1,3,5")

But even after using the above syntax my data is not updated and also im not getting any error msg

hope to get helpful replies



Sharing Data Between Class Instances
I have created an activex exe for the purpose of monitoring some services etc. and each service and the monitoring program open an instance of the class (activex exe) to read or write data. The problem is that I can't share data between them like you can with a C++ const variable. Is this possible?

Muliple Instances Of The Same ActiveX Class
Hi Guys (mainly Doug!),

How do I make a program load multiple instances of the same ActiveX class. I have the following code:


Set Tester(1) = Nothing
Set Tester(1) = CreateObject("Example.TestClass")

Set Tester(2) = Nothing
Set Tester(2) = CreateObject("Example.TestClass")

But both Tester(1) and Tester(2) are just loading the same control, so techncially speaking, Tester(1) and Tester(2) are just mirrors of one another.

I want to know how to load 2 independent ActiveX controlls. I thought the code wwould be the following, but it does not work:


Set Tester(1) = Nothing
Set Tester(1) = New CreateObject("Example.TestClass")

Set Tester(2) = Nothing
Set Tester(2) = New CreateObject("Example.TestClass")

Any Ideas? Because the above code wont work. To be a bit more clear, I am using ActiveX EXEs, and with the code I am uisng at the momney, only 1 process is loaded, and Tester(1) and Tester(2) are simple controlling the same process. What I want to hapeen is for 2 seperate processes to be loaded.

Class Modules With OLEObject Kill Own Instances
Class modules with OLEObject kill own instances

The goal : to have class which is able to add some OLE objects on the sheet runtime. Instances of the class must be accessible from any public/private module.

Okay, I've experimented for so long & getting quite tired ( ) of it. So I think it's time to call some help.

I hope there must be some solution. I NEED it.

Well actually what I need ? I need to have some class/object which create some OleObjects (images and buttons) runtime. Instances of the class must be accessible from any module as global object.

Object must becreated inside the Private Sub Workbook_Open() event or via Public Sub Auto_Open() in module. Inside the class are some function/procedures for adding CommandButtons on the sheet.

Sounds pretty easy and should be. But the reality is else (strange :-))...

Everytime I call some of the procedure which works with OLE objects (adding/deleting - I mean Add method) all instances of the class are killed. I'd REALLY like to know what's killing them ???

Without OLE procedures all seems to be working fine - the instances of the class stay alive for all the Excel/workbook session. So problem must be with OLEobjects. But I want to be able working with the OLE objects...

Now I'll provide simplified skeleton of the code of my project:

Modules :: Module1


Option Explicit

Public ole_obj_img As TOle_object_image

Public Static Function New_TOle_object_image() As TOle_object_image
Set New_TOle_object_image = New TOle_object_image
End Function

Public Sub Auto_Open()

Set ole_obj_img = New_TOle_object_image

ole_obj_img.sheet_idx = 1

ole_obj_img.add_image 'calling this cause destruction of the object (why ?)

'ole_obj_img.inc_counter offset:=10 'this work fine; no OLE inside

End Sub
Modules :: Module2


Public Sub alpha()

ole_obj_img.sheet_idx = 2
'other code

End Sub

Private Sub betta()

ole_obj_img.sheet_idx = 1
'other code

End Sub

Class Modules :: TOle_object_image
(Instancing = Private)


Option Explicit

Private sh_idx As Integer
Dim count As Integer
Dim count_removed As Integer
Private w As Worksheet

Private Sub Class_Initialize()
sh_idx = 0
count = 0
count_removed = 0
MsgBox "TOle_object_image initialized" 'only for debug
End Sub

Private Sub Class_Terminate()
MsgBox "TOle_object_image terminated" 'only for debug
End Sub

Property Let sheet_idx(uIdx As Integer)
sh_idx = uIdx
End Property

Property Get sheet_idx() As Integer
sheet_idx = sh_idx
End Property

Public Static Sub inc_counter(ByVal offset As Integer)
count = count + offset
End Sub

Public Static Sub add_image()
Dim tmp_ole As OLEObject
Dim i As Integer
Dim wo As OLEObjects

i = 0

Set wo = ThisWorkbook.Worksheets(sh_idx).OLEObjects

wo.Add ClassType:="Forms.Image.1", _
DisplayAsIcon:=False, Left:=10 + 30 * i, Top:=10 + 30 * i, Width:=20, Height:=20

Set wo = Nothing
count = count + 1
End Sub
Workbook code:


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set ole_obj_img = Nothing
End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)

Application.EnableEvents = False
Application.ScreenUpdating = False

If Sh.Index <> 1 And Sh.Name <> "system" And Sh.Name <> "runtime" Then

ole_obj_img.inc_counter offset:=255

'other code

End If

Application.ScreenUpdating = True
Application.EnableEvents = True

End Sub

What's killing the instances after inicialization ? If you know the solution provide some fix-code please too.

Any idea/solution what's wrong ?


Note: All test has been performed under Excel2k. In case you are interested in I added ZIP too.

Setting Old Class Instances For Garbage Collection
After you are done using a class instance you can remove its reference by doing this:

Set myclass = Nothing

Then is it automatically set for garbage collection as done in java or how does vb 6 deal with these?


Array Of Class Instances, Clearing Memory
My program has two classes, clsTable and clsTableManager.

clsTableManager is the class which controls all of the clsTable instances, using an array like this.

VB Code:
Private mTables() As clsTable

each clsTable instance has a property called Active which determines if this class still needs to be used.

Every so often I need to be able to loop through the array of clsTable instances and unload all those instances which are no long active (.Active = false) and reorder the array so that only Active clsTable instances remain.

So if I have the following instances

mTables(0) -> Active = True
mTables(1) -> Active = False
mTables(2) -> Active = True
mTables(3) -> Active = True
mTables(4) -> Active = False
mTables(5) -> Active = True

I need the function to destroy mtables(1) and mtables(4) and the new array should have only 4 entries like so...

mTables(0) -> Active = True
mTables(1) -> Active = True
mTables(2) -> Active = True
mTables(3) -> Active = True

I understand the concept behind this all, but I'm not sure how to do it so that the deleted class instances are removed completely from memory.

Creating/destroying Class Instances Across Event Procedures
I'm pretty new to object oriented programming, and I'm a little confused about how to implement a particular use of OOP with Visual Basic. Here is what I want to do: when the user clicks on a button, the code checks if an instance of my object exists; if an instance exists, the code should destroy it, and reconstruct a new one.

What confuses me is this code would be in an event handler, but you can't really instantiate a new instance in the handler, or it disappears when you leave the handler (right?). Once the object is created (when the user clicks), I need it to sustain itself for use in other procedures, outside of the button click. You can't initiate it when the form loads or in a Sub Main(), because I can't be sure that everything I need to create the object is available until the user clicks the button.

This is probably confusing, so forgive me, I'm new to this. I guess in general I'm wondering how you can instantiate an instance of an object in a procedure but not lose it when the procedure finishes (specifically an event procedure which can't return anything). And then identify that the object exists, destroy it, and recreate another when the procedure is executed again.

Thanks for the help.

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!


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

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 _
As Long

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

Public Sub ExecCmd(cmdline$)
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.


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?


Multiple Instances

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.



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.

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 problem... I'll give an example of what I'm using to connect to the current "AutoCAD" drawing....

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
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."

Several User Instances
Hi everybody!

I am making an emailserver and it is working pretty good, but my problem are the several instances!

What should i use to start a new process or instance when a new user connects without loading the form everytime?
Right now the server is using the same form for all users.

Should i use ActiveX or something like this?
How are "good" emailserver doing this?


How To Not Allow User To Run 2 Instances
How do I make it so the user can't run more than one instance of my program? I'm working in eVB and don't want them to open the program more than once on the handheld.

Any ideas?



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,

Multiple Excel Instances

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.


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

Public FormJob() As frmJobDetail
FormJobCnt = FormJobCnt + 1
ReDim Preserve FormJob(FormJobCnt)
Set FormJob(FormJobCnt) = New frmJobDetail
FormJob(FormJobCnt).Tag = Str(FormJobCnt)
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 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)

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

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

Set objWB = Nothing
Set objWS = Nothing
Set objExcel = Nothing

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:

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.?:

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?


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



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?


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!


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?


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?

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:

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!

Copyright 2005-08, All rights reserved