|
Hi there,
Thanks for taking interest in my question. I am trying to create a program which will detect any removable device attached to the System and copy itself to it. Something like this:
//Pseudo code begins:
1). If G:(Removable device) contains myprogram.exe, then goto step (2)
else
Copy myprogram.exe to G:(Removable device).
2). Exit
//Pseudo code ends here
But the problem is that, how will I code the program to detect Removable devices ex. PenDrive attached to the system?
Please help,
Its really urgent,
Long Live Code Project,
Rajdeep.NET
|
|
|
|
|
Sure as hell sounds like a virus to me....
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Sometimes truth sounds so Apparent
Have a Happy Coding.....
|
|
|
|
|
Hi Rajdeep!
you can find the removable devices like this
System.IO.DriveInfo [] drives = System.IO.DriveInfo.GetDrives ();
foreach (System.IO.DriveInfo drive in drives) {
if (drive.DriveType == DriveType.Removable) {
Console.WriteLine ("Found removable drive {0}", drive.Name);
}
}
I think you are attempting to do something malicious....
You can try and better not to distribute....
Have a Happy Coding.....
|
|
|
|
|
So if he's trying to write a virus, why are you helping him ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I think you remember the previous posts of the same member....
"Why You people are not answering for my questions"
Have a Happy Coding.....
|
|
|
|
|
Hi Christian and a lot thanks to Julien,
Christian said: Christian Graus wrote: So if he's trying to write a virus, why are you helping him ?
Look, every program, whether it be a virus, worm or any other malware stuff is part of programming. I bet you know Sharpie, and I am just trying to understand the way that creep works. Other than that, I have no intention to target the .NET Framework. Got it, Sir? Thanks for your understanding.
Happy programming,
Rajdeep.NET
|
|
|
|
|
Hi Experts
I'm facing issues when i try close the excel file,it's asking me do need save the changes dialog and also still running the excel exe in task manger how i can close th file with put nay dialog and properly cleanup.
This my file op opening code
Microsoft.Office.Interop.Excel.Workbook workbooks = bodynitsApplicationClass.Workbooks.Open(filename,
0,
true,
5,
"",
"",
false,
Microsoft.Office.Interop.Excel.XlPlatform.xlWindows,
"\t",
false,
false,
0,
true,
1,
0);
Microsoft.Office.Interop.Excel.Sheets sheets = workbooks.Worksheets;
Close Method code:
Marshal.ReleaseComObject(worksheetdetail);
worksheetdetail = null;
bodynitsApplicationClass.Quit();
while (Marshal.ReleaseComObject(bodynitsApplicationClass) != 0) { }
bodynitsApplicationClass = null;
GC.Collect();
GC.WaitForPendingFinalizers();
Missing anything ?, Please help me
|
|
|
|
|
Thank you much , i found and corrected.
Here for you.
When you call the CloseMethod(your own method)
private void close()
{
if (bodynitsApplicationClass != null)
{
bodynitsApplicationClass.DisplayAlerts = false;
bodynitsApplicationClass.Workbooks.Close();
Marshal.ReleaseComObject(worksheetdetail);
worksheetdetail = null;
bodynitsApplicationClass.Quit();
Marshal.ReleaseComObject(bodynitsApplicationClass);
bodynitsApplicationClass = null;
}
}
everything dispose and close without dialog.
thank you once again.
|
|
|
|
|
I have a excel file containing 3000 records which i have to convert into a binary and
also i need to read the whole data from binary file .Can you please tell me how to do this.
|
|
|
|
|
You have to define your own binary format, if you don't have one in mind to use. Then you just write the files into it, you defined the format.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Hi everybody
I want write a program about scan please help me.
|
|
|
|
|
OK, get started then. If you want people to write it for you, try rentacoder.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Hi,
I am using this(http://www.chmeditor.com/) for to edit .chm file editor for edit text and insert new images in it as i am saving file text is updated but unfortunately images are not displaying on the page.
Tell me what should i do which .chm file editor will support bot or image.
Please help me out.
Thanks
|
|
|
|
|
hi
in my project i convert excel file in xml and then upload the file in data base . here i use SQL Server 2005. In my excel file consist one record D'Souza when such name comes program throw run time exception as Incorrect syntax near 'Souza
i use following query for insert a record
string istr = "insert into sheet1(Personnel_Area,EE_Grp,Employee_Group,ESgrp,Employee_Subgroup,Cost_ctr,Cos
t_Center,PSubarea,Personnel_Subarea,Peres_no,Personel_Number,Designation,D
esigna,Pos,Age_of_Employee,Birthdate,Complete_name)values('" + Convert.ToString(dataGridView1.Rows[i].Cells[0].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[1].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[2].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[3].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[4].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[5].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[6].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[7].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[8].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[9].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[10].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[11].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[12].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[13].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[14].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[17].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[18].Value.ToString()) + "')";
|
|
|
|
|
|
Your problem is because of the single quote in 'Souza - that is a string terminator in SQL. Either you need to escape them (not recommended) or use parameterized queries (recommended), as the article referred to by Navaneeth suggests.
|
|
|
|
|
Hi, as i said. i have a windows form application within the internal organisation users and a web appplication hosted with some hosting company for external users. Both application need to share a common databse? how to share and where to place the databse?
|
|
|
|
|
Hi, I think you must have a public IP to communicate your dbase in hosting company.
Hope this one can help.
Thanks
Hi, Please select Good Question if my answer are fit to your Question.
|
|
|
|
|
sorry can you please explain me a bit more, i am a beginner...thanks for understanding
|
|
|
|
|
The computer witch has Database, needs to be connected to internet. If it is behind routers, it needs to be configured to let others user to connect to database. For web application, it can be on the same computer, and it has Apache server.
If you want to use internal (LAN), you can safely use its computer IP as a adress.
This is only configuration problem, and you need to understand a little to do it. I can't help you more, because i don't/wan't to know your IP configuration and Router configuration. This is diffrent case by case
|
|
|
|
|
yea thanks Saksida, i got the idea... thankss
|
|
|
|
|
I want to override the panel,under the design environment draw some piecec of lines on the panel, but under the running
environment the no need to draw the lines or no need to display the lines, how to do it ?
Thank in advence!
|
|
|
|
|
Maybe Control.DesignMode is what you want.
|
|
|
|
|
Luc Pattyn, Thank for your help. And could you help me below issue because I'm a beginner of C#?
I want to override the panel,under the design environment draw some piecec of lines on the panel, but under the running
environment the no need to draw the lines or no need to display the lines, how to do it ?
|
|
|
|