Solved

VB6 App Strange Behavior

Posted on 2006-11-13
6
211 Views
Last Modified: 2010-05-03
hi,
It is a small MDI application, with 10 forms. Its uses one third party COM component. Entirely Developed in VB6 SP6.
Development System o/s is Windows 2000 server, Deployed to Win XP Home Sp2.

In the application i want to prevent multiple instance. so i used below code.

in the Form_Load

  If App.PrevInstance = True Then
     MsgBox("Application running already")
     End  'Tried Unload Me also
  End If

Now, when i tested in my Deleloment system, first instance everything is OK, but for second instance i am getting the message box saying that "Application running already", but still application is opened. And the second application is not producing any menu events.

When i tested in Win XP system, Application is not visible for first instance. In the task manager it is showing that application is running. If i try to open second instance, the message box "Application running already" came, but still second application is opened. As usual no events are firing in this application.
One more strange is that, first instance is taking 98% CPU resources in Win XP system (where it was 1 or 2 in Developed system)

Where is the problem? Application is running smoothly from Visual Studio 6 (SP6)

 

0
Comment
Question by:Mamtha1982
  • 3
  • 3
6 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17936377
If App.PrevInstance = True Then
     MsgBox("Application running already")
     unload me
     exit
  End If
0
 
LVL 12

Author Comment

by:Mamtha1982
ID: 17936498
angel,
i assume that,it is End instead of exit.
But the problem is same.
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 17936521
>i assume that,it is End instead of exit.
no. but I forgot to put sub :

If App.PrevInstance = True Then
     MsgBox("Application running already")
     unload me
     exit sub
 End If


now, >in the Form_Load< does that refer to the MDI main form's load?
note that I usually don't set a form a startup object (project properties), but a module (sub main), in which I check those things, and only when everything is ok, I load the main form
As you already say you have a third party control, that one might take some control from you...
0
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 12

Author Comment

by:Mamtha1982
ID: 17936560
angel,
It is now working Sub Main. May be problem with my component, where i instanciating that object in MDI load.
thank you very much.

But did u have any answer for my other problems, which i described in main post?
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17936618
what is the third-party component? has it to do with the menues?

you might try to locate the issue in your project, by either removing parts until the application works as requested (on a copy of the project, of course), or by creating a new project from scratch, adding things until the problem occurs.
0
 
LVL 12

Author Comment

by:Mamtha1982
ID: 17937802
That component is for implementing SMPP (www.easycomponents.com), i dont have any complaints on the component since it is working properly from past 3 years.
Every thing is fine when i debug from IDE, problem coming on deployed system(Win XP)
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question