|
OK, I fixed it. The problem was that I had a timer starting in a component's constructor that somehow crashed the Visual Studio designer. Adding a if (!DesignMode) { ... } fixed it.
|
|
|
|
|
how to run a method on other executing application?
(invoke the method and send Parameters)
|
|
|
|
|
solomon85 wrote: how to run a method on other executing application?(invoke the method and send Parameters)
You'd need to be more specific than that. Let's name the first application making the call AppA, and the other executing application AppB.
You can load AppB as if it were a library. In that case, the method would be called by AppA, regardless whether AppB is running.
If you want AppB to execute a function on the request of AppA, then you'd best modify AppB to a client/server structure.
I are Troll
|
|
|
|
|
I am not sure if I have understood you, do you want to call some method from an already running application? I mean call the method on the instance that is running. If yes, then you will need to look into inter-process communication. You can set up a NamedPipe and then use it to communicate.
If you need to call some method of another exe/dll, just add it as a reference if it is a .Net exe/dll or a COM component. If it is not a .Net exe/dll, you can make use of P/Invoke.
|
|
|
|
|
You could try something like this[^].
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Hi. I'm having problem with the way I Backup my database. I'm trying to use the SMO now because the first time I tried to backup my database with File.Copy() is I always have errors with the .dbo file that I'm backing up. I always have the error that the file is currently used by another process even if I already closed the connection. Now I'm still having problem with SMO. I encountered a run-time error saying: "the backup failed for the server ROJAI-PC". I don't know how to resolve the problem since I'm new to SMO. Can anyone help me?
Here is the code I used:
private void createBackupToolStripMenuItem_Click(object sender, EventArgs e)
{
Server srver = new Server();
Backup bckup = new Backup();
bckup.Devices.AddDevice(@"C:\Documents and Settings\Jairo Hibaler\Desktop\Backup\MP\HotelReservationSystem\HotelReservationSystem\bin\Debug\hotelReservationBackup.bak", DeviceType.File);
bckup.Database = "HotelReservationDB";
bckup.Action = BackupActionType.Database;
bckup.Initialize = true;
bckup.PercentCompleteNotification = 10;
bckup.PercentComplete += new PercentCompleteEventHandler(bckup_PercentComplete);
bckup.SqlBackup(srver);
}
private void bckup_PercentComplete(object sender, PercentCompleteEventArgs e)
{
MessageBox.Show(e.Percent.ToString() + "% backed up");
}
|
|
|
|
|
Hey guys, I have a win form application which was working just fine but now when I try to run it It freezes or gives me this error:
"Error 12 Problem generating manifest. The request could not be performed because of an I/O device error."
please help me out !!!
K
|
|
|
|
|
Ok, look here[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hey guys,
I wrote a network scanning tool a few years ago, which pings a list of IP addresses. I recently moved to Windows 7, and have noticed some strange behaviour in the program. My ping code is as follows:
public void pingIP(int IP)
{
AutoResetEvent waiter = new AutoResetEvent (false);
string IPaddress = IPpart1.Value.ToString() + "." + IPpart2.Value.ToString() + "." + IPpart3.Value.ToString() + "." + IP;
IPAddress IPa = IPAddress.Parse(IPaddress);
Debug.WriteLine("Pinging " + IP.ToString());
Ping ping = new Ping();
ping.PingCompleted += new PingCompletedEventHandler(PingCompletedCallback);
ping.SendAsync(IPa, waiter);
}
This then calls PingCompletedCallback when it recieves a response:
public void PingCompletedCallback(object sender, PingCompletedEventArgs e)
{
PingReply reply = e.Reply;
string IP = reply.Address.ToString();
if(IP != "0.0.0.0")
{
string[] IParray = IP.Split('.');
int iIP = Int32.Parse(IParray[3]);
if (reply.Status == IPStatus.Success)
pingResult[iIP] = reply.RoundtripTime.ToString();
else
pingResult[iIP] = "X";
Debug.WriteLine("Ping Reply From " + IP.ToString() + " Time: " + pingResult[iIP]);
if (iIP == 255)
{
pingComplete = true;
lblStatus.Text = "Ping Complete";
}
}
((AutoResetEvent)e.UserState).Set();
}
Now, under Windows XP this worked fine, PingCompletedCallback was called for every ping I sent - either with a response, or with a timeout. I could then set the value as required. However, under Win7, PingCompletedCallback only seems to be called when a successful response is received. I have also noticed I recieve a lot of replies from "0.0.0.0", as well as multiple replies from the IP the machine is running on (10.0.0.4)
I have a second screen for doing a detailed ping on a single IP, which doesnt use a callback function, and it works fine when no response is received:
public void startPing(IPAddress IP)
{
textStatus.Text += "Pinging " + IP.ToString() + "...";
this.Refresh();
Ping ping = new Ping();
PingReply reply = ping.Send(IP);
if (reply.Status == IPStatus.Success)
textStatus.Text += " Time: " + reply.RoundtripTime.ToString() + "\r\n";
else
textStatus.Text += reply.Status.ToString() + "\r\n";
}
Has nayone seen anything like this before? Im a little confused!
|
|
|
|
|
Hi
I have a friend who's a photographer and he's looking for a way to burn DVDs for his customers with the photos on. He wants to include both low resolution and high resolution photos on the disc, but he doesn't want his customers to be able to access the high res photos. They must bring the disc to him if they want any photos printed. What I suggested to him was to create an application that will allow him to save the photos in a different file format, and only he must be able to open these photos with this application.
I quickly fiddled with some code and saved an image in a different file format, but then of course one can still open these files by simply using the "Open With" dialog. I know there must be more to it than simply just saving it in a different file format. Maybe using some form of Serializer? Any help in the right direction would be appreciated.
|
|
|
|
|
Encryption
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
|
A simple trick might be to write some binary value - an indicator byte/int/long plus some indicator of the type of image that the rest of the file contains (e.g. 0xD1CEDBEE + ".JPG" for a total of 8 bytes, or 12 if you save the string as multibyte characters) - at the beginning of a new file, then stream the binary of the high-res image immediately following that byte. Save the file with a custom extension 'xxx.hires' or somesuch.
The presence of the custom header will prevent any standard software from being able to process the file as a recognized image file.
The custom app can validate the header, then create a .Net Image object from the remainder of the content in the file.
Specifying the embedded image type in the header allows for future implementations that use other file formats (which may not necessarily be images at all). If you don't like having ".JPG" in readable characters, XOR each byte of the string with some binary value, say 0x53. Just XOR them again when reading them back, to get back to the original characters.
You should probably also include a length field describing the embedded string, for flexibility, instead of assuming that it is always going to be 4 characters; I would also include a version # "just in case".
|
|
|
|
|
I'm sorry - that was a little blunt. My fault! I was going to say:
Encrypt the files - use the small file filename and some random-but-fixed data mixed together as the key and use the .NET Encryption services. Save the file with the extension ".encrypt" appended to the ".jpg" or whatever bit, and you are good to go.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Which encryption algorithm would you recommend though? There are numerous included in .NET. The one I came across that works fine is "RijndaelManaged".
|
|
|
|
|
For your situation I wouldn't go for anything too complex - All you want is something that bollixes up the simple user from getting his high-res pics for free, I assume?
Follow this[^] and you won't go too far wrong - it's pretty easy to follow, but without your key it's pretty much unbreakable. It won't stop the FBI or the mafia, but then I hope your pictures wouldn't interest either!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Yes you're completely right. While we're on the subject, would it be possible to compile all of these photos into one single encrypted package which can then only be opened by the application? That would be ideal, but if I have to store all the files separately then that's not a train smash either.
|
|
|
|
|
Yes - the encryption doesn't care what the content is. I would suggest either a simple directory structure, or just a length prefix/filename combination to each file so you can extract them from the decrypted stream.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
What you are looking for is called encryption. The photos can be in the original format (.jpg or whatever), but the files should be encrypted using a good algorithm and a strong password to keep the data protected.
You can either use some ready-to-use encryption software, or create your own program from scratch... If you decide to write your own program, see the System.Security.Cryptography namespace (there are high-quality encryption algortihms ready for you in the .NET library). There are also several articles about encryption here at CodeProject.
|
|
|
|
|
put the hi-res files inside a password-protected ZIP; or encrypt them.
|
|
|
|
|
Luc Pattyn wrote: a password-protected ZIP
very easy to copy and crack
Luc Pattyn wrote: encrypt them
better alternative.
|
|
|
|
|
You do realize that password-protecting a ZIP file is a form of encryption, right?
|
|
|
|
|
One of the weakest types of encryption, huh!
|
|
|
|
|
I don't know, is 256-bit AES encryption weak?
|
|
|
|
|
An alternate idea...
Save the high resolution images to a database on your computer. Associate a unique key to each photo, or just create a single key for an entire batch of images. Include that key(s) on the DVD with the low resolution images. When the customer gives you the DVD, use that key to lookup the high resolution pictures on your computer. The "database", "key", and "computer" can be anything you like. For example, one configuration might be:
Database: SQL Server
Key: GUID
Computer: PC
Alternate cofiguration:
Database: Excel File
Key: Customer name and date the photos were put on the DVD
Computer: DVD's with the key written on them
No need to put the data in the user's hands.
|
|
|
|