CProgrammingTrends Home Page About iEntry Article Archive News WebProWorld Forums Jayde iEntry Contact Advertise Downloads iEntry
06.16.04


Accepting command line arguments
In C++ it is possible to accept command line arguments. To do so, you must first understand the full definition of int main(). It actually accepts two arguments, one is number of command line arguments, the other is a listing of the command line arguments.

It looks like this:

int main(int argc, char* argv[])

The integer, argc is the ARGument Count (hence argc). It is the number of arguments passed into the program from the command line, including the path to and name of the program.
Read The Whole Article
Processing Global Mouse and Keyboard Hooks in C#
This class allows you to tap keyboard and mouse and/or to detect their activity even when an application runs in the background or does not have any user interface at all. This class raises common .NET events with KeyEventArgs and MouseEventArgs, so you can easily retrieve any information you need.

Background

There are a number of applications that run in background and detect user inactivity to change their mode. For example, MSN Messenger (or any other messenger). I was going to write such an application, so I searched MSDN and found "exactly" what I needed: 318804 - HOW TO: Set a Windows Hook in Visual C# .NET. This article describes how to tap the mouse movement, but it was working only when an application was active. At the end of this article, I found this explanation: "Global Hook Is Not Supported in .NET Framework. You cannot implement global hooks in Microsoft .NET Framework...". Anyway, I continued my research and found out that there are exceptions. There are WH_KEYBOARD_LL and WH_MOUSE_LL hooks that can be installed globally. So I have basically replaced WH_MOUSE to WH_MOUSE_LL in the MSDN example and it worked.
Read The Whole Article


Writing a Smart Card Library
In this article we are going to develop a Smart Card Library that will ease the development of Smart Card Applications using the Win32 SDK and/or MFC. This assumes that you’re familiar with Win32 and MFC. The library builds upon the available support for Smart Cards in Windows by providing an Object Oriented wrapper over the WinSCard API. One advantage of using this library is the layered approach, which isolates the core API’s available to non-Win32 conformant languages like java to access this library through JNI (Java Native Interfaces). If you’ve already developed some applications using the APIs exposed by WinSCard.dll then you’ll be well aware of the complexities involved and here is an attempt to ease them.

Microsoft has provided several enhancements toward the use of PCSC conformant Smart Cards with the operating systems releases made after Windows 2000.There is available a COM wrapper and Smart Card Base Components provided as a part of this enhancements.
Read The Whole Article

[ memberwiseclone() function ]
Like finalize() method, we also come to see memberwiseclone() method in almost every class ,as protected instance methods . It is inherited from Object class, which is the mother class of .NET classes.

By definition, memberwiseclone() method "creates a shallow copy of the current Object." A shallow copy of an Object is a copy of the Object only. If the Object contains references to other objects, the shallow copy will not create copies of the referred objects. It will refer to the original objects instead. On the other hand, a deep copy of an object creates a copy of the object and a copy of everything directly or indirectly referenced by that object.
Read The Whole Article


Working with Delegates in C#
Imagine that you need your program to call a method, but you can't know what that method will be until run-time. Perhaps it's a sort method, such as a bubble sort, merge sort, or quick sort. What if your algorithm needs a mathematical function, but the exact algorithm can't be determined until specific data is analyzed? Sometimes, generic GUI events and controls need to provide notification mechanisms for their events, but only the developer knows which callbacks are appropriate for a given implementation. All of these situations are practical applications and reasons for using delegates.

With delegates, you can reference methods and build algorithms that work, regardless of what those methods are. If you're familiar with C++, you might recognize this as being the same as function pointers. However, the difference with C# is that delegates are object-oriented and type safe.
Read The Whole Article

An Intro to Destructors in C#
The article aims to introduce the way the destructors are implemented in .NET. Let us start by defining destructors in simple terms.

Destructor is method in the class which is aimed to release the resources that the instance of the class has acquired. This method is called by CLR when the instance of the class is getting destructed.
Read The Whole Article




Read this Newsletter at: http://www.cprogrammingtrends.com/2004/0616.html
Free Newsletters
Part of the iEntry Network
over 4 million subscribers
CProg.Trends
SecurityConfig
ITProNews

Send me relevant info on products and services.


 

 

From the Forum:
I know what databases can do...
I know pretty much how to set up a database...its the entry part that drives me nuts. I would like to learn how to set up user friendly input forms that integrate directly with my database. In other words I do not want to have to remember a bunch of key codes for products in order to do entries for a vendor. This form would have to input data into three seperate tables, but all be shown on one form. ...
Read the Post

 

-- CProgrammingTrends is an iEntry, Inc. publication --
iEntry, Inc. 880 Corporate Drive, Lexington, KY 40503
2004 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal


archives | advertising info | news headlines | free newsletters | comments/feedback | submit article



DevWebPro.com LinuxProNews.com