Search results for 'Delphi for .NET'. 6 post(s) found.
- 2007/10/04 Sending email messages in .Net
- 2007/10/04 Implementing C#'s foreach loop in Delphi 8
- 2007/10/04 Delphi for .Net Code Folding keyboard shortcuts
- 2007/10/04 How to encrypt a string
- 2007/10/04 Creating thumbnail images
- 2007/10/02 Technology sharing related with software development. Specially content will be focused to programming language, and embedded systems.
Sending an e-mail message (even with attachments) in Delphi for .NET (ASP.NET or WinForms) is very simple. You don't have to learn complicated syntaxes and other commands to achieve the task. The System.Web.Mail namespace provides the classes for sending email in .NET. MailMessage class manages the mail message contents; SmtpMail class sends email to the mail server.
Here's a sample code:
uses System.Web.Mail;
...
var
MailMessage : System.Web.MailMessage;
begin
MailMessage := MailMessage.create;
try
with MailMessage do
begin
From := 'delphi.guide@about.com';
&To := 'someone@somewhere.net';
Subject := 'This is the subject line';
Body := 'this is the mail body text;
BodyFormat := System.Web.Mail.MailFormat.Text;
end;
SmtpMail.SmtpServer := 'SmtpServer NAME';
SmtpMail.Send(MailMessage) ;
except on e : Exception do
MsgResult.Text := 'Error occured!';
end;
end;
...
var
MailMessage : System.Web.MailMessage;
begin
MailMessage := MailMessage.create;
try
with MailMessage do
begin
From := 'delphi.guide@about.com';
&To := 'someone@somewhere.net';
Subject := 'This is the subject line';
Body := 'this is the mail body text;
BodyFormat := System.Web.Mail.MailFormat.Text;
end;
SmtpMail.SmtpServer := 'SmtpServer NAME';
SmtpMail.Send(MailMessage) ;
except on e : Exception do
MsgResult.Text := 'Error occured!';
end;
end;
Another posts included in "Delphi"
| Find File at certain directory in Delphi (0) | 2008/10/10 |
| How to turn off monitor ? (0) | 2008/12/10 |
| How to get screen resolution in case of using multiple monitors ? (0) | 2008/12/16 |
| Implementing C#'s foreach loop in Delphi 8 (0) | 2007/10/04 |
| Delphi for .Net Code Folding keyboard shortcuts (0) | 2007/10/04 |
| How to encrypt a string (0) | 2007/10/04 |
| Creating thumbnail images (0) | 2007/10/04 |
| Technology sharing related with software development. Specially content... (0) | 2007/10/02 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 05:56
moneyideas
-
Subject different money making ideas
2010/01/29 14:30
moneyideas
-
Subject different money making ideas
2010/01/31 16:41
moneyideas
In C# the foreach statement repeats a group of embedded statements for each element in an array or an object collection. Delphi 8 does not have an eqivalent of the foreach statement. Let's see how to code a foreach statement in Delphi...
First, here's a simple sample C# code:
foreach (TMyObject myObject in AnArrayList) {
AnIntValue = MyObject.MyValue;
}
Where TMyObject class is declared as:
TMyObject = Class(TObject)
public
MyField : integer;
constructor Create(AValue:integer) ;
end;
constructor TMyObject.Create(AValue: integer) ;
begin
inherited Create;
MyField := AValue;
end;
AnIntValue = MyObject.MyValue;
}
Where TMyObject class is declared as:
TMyObject = Class(TObject)
public
MyField : integer;
constructor Create(AValue:integer) ;
end;
constructor TMyObject.Create(AValue: integer) ;
begin
inherited Create;
MyField := AValue;
end;
Here's the "same code" in Delphi:
var
MyObject : TMyObject;
AnArrayList : ArrayList;
Enum: IEnumerator;
j:integer;
begin
AnArrayList := ArrayList.Create;
AnArrayList.Add(TMyObject.Create(2004)) ;
AnArrayList.Add(TMyObject.Create(1973)) ;
AnArrayList.Add(TMyObject.Create(2000)) ;
AnArrayList.Add(TMyObject.Create(1998)) ;
//FOR EACH
Enum := AnArrayList.GetEnumerator;
while Enum.MoveNext do
begin
MyObject := TMyObject(Enum.Current) ;
Response.Write(MyObject.MyField.ToString + '<br>') ;
end;
// OR USING ITERATION
for j:= 0 to -1 + AnArrayList.Count do
begin
MyObject := TMyObject(AnArrayList[j]) ;
Response.Write(MyObject.MyField.ToString + '<br>') ;
end;
MyObject : TMyObject;
AnArrayList : ArrayList;
Enum: IEnumerator;
j:integer;
begin
AnArrayList := ArrayList.Create;
AnArrayList.Add(TMyObject.Create(2004)) ;
AnArrayList.Add(TMyObject.Create(1973)) ;
AnArrayList.Add(TMyObject.Create(2000)) ;
AnArrayList.Add(TMyObject.Create(1998)) ;
//FOR EACH
Enum := AnArrayList.GetEnumerator;
while Enum.MoveNext do
begin
MyObject := TMyObject(Enum.Current) ;
Response.Write(MyObject.MyField.ToString + '<br>') ;
end;
// OR USING ITERATION
for j:= 0 to -1 + AnArrayList.Count do
begin
MyObject := TMyObject(AnArrayList[j]) ;
Response.Write(MyObject.MyField.ToString + '<br>') ;
end;
Another posts included in "Delphi"
| Sending email messages in .Net (0) | 2007/10/04 |
| Find File at certain directory in Delphi (0) | 2008/10/10 |
| How to turn off monitor ? (0) | 2008/12/10 |
| Delphi for .Net Code Folding keyboard shortcuts (0) | 2007/10/04 |
| How to encrypt a string (0) | 2007/10/04 |
| Creating thumbnail images (0) | 2007/10/04 |
| Technology sharing related with software development. Specially content... (0) | 2007/10/02 |
| Window flashing (0) | 2007/09/25 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 00:51
moneyideas
-
Subject different money making ideas
2010/01/29 09:22
moneyideas
-
Subject different money making ideas
2010/01/31 16:41
moneyideas
Privately I don't think this shortcut is not easy to memory and frequently used so not practical.
However Delphi for .NET's Code Editor introduced Code folding. Code folding lets you collapse (hide) and expand (show) sections of your code to make it easier to navigate and read. Code folding is enabled by default for methods/routines, code blocks (regions) and structured types.
When using the mouse, click the plus (+) sign to the left of a code block to collapse the code; click the minus (-) sign to expand the code block.
Here are a few handy code folding keyboard shortucts:
* CTRL + SHIFT + K + E : Collapses the nearest block (+)
* CTRL + SHIFT + K + U : Expands the nearest block (-)
* CTRL + SHIFT + K + A : Expand all code in a unit (- "all")
* CTRL + SHIFT + K + T : Toogle block (+/-)
* CTRL + SHIFT + K + O : Turn on/off code folding for the current document
Another posts included in "Delphi"
| Implementing C#'s foreach loop in Delphi 8 (0) | 2007/10/04 |
| Sending email messages in .Net (0) | 2007/10/04 |
| Find File at certain directory in Delphi (0) | 2008/10/10 |
| How to encrypt a string (0) | 2007/10/04 |
| Creating thumbnail images (0) | 2007/10/04 |
| Technology sharing related with software development. Specially content... (0) | 2007/10/02 |
| Window flashing (0) | 2007/09/25 |
| How to use TTF Font Without Installing (0) | 2007/09/25 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/28 23:05
moneyideas
-
Subject different money making ideas
2010/01/29 07:19
moneyideas
-
Subject different money making ideas
2010/01/31 16:41
moneyideas
If you need to encrypt a string in Delphi for .NET you can use the System.Security.Cryptography namespace. Here's a sample function:
Note: the example below uses MD5 algorithm implementation, for a list of possible implementations read MSDN help for System.Security.Cryptography namespace.
uses System.Security.Cryptography, System.Text;
function Encrypt(const cleanString: string): string;
var
ue : UnicodeEncoding;
clearBytes, hashedBytes : array of Byte;
begin
ue := UnicodeEncoding.Create;
clearBytes := ue.GetBytes(cleanString) ;
hashedBytes := (CryptoConfig.CreateFromName('MD5') AS HashAlgorithm).ComputeHash(clearBytes) ;
Result := BitConverter.ToString(hashedBytes) ;
//Remove "-"'s
Result := Result.Replace('-',System.String.Empty) ;
end; (* Encrypt *)
function Encrypt(const cleanString: string): string;
var
ue : UnicodeEncoding;
clearBytes, hashedBytes : array of Byte;
begin
ue := UnicodeEncoding.Create;
clearBytes := ue.GetBytes(cleanString) ;
hashedBytes := (CryptoConfig.CreateFromName('MD5') AS HashAlgorithm).ComputeHash(clearBytes) ;
Result := BitConverter.ToString(hashedBytes) ;
//Remove "-"'s
Result := Result.Replace('-',System.String.Empty) ;
end; (* Encrypt *)
Usage sample:
HashedString := Encrypt('http://delphi.about.com') ;
// HashedString = DC31A33D559C4B6609EEA9A6DA137486
// HashedString = DC31A33D559C4B6609EEA9A6DA137486
Another posts included in "Delphi"
| Delphi for .Net Code Folding keyboard shortcuts (0) | 2007/10/04 |
| Implementing C#'s foreach loop in Delphi 8 (0) | 2007/10/04 |
| Sending email messages in .Net (0) | 2007/10/04 |
| Creating thumbnail images (0) | 2007/10/04 |
| Technology sharing related with software development. Specially content... (0) | 2007/10/02 |
| Window flashing (0) | 2007/09/25 |
| How to use TTF Font Without Installing (0) | 2007/09/25 |
| How to show window contents while dragging (0) | 2007/09/25 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 06:08
moneyideas
-
Subject different money making ideas
2010/01/29 14:38
moneyideas
-
Subject different money making ideas
2010/01/31 16:41
moneyideas
Suppose you have a Web Form where uploading of files is enabled, using the HtmlInputFile HTML control, and a user is uploading an image. If you accept only images of a specified size, you might need to shrink the uploaded image / create a thumnail.
Here's how to create thumbnail images in ASP.NET Delphi web applications.
procedure Generatethumbnail(const FileName : string; const ImageStream : Stream; const tWidth, tHeight : Double) ;
var
g : System.Drawing.Image;
thumbSize : Size;
imgOutput : Bitmap;
imgStream : MemoryStream;
begin
//This function creates the thumbnail image and returns the
//image created in Byte() format
g := System.Drawing.Image.FromStream(ImageStream) ;
thumbSize := NewThumbSize(g.Width, g.Height, tWidth, tHeight) ;
imgOutput := Bitmap.Create(g, thumbSize.Width, thumbSize.Height) ;
imgStream := MemoryStream.Create;
imgOutput.Save(imgStream, g.RawFormat) ;
imgOutput.Save(Path.Combine('c:\LocationOnServer',FileName)) ;
g.Dispose;
imgOutput.Dispose;
end;
function NewThumbSize(const currentwidth, currentheight, newWidth, newHeight : Double) : Size;
var
tempMultiplier : Double;
NewSize : Size;
begin
if currentheight > currentwidth Then
tempMultiplier := newHeight / currentheight
else
tempMultiplier := newWidth / currentwidth;
NewSize := Size.Create(Convert.ToInt32(currentwidth * tempMultiplier), Convert.ToInt32(currentheight * tempMultiplier)) ;
Result := NewSize;
end;
//Usage:
Generatethumbnail('ThumbnameOnServer', ImageFile.PostedFile.InputStream, thumbWidth, thumbHeight) ;
//Where
//ImageFile : System.Web.UI.HtmlControls.HtmlInputFile;
var
g : System.Drawing.Image;
thumbSize : Size;
imgOutput : Bitmap;
imgStream : MemoryStream;
begin
//This function creates the thumbnail image and returns the
//image created in Byte() format
g := System.Drawing.Image.FromStream(ImageStream) ;
thumbSize := NewThumbSize(g.Width, g.Height, tWidth, tHeight) ;
imgOutput := Bitmap.Create(g, thumbSize.Width, thumbSize.Height) ;
imgStream := MemoryStream.Create;
imgOutput.Save(imgStream, g.RawFormat) ;
imgOutput.Save(Path.Combine('c:\LocationOnServer',FileName)) ;
g.Dispose;
imgOutput.Dispose;
end;
function NewThumbSize(const currentwidth, currentheight, newWidth, newHeight : Double) : Size;
var
tempMultiplier : Double;
NewSize : Size;
begin
if currentheight > currentwidth Then
tempMultiplier := newHeight / currentheight
else
tempMultiplier := newWidth / currentwidth;
NewSize := Size.Create(Convert.ToInt32(currentwidth * tempMultiplier), Convert.ToInt32(currentheight * tempMultiplier)) ;
Result := NewSize;
end;
//Usage:
Generatethumbnail('ThumbnameOnServer', ImageFile.PostedFile.InputStream, thumbWidth, thumbHeight) ;
//Where
//ImageFile : System.Web.UI.HtmlControls.HtmlInputFile;
Another posts included in "Delphi"
| How to encrypt a string (0) | 2007/10/04 |
| Delphi for .Net Code Folding keyboard shortcuts (0) | 2007/10/04 |
| Implementing C#'s foreach loop in Delphi 8 (0) | 2007/10/04 |
| Technology sharing related with software development. Specially content... (0) | 2007/10/02 |
| Window flashing (0) | 2007/09/25 |
| How to use TTF Font Without Installing (0) | 2007/09/25 |
| How to show window contents while dragging (0) | 2007/09/25 |
| How to save text from Clipboard to a file (0) | 2007/09/25 |
Trackback : Cannot send a trackbact to this post.
-
Subject Buy xanax with no prescription.
2009/02/13 22:34
Buy 180 xanax. Xanax. No prescription xanax. Xanax cocktail. Buy cheap xanax without prescription. Side effects of xanax.
-
Subject Fetish town free scat porn and fetish sex sites.
2009/03/31 14:17
Scat porn archive cringe humor forum. Scat porn. Porn movie scat sex. Scat porn galleries.
-
Subject Free zoo porn movies.
2009/03/31 17:59
Animal sex zoo free porn bestiality horse.
-
Subject different money making ideas
2010/01/28 23:26
moneyideas
-
Subject different money making ideas
2010/01/29 07:43
moneyideas
-
Subject different money making ideas
2010/01/31 16:41
moneyideas
2007/10/02 08:53
Technology sharing related with software development. Specially content will be focused to programming language, and embedded systems.
2007/10/02 08:53 in Delphi

Delphi 2005's Welcome Page can easily be modified by adding your favorite links and/or blog RSS feeds. You can add your favorite link to the left column of the page, and add an item in the "Headlines" combobox that (already) contains a list of various blogs
Adding About Delphi Programming to favorite links
1. Locate the Delphi 2005 installation folder, and the "Welcome page" subfolder
2. Open the "XML" subfolder
3. Open the "menuBar.xml" document. Use Notepad or your favorite XML editor
4. Inside the "menuBar.xml" locate the <title>Resources</title>
5. Add a new section, like:
<item>
<title>About Delphi Programming</title>
<link>http://strcpy.com</link>
</item>
2. Open the "XML" subfolder
3. Open the "menuBar.xml" document. Use Notepad or your favorite XML editor
4. Inside the "menuBar.xml" locate the <title>Resources</title>
5. Add a new section, like:
<item>
<title>About Delphi Programming</title>
<link>http://strcpy.com</link>
</item>
Adding About Delphi Programming blog RSS feed
1. Locate the Delphi 2005 installation folder, and the "Welcome page" subfolder
2. Open the "XML" subfolder
3. Open the "defaultProviders.xml" document.
3. Use Notepad or your favorite XML editor
4. Inside the "defaultProviders.xml" locate the last line "</rss>"
5. Above the last line, add a new section, like:
<group>
<title>Favorite Blogs</title>
<item>
<title>About Delphi Programming</title>
<link>http://strcpy.com/</link>
</item>
</group>
2. Open the "XML" subfolder
3. Open the "defaultProviders.xml" document.
3. Use Notepad or your favorite XML editor
4. Inside the "defaultProviders.xml" locate the last line "</rss>"
5. Above the last line, add a new section, like:
<group>
<title>Favorite Blogs</title>
<item>
<title>About Delphi Programming</title>
<link>http://strcpy.com/</link>
</item>
</group>
Finally, reload/refresh your Delphi 2005 Welcome Page and the new items will appear in the feed combobox and in the left column.
Another posts included in "Delphi"
| Creating thumbnail images (0) | 2007/10/04 |
| How to encrypt a string (0) | 2007/10/04 |
| Delphi for .Net Code Folding keyboard shortcuts (0) | 2007/10/04 |
| Window flashing (0) | 2007/09/25 |
| How to use TTF Font Without Installing (0) | 2007/09/25 |
| How to show window contents while dragging (0) | 2007/09/25 |
| How to save text from Clipboard to a file (0) | 2007/09/25 |
| How to send char as message to another application (0) | 2007/09/25 |
Trackback : Cannot send a trackbact to this post.
-
Subject Cocaine and codeine.
2009/05/07 03:35
Withdrawal symptoms from codeine. Codeine. Codeine can ada. Codeine pvtussin.
-
Subject different money making ideas
2010/01/29 04:36
moneyideas
-
Subject different money making ideas
2010/01/29 13:30
moneyideas
-
Subject different money making ideas
2010/01/31 16:41
moneyideas
Prev

Rss Feed