C/C#/C++/MFC

1 / 3

Double Linked List based in C++

800

Below is the double linked list example that based on console.Specially this application use macro by define function provided by ANSI C.It's just like inline function that C++ provides.

How to restrict a program to a single instance

733

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

Compress and decompress strings in C#

977

GZipStream is a class in C# that provides a way to compress and decompress data using the GZIP algorithm.It acts as a wrapper around a stream,allowing you to read or write compressed data to and from the stream.When used for compression,it takes an input s...

How to exit from a console application

816

Environment.Exit in C# is a static method that abruptly terminates the current process,exiting the application immediately.It takes an integer argument representing the exit code,which can be used to signal success (0) or failure (non-zero) to the operatin...

Simple Example of IF/THEN using C#

1,272

A C# based webpage is a website built using C# programming language on the server-side,often using ASP.NET framework,to handle logic and data processing.C# code interacts with HTML,CSS,and JavaScript to dynamically generate web pages,retrieve data from dat...

Adding Custom Paper Sizes To Named Printers

652

My company needed me to programmatically add a custom paper size (a printer form) to the default printer and set the printer to use the custom paper size. After looking around,the best alternative we could find was to make use of the printing and print spo...

UDP Send and Receive Using CAsyncSocket

1,207

The following is sample code showing use of CAsyncSocket to send and receive UDP packets.I used the ClassWizard to create a class (CUDPSocket) derived from CAsyncSocket.The derived class does little more than override OnReceive.The derived class is used in...

How to rename(change file name) in C# ?

1,086

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

How to display message box in C#

1,129

In C#,a MessageBox is a pre-built dialog box used to display simple messages to the user.It's a convenient way to show alerts,confirmations,warnings,and other brief information to the user.It provides basic features like text display,buttons (OK,Yes / No,C...

Retrieve system information

498

The SystemInformation class in C# provides static methods to retrieve information about the user's system,including screen resolution,available memory,operating system version,and other system-related details.It allows developers to tailor their applicatio...

String Replace Function For C#

1,561

Regex.Replace is a method in .NET that allows you to find and replace text within a string using regular expressions.You provide it with a regular expression pattern to match,the replacement text,and the string you want to modify.It searches the string for...

How to detect resource leaks in a Form

950

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 / Select Columns menu item. 4.Check the...

How to delete file ?

1,200

System.IO is a namespace in .NET that provides classes and interfaces for working with files,directories,and streams,allowing you to read,write,create,and manipulate data stored on your computer's file system. C# provides file utility as File Class.You don...

C# Lists

1,166

It is a fairly common programming scenario to find ourselves with a list of identical objects.In the past,without adequate support from programming languages,we found ourselves writing a lot of searching and sorting code,and that may have put you off using...

Simplified .NET Printing In C#

696

The RichTextBox control in C# is a versatile element that allows users to display and edit formatted text,including different fonts,colors,sizes,and styles.It provides features like text highlighting,bullet points,indentation,and hyperlinks,making it suita...

Creating A Watched Folder With Assigned Events

1,672

The C# FileSystemWatcher class is a powerful tool for monitoring changes within a specified directory.It allows you to detect events such as file creation,deletion,renaming,and changes in file content,providing real-time notifications that can trigger cust...

Send Email Using C#

1,381

In C#,MailMessage is a class within the `System.Net.Mail` namespace used to represent an email message.It allows you to set properties like the sender,recipient,subject,body,attachments,and other email-related attributes.You can then use a `SmtpClient` obj...

Stack Tutorial In C#

674

stack is a LIFO (Last In First Out) queue,so if you add two items and then ask for an item you would get the second item then the first item.To add items to the Stack you use Push method.This method takes an object of any type but to keep things simple let...

Queue Tutorial In C#

1,756

Adding Items to the Queue.To add items to the Queue you use Enqueue method.This method takes an object of any type but to keep things simple lets just give it a string object: .Viewing a Single Object Without Removing it From the Queue.You can use the Peak...

Create PDF Files On the Fly in C#

1,010

Creation of PDF Document in 5 easy stepsStep 1: First create an instance of document object.Step 2: Now create a writer that listens to this doucment and writes the document to desired Stream.Step 3: Open the document now using.Step 4: Now add some content...

Interacting With TinyPic From C#

1,316

The following snippet will demonstratehow to interact with http: / / tinypic.com,an image mirroringservice,directly from a C# application,using the WebRobot componentavailable from http: / / foxtrot-xray.com .

HashTable Tutorial In C#

1,795

Adding objects to a Hashtable is just like adding to a collection since they both inherit from the same parent. Determining if an Object is in the HashtableYou can search the Key and the Value lists in a Hashtable for a specific entry:Here is an example of...

Simple C# CGI working on Apache

488

Simple program to demonstarte the power of c# on the Net.This program require web server e.g(java web server ,apache etc).Hello.cs.Compile the class Hello.cs.This will give u a exe file i.e Hello.exe.Put this file in the server's cgi-bin directory.for e.g ...

A Customizable Printing Text Class

440

At least once,in the life of a programmer,it succeeds that the moment arrives to print a text document.The task is quite simple for a .NET programmer,but even more with PrintTextDocument class.This class was written to help in printing text documents,addin...

Find Files in certain directory

937

The DirectoryInfo class in C# represents a directory on your computer's file system.It provides methods for interacting with the directory,such as creating new directories,deleting existing ones,checking if a directory exists,listing the files and subdirec...