|
Use FileStream to copy the source file into the target file. When you want to pause the opration you just need to close the stream. When you want to resume, you can use seek method find last written byte and restart writing.
Another way could be to have copy operation on a separate thread which can be stopped and resumed when required. I have not tried this hence not sure.
Hope this helps.
|
|
|
|
|
Thanks for the reply. Maybe binary Reader would do the job... will check it out.
|
|
|
|
|
Hi all
on a video stream display control i have i've got an overlay bitmap on which I can add markers. the bitmap is defined to be the size of the video stream (say 640X480 for a webcam), but the user can resize the display, so the videoimage + bitmap are also resized befor display . i've got markers drawn by the Graphics.DrawLine(...) with a 1 pixel width Pen. the user can also move the markers about. if the resize is by a whole number (say, resize the 640x480 to 1280x960 and so on) there are no problems, bit if the ratio is fractional (say 640x480 to 1024x768, which is 1.6) i have the following artifect: whenever the coordinate times the ratio gives a float with the fractional part larger than 0.5, the line thins out by a pixel. so if i'm running on a 1600X1200resolution and the stretch is to 1024 the line thins from 2 pixels to 1, but on a lower screen resolution the line dissapears completely. since the markers are sort of crosshairs, it's a real problem i can't ignore. I tried rounding down the coord value to prevent this, but no good, so if anybody has encountered this before i'd love to hear about it .
thanks
grizli
|
|
|
|
|
Hi,
to get the best results when the overlay contains either lines with fixed thickness (such as cross-hairs) or text, both of which don't scale well, this is what I would try:
1. either don't use an overlay bitmap at all, just draw the overlay in real-time
2. or generate a new overlay bitmap every time the video display gets resized
Both have in common that they should work at the display resolution, not the original video resolution.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 9:16 AM
|
|
|
|
|
How to put the bitmap/image on the button.
thanks
|
|
|
|
|
Button has Image propery. Use it.
|
|
|
|
|
Hiii
I am developing one window application in c# and .net with sql server 2005 as database.
now, i have Four questions:
1] I have one dropdownlist in form and i want to fetch the content/data of table category in to this dropdownlist and when I run this form on clicking dropdownlist the data should be displayed in dropdownlist.
2] As i said one dropdownlist is there and also one textbox is there in this form , now i am selecting one value from dropdownlist and entering keyword or text in textbox and pressing button search, on click event of this button it should compare the dropdownlist and textbox and depending upon the comparision the result should be display in datagridview. the value of dropdownlist and textbox are the data member of table Product
and result should be fetch in datagridview from this table "Product"
3] In Web application we have file uploader control so how we can provide file upload facility in window application?
4] How We can make search of particular keyword in PDF files?
I am really frustating by this questions and my project arrived at the deadline please help me!
I hope You will Help me in good way! Thanx in Advance.
|
|
|
|
|
1 and 2 are pretty trivial. It's obvious that 3 and 4 and totally beyond you. I recommend that in future you learn the language/platform you're paid to code in, instead of asking people to do your work for you after the deadline expires.
For number 1 and 2, I can only say, learn to use google and buy a book. They are both trivial.
For 3 - a web app is already connected to the server. Your app is not. The easiest way to do this, is to create a web service on the server that takes the information of a file, and then use that to send files to your server.
For 4 - you need to buy a PDF library.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Digubha wrote: my project arrived at the deadline please help me
Be patient. Deadlines come and go. Nothing to worry about.
Do your work yourself.
|
|
|
|
|
|
There's a forum under the article for questions to the author. Do you have .NET installed ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello,
i have an exception on the bold text code, but in another comptuer, this code work :
<br />
XlFixedFormatType paramExportFormat = XlFixedFormatType.xlTypePDF;<br />
XlFixedFormatQuality paramExportQuality =<br />
XlFixedFormatQuality.xlQualityStandard;<br />
bool paramOpenAfterPublish = false;<br />
bool paramIncludeDocProps = false;<br />
bool paramIgnorePrintAreas = true;<br />
object paramFromPage = Type.Missing;<br />
object paramToPage = Type.Missing;<br />
<br />
<br />
excelWorkBook = excelApplication.Workbooks.Open(paramSourceBookPath,<br />
paramMissing, paramMissing, paramMissing, paramMissing,<br />
paramMissing, paramMissing, paramMissing, paramMissing,<br />
paramMissing, paramMissing, paramMissing, paramMissing,<br />
paramMissing, paramMissing);<br />
<br />
if (excelWorkBook != null)<br />
<big> excelWorkBook.ExportAsFixedFormat(paramExportFormat,<br />
paramExportFilePath, paramExportQuality,<br />
paramIncludeDocProps, paramIgnorePrintAreas, paramFromPage,<br />
paramToPage, paramOpenAfterPublish,<br />
paramMissing);</big>
the office 2007 was installed, but there are always this exception, please help me to resolve this great problem, thank you verry mutch.
|
|
|
|
|
How about telling us the exception message, and what's different ( such as different office versions ) between the two machines ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
It is the same version of office, it's office 2007 plus, thank you verry mutch.
|
|
|
|
|
OK. But what error message you are getting ?
I think (just a guess) that you dont have correct filepath. i.e. you are using D:\xyz and D: is not there or xyz is not there.
or try this.
in Office 2007
*) Open the 2007 Microsoft Office system application in question. Click the Microsoft Office button, and then click Application Options.
*) Click the Trust Center tab, and then click Trust Center Settings.
*) Click the Macro Settings tab, click to select the Trust access to the VBA project object model check box, and then click OK.
*) Click OK.
Or try opening excel application (manually) and then run your code.
|
|
|
|
|
Thank you verry mutch for your answer but it doesn't work, in a computer it's the same parameter's of office and it work but in my pc it don't work, i try to install microsoft office 2003 and it the same, please help me to resolve this problem, thank you verry mutch.
|
|
|
|
|
But what is the error message you are getting ?
Try this one.
1. Click Start, click Run, and then type DCOMCNFG. Select the application that we want to automate. The application names are listed below:
2. Microsoft Excel 97/2000/2002/2003 - Microsoft Excel Application
3. Click Properties to open the property dialog box for this application.
4. Click the Security tab. Verify that Use Default Access Permissions and Use Default Launch Permissions are selected.
5. Click the Identity tab. Verify that The Launching User is selected.
6. Click OK to close the property dialog box and return to the main applications list dialog box.
7. In the DCOM Configuration dialog box, click the Default Security tab.
8. Click Edit Defaults for access permissions. Verify that the following users are listed in the access permissions, or add the users if they are not listed:
SYSTEM
INTERACTIVE
Everyone
Administrators
OfficeAutomationUser
IUSR_<machinename>*
IWAM_<machinename>*
* These accounts exist only if Internet Information Server (IIS) is installed on the computer.
9.Make sure that each user is allowed access and click OK.
Click Edit Defaults for launch permissions. Verify that the following users are listed in the launch permissions, or add the users if they are not listed:
SYSTEM
INTERACTIVE
Everyone
Administrators
OfficeAutomationUser
IUSR_<machinename>*
IWAM_<machinename>*
* These accounts exist only if IIS is installed on the computer.
|
|
|
|
|
When i excute DCOMCNFG, a table appear, there are a root : consol and thre fields : services composant, services and log file, but i don't find microsoft excel 2003 or 2007, thank you verry mutch.
|
|
|
|
|
in "DCOMCNFG"
Go to
Component Service
Computers
My Computer
DCOM Config
now select from right hand side list
|
|
|
|
|
I am sorry bu I don't find goto, Thank you verry mutch
|
|
|
|
|
come on man.
Go to means "Select"
When you open "dcomcnfg"
On the Left hand side panel under the "Console Root" Select those options in the tree view (click +)
And after you select the last node find the excel application on the right hand side panel.
|
|
|
|
|
Hi,
I am trying to send email through C# using my Gmail account.When i am running this application from direct internect connection system its working fine. when i am using a proxy system its showing 'Failure sending mail'.
i am using the code
SmtpClient SmtpServer = new SmtpClient();
SmtpServer.Credentials = new System.Net.NetworkCredential ("username","password");
SmtpServer.Port = 587;
SmtpServer.Host = "smtp.gmail.com";
SmtpServer.EnableSsl = true;
mail = new MailMessage();
mail.From = "";
mail.Subject = "";
SmtpServer.Send(mail);
Thanks in advance
AnupMadathil
|
|
|
|
|
I don't believe that the .NET email classes have ways to set a proxy server.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi,
I want to access the data of a PDF file which is opened on IE using BHO.
Using a Browser Helper Object, how can I come to know that a PDF file is opened on IE.
The BHO in the following link is helpful for retrieving data of web pages.
http://www.codeproject.com/KB/cs/Attach_BHO_with_C_.aspx?fid=447248&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=51&select=2421069
But how the PDF file data can be retrieved?
|
|
|
|
|
Hi everyone, i need your help
This is my sym.cs file where it store the encryption part
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Security.Cryptography;
namespace SecurePDFViewer
{
public class SymCrypto
{
private SymmetricAlgorithm symAlgorithm;
private static byte[] saltValue = new byte[] {213,230,110,217,191,69,82,238};
private static byte[] IV = new byte[] { 207, 177, 154, 229, 191, 104, 44, 244, 86, 12, 63, 54, 94, 9, 88, 148 };
private static int keySize = 256;
private static int pwIteration = 7;
public SymCrypto()
{
//Creates the default implementation, which is RijndaelManaged 256 bits
symAlgorithm = SymmetricAlgorithm.Create();
symAlgorithm.IV = IV;
}
public SymCrypto(string algorithmName)
{
symAlgorithm = SymmetricAlgorithm.Create(algorithmName);
symAlgorithm.KeySize = keySize;
symAlgorithm.IV = IV;
}
public byte[] EncryptData(string passphrase, byte[] plainBytes)
{
GenerateKey(passphrase);
// Define memory stream which will be used to hold encrypted data
MemoryStream memoryStream = new MemoryStream();
// Define cryptographic stream (Write mode for encryption)
CryptoStream cryptoStream = new CryptoStream(memoryStream,
symAlgorithm.CreateEncryptor(),
CryptoStreamMode.Write);
cryptoStream.Write(plainBytes, 0, plainBytes.Length);
cryptoStream.FlushFinalBlock();
byte[] cipherBytes = memoryStream.ToArray();
// Close streams
memoryStream.Close();
cryptoStream.Close();
return cipherBytes;
}
public string EncryptData(string passphrase, string plainText)
{
byte[] plainTextBytes = Encoding.UTF8.GetBytes(plainText);
return Convert.ToBase64String(EncryptData(passphrase, plainTextBytes));
}
public byte[] DecryptData(string passphrase, byte[] cipherBytes)
{
GenerateKey(passphrase);
// Define memory stream which will be used to hold encrypted data
MemoryStream memoryStream = new MemoryStream(cipherBytes);
// Define cryptographic stream (Read mode for decryption)
CryptoStream cryptoStream = new CryptoStream(memoryStream,
symAlgorithm.CreateDecryptor(),
CryptoStreamMode.Read);
byte[] plainBytes = new byte[cipherBytes.Length];
int count = cryptoStream.Read(plainBytes, 0, plainBytes.Length);
// Close streams
memoryStream.Close();
cryptoStream.Close();
byte[] actualBytes = new byte[count];
for (int i = 0; i < count; i++)
{
actualBytes[i] = plainBytes[i];
}
return actualBytes;
}
public string DecryptData(string passphrase, string cipherText)
{
byte[] cipherTextBytes = Convert.FromBase64String(cipherText);
return Encoding.UTF8.GetString(DecryptData(passphrase, cipherTextBytes), 0, 1000);
}
private void GenerateKey(string passphrase)
{
Rfc2898DeriveBytes pwdGen = new Rfc2898DeriveBytes(passphrase, saltValue, pwIteration);
symAlgorithm.Key = pwdGen.GetBytes(keySize/8);
}
}
}
------------------------------------------------------------------------------------------------------
Main.cs
using System.IO;
using System.Security.Cryptography;
private void button1_Click(object sender, EventArgs e)
{
SymCrypto sym = new SymCrypto();
string cipherText = sym.EncryptData("I love Java", "2.1 SCOPE OF TESTS\nThe test plan for User Authentication System webservice will consist \nof the following tests related to interoperability: a) WS-I Basic Profile 1.1 Interoperability Tests Interoperability testing will be performed in conformance to WS-I Basic Profile 1.1 specifications. The profile addresses the following areas: \n• Messaging Messaging includes XML Representation of SOAP Messages, SOAP Processing Model and use of SOAP in HTTP. Four specifications are referenced in this section:• Simple Object Access Protocol (SOAP) 1.1• Extensible Markup Language (XML) 1.0 (Second Edition)• RFC26116 Hypertext Transport Protocol HTTP/ 1.1 • RFC2965: HTTP State Management Mechanism• Service DescriptionThis refers to Web Services Description Language (WSDL) to enable the description of services as sets of endpoints operating on messages. Three specifications and extensibility points are referenced in this section:• Web Services Description Language 1.1• XML Schema Part 1: Structures•"); <---- HARD CODE
string abc = ("how are you"); <-- HARD CODE
MessageBox.Show(cipherText + abc);
string plainText = sym.DecryptData("I love Java", cipherText);
MessageBox.Show(plainText + abc);
}
------------------------------------------------------------------------------------------------------
I will be using a IE toolbar button to mark it...
But how can change it so that i can read the encrypted html?
Thank you
|
|
|
|
|