Solved

VB6 App Strange Behavior

Posted on 2006-11-13
6
209 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now