HOME Delphi C# C++ create a thumbnail C# Print today mysql foreach W3C Date Time Format Rotating Text Directory Selection Resize Image URLDecode formatted date Convert.ToInt64 Convert.ToInt32 asctime How to convert UTF8 string to Base64 string Unlink GMT Base64Encode Force Single Instance Enable Button Hook in the OnIdle method Enable Menu Enable Toolbar Buttons EnableVisualStyles GMT to string DateTime Conversion File Delete GetProcess How to terminate application GMT string GIF to PNG GIF to Jpeg GetCurrentDir How to exit application GetTempDir C# PNG Library Amazon Amazon CloudFront ASCII Artwork Base64Decode Bitmap to Jpeg BridgeTalk C# Bitmap Library C# Control Statements C# GIF Library C# Graphics C# Jpeg Library email Computer Name Convert.ToString CreateGraphics Creating Thumbnail current_time Access Key Disable Button Disable Menu Working Directory

C/C#/C++/MFC ( 1 / 3 )

How to convert integer to text string ?   (created at Sep 03, 2009)   156  

C# provides an excellerent static instance can convert various types. You can easily get the wanted reult by Convert Class. Because It's a static instance, you don't need to declare instance.Following is the example to example to convert from integer to te...

URL Encode, Decode function for MFC   (created at Mar 23, 2009)   135  

Here's the good example for URL Encoding & Decoding.  Above sample code use CString, so if you want to use it on another type of development environment such as gcc or something like that, you need to add some more stuffs because it may not suppo...

How to load HTML resource on MFC ?   (created at Mar 23, 2009)   145  

I tried to load HTML resource that stored in the application for MFC based application programming. The resource name is IDR_KURAPA_COM_HTML_ROOT.Actually this is very convenient to reduce files for application package.You can load HTML resource as followi...

How To Check If Your Printer Is Connected Using C#   (created at Feb 27, 2012)   139  

This code will test whether a printer is connected to your system or not. It works with USB and network printers (haven't tested LPT printers yet). Some printers (like my HP DeskJet 930c) is detected online even though I press the OFF b...

KMP String Matching Algorithm   (created at Jul 21, 2010)   112  

KMP String Matching Algorithm is well-known algorithm for faster string search. KMP is, as you know, Knuth, Morris, and Pratt. It's complexity is O(n). n is the length of target string and O is big-O notation.Here's the implemented algorithm.//////////////...

How to get process id in C# like windows task manager ?   (created at Oct 15, 2009)   169  

Following is simple example to get process name and add process name to listbox control.As you can see below, you can get working process by Process control. But most of the properties are supported on windows platform. If you want to access the similar pr...

How to implement switch statement in C# ?   (created at Sep 05, 2009)   243  

Switch statement executes a set of logic depending on the value of a given parameter.The types of the values a switch statement operates on can be booleans, enums, integral types, and strings.Following is the example.switch( strName){  case "james":&n...

How to implement while loop in C# ?   (created at Sep 05, 2009)   137  

A while loop will check a condition and then continues to execute a block of code as long as the condition evaluates to a boolean value of true. Its syntax is as follows: while () { }.  The statements can be any valid ...

How to delete file ?   (created at Sep 04, 2009)   421  

C# provides file utility as File Class. You don't need to create instance, because it's already created when you declare System.IO on top of your code.Following is the example to delete file.using System.IO;...File.Delete("c:\_bg.png");File.Delete("c:\_glo...

How to convert text string to integer ?   (created at Sep 03, 2009)   132  

C# provides an excellerent static instance can convert various types. You can easily get the wanted reult by Convert Class. Because It's a static instance, you don't need to declare instance.Following is the example to example to convert from text string t...

How to set an certain color as transparent color on bitmap   (created at Sep 03, 2009)   79  

In order to make an certain color as transparent color on bitmap, you can set as below way:Bitmap bmp = new Bitmap(w, h);// Set white as transparent colorbmp m_Img.MakeTransparent(Color.White);

How to resize and save PNG or Jpeg Image file ?   (created at Sep 03, 2009)   106  

I tried to change image file with PictureBox control. Following is the example to convert image size.private void copy_to_resized_png(string tar, string src, int w, int h){  Image imgInput = Image.FromFile(src);  Bitmap bitmapResized = new Bitmap...

How to display message box in C#   (created at Sep 03, 2009)   97  

C# provides very simple message displaying interface as MessageBox.Here's the simple example.MessageBox.Show( "Isn't it great ?");

How to convert bitmap image to jpeg image ?   (created at Sep 03, 2009)   46  

C# provides easy interface to convert image.Following is the simple example.using System.Drawing.Imaging;...Image image = Image.FromFile("test.bmp");image.Save("test.jpg", ImageFormat.Jpeg);Above is PNG to jpeg. You can convert Jpeg to PNG as following.usi...

To load image from file   (created at Sep 03, 2009)   53  

In order to load image from file in C#, you can load them as following way. The image type could be Jpeg, GIF, Bitmap(BMP), as well as PNG.Image m_source = Image.FromFile( 'the file name you need to load');Isn't it simple ?

How to get GM Time as String ?   (created at Mar 20, 2009)   70  

Here's the simple example to get GMT string. 

Finding process name on OS   (created at Sep 22, 2008)   75  

Following function is very useful when checking currently working process based on name.using System.Diagnostics;...public bool IsProcessOpen(string name){    foreach (Process clsProcess in Process.GetProcesses) {        if (c...

Convert System.DateTime to UNIX timestamp   (created at Sep 22, 2008)   45  

In case of development in clinet/server application, datetime formation conversion is frequently required.Following is the simple example for datetime conversion.private double ConvertToTimestamp(DateTime value){   

Retrieve system information   (created at Sep 22, 2008)   58  

When system information is required in application, SystemInformation global instance is very useful.In case of getting Monitor Size, Virtual Screen, Computer Name, Keyboard Delay, Network Connection, Power Status, and other system variables, SystemInforma...

How to call SetTimer function on MFC CDialog class ?   (created at Jul 30, 2008)   91  

Hi, problem with MFC Dialog based app: In OnInitDialog: Code: SetTimer( WM_USER+100, 500, NULL ); In OnTimer: Code: MessageBox(... CDialog::OnTimer(nIDEvent); But OnTimer never reached. Why? When i call SendMessage( WM_TIMER, 0, 0); OnTimer calls succesful...

How to rename(change file name) in C# ?   (created at Mar 12, 2008)   64  

Simplest way to change file name in C# is using File.Move() function.Here's the simple example change file name for Samsung Black Jack Phone. However it may work on another platform if it supports .NET compact framework.In addition, File creation time can ...

Find Files in certain directory   (created at Feb 25, 2008)   53  

Following is the simple c# example to fins file in given directory. using System.IO;

Implementing C#'s foreach loop in Delphi 8   (created at Oct 03, 2007)   44  

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 sim...

How to detect resource leaks in a Form   (created at Sep 25, 2007)   61  

It is possible for Forms to have resource leaks even though they are running in managed code. To determine if a form is leaking resources:   1. Run the Windows Task Manager   2. Select the Processes tab.   3. Select the View /...

The best way to enable and disable buttons, menu items and toolbar buttons   (created at Sep 25, 2007)   67  

Write an OnIdle method and put your GUI enable/disable code there. The OnIdle method is called every time your application's message queue becomes empty.Hook in the OnIdle method in a Form's constructor by instantiating an EventHandler and adding that hand...

How to exit from a console application   (created at Sep 25, 2007)   43  

Use Environment.Exit to immediately return from a console application with a specified result code.using System;namespace ConsoleApplication1{  class Class1  {    [STAThread]    static void Main(string[] args)    {&n...

How to restrict a program to a single instance   (created at Sep 25, 2007)   95  

In the program's Main method, call ProcessUtils.ThisProcessIsAlreadyRunning() to determine if another instance of the program is already running. ThisProcessIsAlreadyRunning attempts to create a Mutex object with the same name as the program (Application.P...

Compress and decompress strings in C#   (created at Sep 25, 2007)   75  

A couple of days ago, I had to store some very big strings in an XML file. To keep the file size down I wanted to compress the strings using a GZipStream and then decompress them later when needed.I modified the methods from Papenoo pa so they handled stri...

Graphics in C# - Irregular Forms   (created at Sep 25, 2007)   52  

Quite frankly, I think this topic is a lot of fun...the thought of making an app look completely different from the usual rectangular-formed layout really appeals to me.Drawing an irregular form, like drawing anything, requires four things : a surface, a s...

Extracting the Country from IP Address   (created at Sep 25, 2007)   97  

Notes: If you want to run this sample,you should copy the Ip address to driver c:. Using the codePart 1.using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows....


Page: 1   2   3