How to prevent program from loading twice? - vb.net

I have a VB.NET program. In proerties/Application I checked Make a Single Instance Application. But it still allows someone from opening the program while already opened. How can I prevent this?

The short answer is you can't. VB does some tricks behind the scenes to help you accomplish this since it's a common business requirement. However anything you create that is actually exclusive opens you to a denial of service attack by someone else maliciously creating/holding that resource and denying it to you.
Common ways are creating a well known mutex/semaphore/named pipe/something similar and if it already exists, exiting the instance just launched. There just isn't a secure way of doing what you want to do.

When you select Make Single Instance Application, starting a new copy of the program will automatically switch to the existing copy.
You can customize this behavior in the Application class.

The commonest way to do this is to implement a mutex, however, I will point you to an article or two, here, and here on CodeProject.
Hope this helps,
Best regards,
Tom.

Related

How to find out what and where a program is writing to memory in vb.net?

I want to make a tool which I can attach to another process and see where it writes to the memory, but I don't even know where to begin.
Any idea on how would I do this?
To do this, you will essentially have to write a debugger. Windows has The Debugging Application Programming Interface which you will need to use to accomplish this. This API is not simple and probably isn't designed to be called easily from VB.NET, so you probably have a challenging task ahead. But that's how you would begin.

sending data between tweaks

I have a tweak with hooks to an app (tweak1)
The tweak is supposed to use a framework to execute some code.
Unfortunately within iOS7 I'm unable to do that.
However when the same code is executed in a separate tweak (tweak2) with hooks to springBoard, it runs just fine.
My question is possible for me to send a dictionary from the first tweak (tweak1) to tweak2 so it gets executed.
I think I need to use CPDistributedNotificationCenter. But not sure.
If that's the case, a helping suggestions or example would be greatly appreciated.
many thanks
CPDistributedNotificationCenter should work or you could just use NSDistributedNotificationCenter. It inherits from NSNotificationCenter, which we all know how to use.
Another solution I can suggest is CFMessagePort, which I'm using in my apps. I need to support iOS 4, which doesn't support NSDistributedNotificationCenter, so I ended up using CFMessagePort. It differs from notification model in that you can't send messages to everyone. You can only send messages between two known ports. But in your case it probably doesn't matter.
There is also the XPC API but I've never used it and can't say much about it. It's an IPC API so it should work. Many iOS components use it.

Replacing and then stringing multiple DLLs

I'm using VB.net so keep that in mind.
I'm trying to create a program that is highly edible. Users will be able to change multiple things by just replacing the existing dlls. Kind of like a modding ability.
The new DLL shouldn't have to recreate every function though, it should only include the ones that it changes and then hook to the old dll for anything that it doesn't have. Is there a way to dynamically do this? Reference another dll (like a proxy) through yourself for anything that doesn't exist in its self?
Sorry if that is confusing. If it still confuses people, I'll draw a picture later =)
I'm Sorry, but it must be done this way. I have already set up everything in the manor and told clients (they have already started developing).
Sounds like you want to write a plugin architecture into your application, why re-invent the wheel, take a look at the Managed Extensibility Framework

Creating a proxy for IE (or other browsers)

I'm using VB.net. I need to create an application that sits in between the browser and the actual internet. Basically, I'm creating an online game that will edit some webpages that are incoming so that they contain parts of the game (it's a kind of scavenger hunt). How would I create this?
Does anybody have any ideas for this? I've found nothing online. If you do know something about this, I prefer code examples and not just subjects. I tend to need big pushes in a direction to learn something new.
Thanks if you can!
Your best bet is to start with FiddlerCore, which is a .NET Class Library which provides exactly what you're looking for. http://fiddler.wikidot.com/fiddlercore

Threading advice VB.NET

Firstly, I've never used threads, but have found lots of examples on the internet about their use but nothing that obviously answers my question.
I have a class that loads and manipulates a file(s). It is fairly CPU intensive so I intend to put it in its own thread so that the GUI remains responsive. However, I would also like to use a progress bar to indicate the current status of the file operations.
The question is, what is the best way of approaching this, i.e. How do I get my file class to tell the app where it's up to? Do I have to add thread specific code to my class? Or is there an interface I can implement? Or, am I approaching this all wrong. Additionally (sorry, another stupid question) I assume I need an indicator in my file class to tell the thread when it's finished?
I'm using VS2010 and intend to build the app with WPF (if that's relevant)
Thanks for any advice,
Bob
Since you are intending to use WPF, use a Dispatcher:
Build More Responsive Apps With The Dispatcher
(Otherwise, for Winforms use a BackgroundWorker)