Solved

VB6 App Strange Behavior

Posted on 2006-11-13
6
212 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 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:Mamtha1982
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 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create a duplicate finder Application 9 122
How to read File Date Created using VB6 8 52
RUNRMTCMD from AS/400 12 71
Error with a code discussed on this page 5 33
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

820 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