system access violation

  • Thread starter Thread starter Me
  • Start date Start date
M

Me

Am new to vb dotnet and although I like what I've seen sofar, I
am experiencing pblms with system access violation "attempt to read write
protected memory".

This error happens when I open a second copy of the program.

Any help appreciated in finding the source for this error or preventing a
second copy
of the program drom being loaded.
 
Hello, Me!

M> This error happens when I open a second copy of the program.

Doest you program access any system resources ( e.g. files )?

M> Any help appreciated in finding the source for this error or preventing
M> a second copy
M> of the program drom being loaded.

To prevent second instance from being loaded you can use for e.g. named Mutex object
( http://dotnet.org.za/ernst/archive/2004/07/20/2887.aspx )
or
( http://www.codeproject.com/useritems/csharponeinst.asp )
or, using windows
( http://www.developerfusion.co.uk/show/3107/ )

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
Me,

I think we're going to need more information. What is your application
doing when it starts up? Are you using unmanaged resources or Win32
APIs?

Brian
 
On startup, the program accesses the registry to fetch the password for
login, then proceeds to
display the password input dialog and then the program loads. If I try to
load a second copy of the
program..

Before the second copy can display the password dialog, the system access
violation
message pops up and then the first program aborts.

Found that I had checked the following project option:


Make single instance application
^^^^^^^^^^^^^^^^^^^^^^^^^^
Select this check box to prevent users from running multiple instances of
your application. The default setting for this check box is cleared,
allowing multiple instances of the application to be run.
^^^^^^^^^^^^^^^^^^^^^^^^^^^

It quit crashing after I unchecked it.. Kind of ineligant way to prevent a
second copy to run.

Sooo I unchecked the box & now test for application presence on the desktop
using a boolean in the registry.
 
Me,

It doesn't crash on my machine when I have that option checked. Do you
have any code in the StartupNextInstance event handler? It would be in
the ApplicationEvents.vb file.

Brian
 
' The following e
'
' Startup: Raised
' Shutdown: Raise
' UnhandledExcept
' StartupNextInst
' NetworkAvailabi
Partial Friend Cl

Just copied the first few words of each enry...everything is commented out..
however
unhandled exceptions seems to be working as is. the violation mentions
attempt to
access protected memory
 
Just to clarify...what you're saying is that you do not have any code
running in either of the events you just listed. Is that correct? The
next thing I would try is to create a new project from scratch and make
sure that option is checked and see if it crashes when you try to
launch another instance.

Brian
 
Back
Top