Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB6 App Strange Behavior

Posted on 2006-11-13
6
Medium Priority
?
215 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:Praveen Kumar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 143

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:Praveen Kumar
ID: 17936498
angel,
i assume that,it is End instead of exit.
But the problem is same.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 12

Author Comment

by:Praveen Kumar
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 143

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:Praveen Kumar
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

660 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