C# CGI Example.zip

How to send binary data through C# CGI app?

997

Following example implemented binary data downloading. If you are using Apache and wanna test it just put the EXE in the cgi-bin folder under Apache's directory.Also note that the parameters are static just for this example.

Simple C# CGI working on Apache

485

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

C++ CGI Example working on Apache

488

In this short howto I will explain how to setup your apache webserver to run any compiled application as an CGI script and show a little example program to explain the main concepts. So why does someone might have the idea to execute an application? There ...

How To Check If Your Printer Is Connected Using C#

1,027

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

675

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 ?

870

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 convert integer to text string ?

700

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

How to convert text string to integer ?

612

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 resize and save PNG or Jpeg Image file ?

635

The PictureBox control in C# is a visual element that allows you to display images within your application's user interface.It's a versatile tool for displaying images,icons,graphics,and other visual content,and it can be easily manipulated using propertie...

How to convert bitmap image to jpeg image ?

357

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

454

The `Image.FromFile` method in C# is used to load an image from a specified file path into an `Image` object.It takes a string argument representing the full path to the image file and returns a new `Image` object containing the loaded image data.This meth...

URL Encode, Decode function for MFC

607

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 ?

845

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 search file on certain directory ?

631

In case of finding files on certain directory, you need to use FindFirstFileEx function.Following example shows the example,bool KFindFile(void *findname){    WIN32_FIND_DATA FindFileData;    HANDLE hFind;    CString strSearch...

How to speed up access to the RichTextBox Lines property

832

Using a foreach loop will be substantially faster than a for loop when accessing the items in a RichTextBox's Lines property. For example, the following code loads a RichTextBox with 1000 lines of text and accesses each line from the Lines property. On a 3...

How to restrict a program to a single instance

730

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

Graphics in C# - Irregular Forms

912

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

470

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

How to run shell command by MFC ?

440

Followings are the useful example can run shell command. If you want to launch browser for specific URL,simple run as below:* Note: The above code must be included in the same source.

Binary Search Sample Code

408

This is Binary search that returns a negative one if the number is not found.This code does a bubble sort and then proforms the binary search.

Double Linked List based in C++

798

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.

MFC based World Wide Web HTTP Server Source Code

462

The below attachment is HTTP Server source code that supports CGI. Detail Description: HTTPSVR is an MFC sample that demonstrates the use of MFC and its Windows Sockets (WinSock) classes in implementing a simple World Wide Web HTTP server. HTTPSVR turns an...

Creating and Using a CAsyncSocket Object to use CAsyncSocket

473

Followings are the procedure to send / receive UDP packet by CAsyncSocket.STEP 1. ConstructionConstruct a CAsyncSocket object and use the object to create the underlying SOCKET handle.Creation of a socket follows the MFC pattern of two-stage construction.F...

How To Print Text In C#

456

If you want to use MultipadPrintDocument in your own code,it's best to rename the class and its constructor to something more appropriate.Then add a variable of type XXXPrintDocument to your form and implement the menu items as follows: .

Fast and Good Keyboard/Mouse Test without the message handler

982

In this short snippet, I will show you a Win32 function that checks whether a button is pressed or not. The good thing is that you don't need to handle the WM_KEYDOWN message. The second advantage is that it is really easy to use and that it can be used ev...

Simple CGI Programming in C

549

Here's the simplest C based CGI example. #include #include int main(void){    char *data;    printf("Content-Type:text / html;xdxa"); / / HTML out start !!    printf("Multiplication results< / TITL...</p> </div> </article> </div> </div></div> <script>function doSearch(){var kw = document.getElementById("search_keyword").value.trim();if (kw.length<2) alert("Too short search keyword!");else window.self.location = "/search/" + encodeURIComponent(kw) + "/";}</script> <div class="hc-search"> <input type="text" class="tw-input" id="search_keyword" value="C# CGI Example" placeholder="Search keyword" onkeydown="if (event.key==='Enter') { doSearch(); }"> <button type="button" class="tw-btn tw-btn-primary" onClick="javascript:doSearch();">Search</button> </div> </div> <br> <br> <div id="menu"><table bgcolor="black" width="100%"> <tr width=100%><td style="margin:5px;padding:5px;"><span id="menu2_1" style="margin:5px;padding:5px;"><a href="https://strcpy.com/notice/416/strcpycom-Renewal/"><font color='yellow'><nobr>About Super Coder's Page</nobr></font></a></span>  <span id="menu2_2" style="margin:5px;padding:5px;"><a href="/privacy_policy/"><font color='yellow'><nobr>Privacy Policy</nobr></font></a></span></font></td> </tr></table></div> <script> var g_masonry = null; var g_masonry_observer = null; function masonry_grid_update() { var grid = document.querySelector( ".grid" ); if (!grid || typeof Masonry === "undefined") return; /* first call builds the layout; later calls (e.g. after ads load) pick up added cards and re-stack */ if (!g_masonry) g_masonry = new Masonry( grid, {"itemSelector":".grid-item","gutter":3,"fitWidth":true,"percentPosition":false} ); else { g_masonry.reloadItems(); g_masonry.layout(); } /* re-stack whenever a card changes height (lazy images, ads, embedded videos) */ if (!window.ResizeObserver) return; if (!g_masonry_observer) { var timer = null; g_masonry_observer = new ResizeObserver( function() { clearTimeout( timer ); timer = setTimeout( function() { if (g_masonry) g_masonry.layout(); }, 60 ); }); } grid.querySelectorAll( ".grid-item" ).forEach( function(node) { g_masonry_observer.observe( node ); } ); } /* Masonry may load with defer (TCKTAILWIND defer_scripts option): then build the grid once the page is parsed */ if (typeof Masonry !== "undefined") masonry_grid_update(); else document.addEventListener( "DOMContentLoaded", masonry_grid_update ); window.addEventListener( "load", function() { if (g_masonry) g_masonry.layout(); } ); </script> </body> <script>var g_ck_ad_refresh_duration = 25000;var g_ck_ad_initial_refresh_duration = 20000;function adjustContainerWidth(container) {var windowWidth = window.innerWidth || document.documentElement.clientWidth;var containerWidth = parseInt(container.style.width) || parseInt(window.getComputedStyle(container).width);if (containerWidth > windowWidth) {container.style.width = (windowWidth - 6) + "px";}}function createAdSense(container) {var adSenseAd = document.createElement('ins');adSenseAd.className = 'adsbygoogle';adSenseAd.style.cssText = container.getAttribute('ad-style');adjustContainerWidth(container);adSenseAd.setAttribute('data-ad-client', container.getAttribute('data-ad-client'));adSenseAd.setAttribute('data-ad-slot', container.getAttribute('data-ad-slot'));var adSenseScript = document.createElement('script');adSenseScript.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';adSenseScript.async = true;adSenseScript.crossorigin = 'anonymous';container.innerHTML = '';container.appendChild(adSenseAd);container.appendChild(adSenseScript);var pushScript = document.createElement('script');pushScript.innerHTML = '(adsbygoogle = window.adsbygoogle || []).push({});';container.appendChild(pushScript);}</script><script>var _cur_ad_pos = 0;var _ad_elements = null;var _ad_elements_len = 0;function isVisible(element){const rect = element.getBoundingClientRect();return (rect.width > 0 &&rect.height > 0 &&rect.top >= 0 &&rect.left >= 0 &&rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&rect.right <= (window.innerWidth || document.documentElement.clientWidth));}function refreshAdSense(){if (_ad_elements){if (document.visibilityState === "visible"){for (var i = 0; i < _ad_elements_len; i++){if ( isVisible( _ad_elements[i] ) ) createAdSense(_ad_elements[i]);}}setTimeout( refreshAdSense, g_ck_ad_refresh_duration );}if (typeof masonry_grid_update === 'function') setTimeout(masonry_grid_update, 500);}function loadAdSense0(){_ad_elements = document.querySelectorAll('[class="adsbygoogle"]');if (_ad_elements){_ad_elements_len = _ad_elements.length;for (var i = 0; i < _ad_elements_len; i++){createAdSense(_ad_elements[i]);}}setTimeout( refreshAdSense, g_ck_ad_initial_refresh_duration );if (typeof masonry_grid_update === 'function') setTimeout( masonry_grid_update, 500);}setTimeout(loadAdSense0, 500);</script> </html>