Thursday 20 August 2015

REGISTRYZ

Safe your Registry

(Protecting Windows using Windows Registry  C++)


This Post will tell you how you can secure you windows using some basic features of the Windows Registry. Windows Registry is a database which stores the configuration settings and options on Windows operating system. Operating system reads the registry key values while booting. You should have a comprehensive understanding of registry keys and the possible value it can have before manipulating it.
Below is an example in CPP which shows how to make use of the registry keys to customize the behavior of Windows. To understand the below example, you should have the basic knowledge of how to write a window based application in CPP.

Registry Functions used:
RegOpenKeyEx for opening the specified registry key
RegSetValueEx for setting the value and data type of a specified value under a key
RegDeleteValue for removing a value from the specified key

1.  Declarations

HANDLE hprocess_terminate;
HINSTANCE hInstance;
HWND hwnd;
static int operation;
DWORD x;
static HKEY hkey,hkey1;
UINT drive;
DWORD pid=0;


2.  Windows main function

int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASS wnd;
MSG msg;
HWND hwnd;

wnd.cbClsExtra=0;
wnd.cbWndExtra=0;
wnd.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wnd.hCursor=LoadCursor(hInstance,IDC_ARROW);
wnd.hIcon=LoadIcon(hInstance,IDI_APPLICATION);
wnd.hInstance=hInstance;
wnd.lpfnWndProc=myproc;
wnd.lpszClassName=L"usb";
wnd.lpszMenuName=NULL;
wnd.style=CS_HREDRAW|CS_VREDRAW;

if(!RegisterClass(&wnd))
{
MessageBox(NULL,L"RegisterClass failed",L"",MB_OK);
}

hwnd=CreateWindow(L"usb",L"RegSec",WS_OVERLAPPEDWINDOW,20,20,650,600,NULL,LoadMenu(hInstance,MAKEINTRESOURCE(IDR_MENU1)),hInstance,NULL);
if(hwnd==NULL)
{
MessageBox(NULL,L"CreateWindow failed",L"",MB_OK);
}

ShowWindow(hwnd,SW_SHOW);

while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}


return 0;
}


3.  Window Procedure

LRESULT CALLBACK myproc(          HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{

switch(uMsg)
{
case WM_CREATE:
return 0;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case ID_USB_DISABLEUSBPORTS:
x=4;
RegOpenKeyEx(HKEY_LOCAL_MACHINE,L"SYSTEM\\CurrentControlSet\\Services\\USBSTOR",0,KEY_ALL_ACCESS,&hkey);
RegSetValueEx(hkey,L"Start",0,REG_DWORD,(LPBYTE)&x,sizeof(DWORD));
break;

case ID_USB_ENABLEUSBPORTS:
x=3;
RegOpenKeyEx(HKEY_LOCAL_MACHINE,L"SYSTEM\\CurrentControlSet\\Services\\USBSTOR",0,KEY_ALL_ACCESS,&hkey);
RegSetValueEx(hkey,L"Start",0,REG_DWORD,(LPBYTE)&x,sizeof(DWORD));
break;

case ID_USB_ENABLEWRITEPROTECTION:
x=1;
RegOpenKeyEx(HKEY_LOCAL_MACHINE,L"SYSTEM\\CurrentControlSet\\Control\\StorageDevicePolicies",0,KEY_ALL_ACCESS,&hkey);
RegSetValueEx(hkey,L"WriteProtect",0,REG_DWORD,(LPBYTE)&x,sizeof(DWORD));
break;

case ID_USB_DISABLEUSBWRITEPROTECTION:
x=0;
RegOpenKeyEx(HKEY_LOCAL_MACHINE,L"SYSTEM\\CurrentControlSet\\Control\\StorageDevicePolicies",0,KEY_ALL_ACCESS,&hkey);
RegSetValueEx(hkey,L"WriteProtect",0,REG_DWORD,(LPBYTE)&x,sizeof(DWORD));
break;

case ID_HARDDRIVES_HIDEALLDRIVES:
operation=1;
DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),hwnd,dialogProc);
break;

case ID_HARDDRIVES_SHOWALLDRIVES:
RegOpenKeyEx(HKEY_CURRENT_USER,L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",0,KEY_ALL_ACCESS,&hkey);
RegDeleteValue(hkey,L"NoDrives");
break;

case ID_HARDDRIVES_LOCKHARDDRIVES:
operation=2;
DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),hwnd,dialogProc);
break;

case ID_HARDDRIVES_UNLOCKHARDDRIVES:
RegOpenKeyEx(HKEY_CURRENT_USER,L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",0,KEY_ALL_ACCESS,&hkey);
RegDeleteValue(hkey,L"NoViewOnDrive");
break;

case ID_CONTROLPANEL_DISABLECONTROLPANEL:
x=1;
RegCreateKey(HKEY_CURRENT_USER,L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",&hkey);
RegSetValueEx(hkey,L"NoControlPanel",0,REG_DWORD,(LPBYTE)&x,sizeof(DWORD));
break;

case ID_CONTROLPANEL_ENABLECONTROLPANEL:
RegOpenKeyEx(HKEY_CURRENT_USER,L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",0,KEY_ALL_ACCESS,&hkey);
RegDeleteValue(hkey,L"NoControlPanel");
break;

case ID_CONTROLPANEL_BLACKLISTAPPLICATIONS:
DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG2),hwnd,dialogProc2);
break;
}

DWORD aProcesses[1024], cbNeeded, cProcesses;
unsigned int i;
if ( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) )
{
return 1;
}
// Calculate how many process identifiers were returned.
cProcesses = cbNeeded / sizeof(DWORD);
// Print the name and process identifier for each process.
for ( i = 0; i < cProcesses; i++ )
{
if( aProcesses[i] != 0 )
{
PrintProcessNameAndID( aProcesses[i] );
}
}
return 0;
case WM_CLOSE:
DestroyWindow(hwnd);
return 0;
case WM_DESTROY :
PostQuitMessage(WM_QUIT);
return 0;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}

}

4.  Dialog Procedure #1

INT_PTR CALLBACK dialogProc(          HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg)
{
case WM_INITDIALOG:

return true;
case WM_COMMAND:

switch(LOWORD(wParam))
{
case IDC_OK:
drive=GetDlgItemInt(hwndDlg,IDC_EDIT1,NULL,FALSE);
x=drive;
if(operation==1)
{
RegCreateKey(HKEY_CURRENT_USER,L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",&hkey);
RegSetValueEx(hkey,L"NoDrives",0,REG_DWORD,(LPBYTE)&x,sizeof(DWORD));
}
if(operation==2)
{
RegCreateKey(HKEY_CURRENT_USER,L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",&hkey);
RegSetValueEx(hkey,L"NoViewOnDrive",0,REG_DWORD,(LPBYTE)&x,sizeof(DWORD));
}

EndDialog(hwndDlg,0);
break;
}
return true;
case WM_CLOSE:
EndDialog(hwndDlg,0);
return true;
}
return false;
}

Dialog Procedure #2

INT_PTR CALLBACK dialogProc2(          HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
static int blacklist_app_counter=0;
wchar_t buff[5],app_name[20];//,temp[20];
switch(uMsg)
{
case WM_INITDIALOG:
/*blacklist_app_counter++;
RegOpenKeyEx(HKEY_CURRENT_USER,L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\DisallowRun",0,KEY_ALL_ACCESS,&hkey1);
while(RegEnumKeyEx(hkey1,blacklist_app_counter,NULL,NULL,0,NULL,NULL,NULL)!=ERROR_NO_MORE_ITEMS)
{
blacklist_app_counter++;
}
wsprintf(temp,L"%d",blacklist_app_counter);
MessageBox(hwnd,temp,L"",MB_OK);*/
return true;
case WM_COMMAND:

switch(LOWORD(wParam))
{
case IDC_CONTINUE:
blacklist_app_counter++;
wsprintf(buff,L"%d",blacklist_app_counter);
GetDlgItemText(hwndDlg,IDC_EDIT1,app_name,wcslen(app_name));
RegCreateKey(HKEY_CURRENT_USER,L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\DisallowRun",&hkey);
RegSetValueEx(hkey,buff,0,REG_SZ,(LPBYTE)app_name,50);
EndDialog(hwndDlg,0);
DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG2),hwnd,dialogProc2);
//MessageBox(hwndDlg,L"continue",L"",MB_OK);
break;

case IDC_ACTIVATE:
x=1;
RegOpenKeyEx(HKEY_CURRENT_USER,L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",0,KEY_ALL_ACCESS,&hkey);
RegSetValueEx(hkey,L"DisallowRun",0,REG_DWORD,(LPBYTE)&x,sizeof(DWORD));
EndDialog(hwndDlg,0);
break;

case IDC_DEACTIVATE:
x=0;
RegOpenKeyEx(HKEY_CURRENT_USER,L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",0,KEY_ALL_ACCESS,&hkey);
RegSetValueEx(hkey,L"DisallowRun",0,REG_DWORD,(LPBYTE)&x,sizeof(DWORD));
EndDialog(hwndDlg,0);
break;

case IDC_CLEAR:
RegOpenKeyEx(HKEY_CURRENT_USER,L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",0,KEY_ALL_ACCESS,&hkey);
RegDeleteValue(hkey,L"DisallowRun");
RegDeleteKey(HKEY_CURRENT_USER,L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\DisallowRun");
EndDialog(hwndDlg,0);
break;
}
return true;
case WM_CLOSE:
EndDialog(hwndDlg,0);
return true;
}
return false;
}

So now you understood how to interact with registry (C++ as an example). You can learn more tips & Tricks on windows registry here 

6THZ Sensez

Sixth Sense Technology Workingz

                                                                   

Defination: 
                   Sixth Sense' is a wearable gestural interface that augments the physical world around us with digital information and lets us use natural hand gestures to interact with that information. it was invented by Pranav Mistry,a PhD candidate in the Fluid Interface Groups at the MIT MEDIA LAB.
 
By using a camera and a tiny projector mounted in a pendant like wearable device, 'Sixth Sense' sees what you see and visually augments any surfaces or objects we are interacting with. It projects information onto surfaces, walls, and physical objects around us, and lets us interact with the projected information through natural hand gestures, arm movements, or our interaction with the object itself. 'Sixth Sense' attempts to free information from its confines by seamlessly integrating it with reality, and thus making the entire world your computer. 
 
 All of us are aware of the five basic senses – seeing, feeling, smelling, tasting and hearing. But there is also another sense called the sixth sense. It is basically a connection to something greater than what their physical senses are able to perceive. To a layman, it would be something supernatural. Some might just consider it to be a superstition or something psychological. But the invention of sixth sense technology has completely shocked the world. Although it is not widely known as of now but the time is not far when this technology will change our perception of the world.
 
The Sixth Sense prototype is comprised of a pocket projector, a mirror and a camera. The hardware components are coupled in a pendant-like mobile wearable device. Both the projector and the camera are connected to the mobile computing device in the user’s pocket. The device projects visual information, enabling surfaces, walls and physical objects around the wearer to be used as interfaces; while the camera recognizes and tracks the user's hand gestures and physical objects using computer-vision based techniques. The software program processes the video stream data captured by the camera and tracks the locations of the colored markers at the tip of the user’s fingers using simple computer-vision techniques. The movements and arrangements of these fiducials are interpreted into gestures that act as interaction instructions for the projected application interfaces. The maximum number of tracked fingers is only constrained by the number of unique fiducials, thus Sixth Sense also supports multi-touch and multi-user interaction.


 The device sees what we see but it lets out information that we want to know while viewing the object. It can project information on any surface, be it a wall, table or any other object and uses hand / arm movements to help us interact with the projected information. The device brings us closer to reality and assists us in making right decisions by providing the relevant information, thereby, making the entire world a computer.
                                     The world has shrunk. Distances have dissolved. Communication lines and interaction with countless systems have been rendered feasible. However this technological overhaul has been peripheral and not so much related to the human body; researchers and innovators have constantly grappled with the issue of bridging the gaps which limit the human-environment contact.  This device, tentatively name as the Sixth Sense, is a wearable machine that assists unexplored interactions between the real and the virtual sphere of data. It consists of certain commonly available components, which are intrinsic to its functioning. These include a camera, a portable battery-powered projection system coupled with a mirror and a cell phone. All these components communicate to the cell phone, which acts as the communication and computation device. 


The entire hardware apparatus is encompassed in a pendant-shaped mobile wearable device. Basically the camera recognizes individuals, images, pictures, gestures one makes with their hands and the projector assists in projecting any information on whatever type of surface is present in front of the person. The usage of the mirror is significant as the projector dangles pointing downwards from the neck. To bring out variations on a much higher plane, in the demo video which was broadcasted to showcase the prototype to the world, Mistry uses colored caps on his fingers so that it becomes simpler for the software to differentiate between the fingers, demanding various applications. 

The software program analyses the video data caught by the camera and also tracks down the locations of the colored markers by utilizing single computer vision techniques. One can have any number of hand gestures and movements as long as they are all reasonably identified and differentiated for the system to interpret it, preferably through unique and varied. This is possible only because the ‘Sixth Sense’ device supports multi-touch and multi-user interaction. There was once a clear divide between the virtual world and the real world, but that line is getting blurrier every day.


figures shows components used in sixth sense technology

components used in sixth sense technology:

  • Camera
  • Color Markers
  • Mobile Component
  • Projector
  • Mirror

Camera:

                                                                          
It captures the image of the object in view and tracks the user’s hand gesture. The camera recognizes individuals, images, pictures, gestures that user makes with his hand. The camera then sends this data to a smart phone for processing. Basically the camera forms a digital eye which connects to the world of digital information.

Color Markers:

                                                               
There are color markers placed at the tip of users finger. Marking the user’s fingers with red, yellow green and blue coloured tape helps the webcam to recognize the hand gestures. The movements and arrangement of these markers are interpreted into gestures that act as a interaction instruction for the projected application interfaces.

Mobile Components:

                                                      
The Sixth Sense device consists of a web enabled smart phone which process the data send by the camera. The smart phone searches the web and interprets the hand gestures with help of the colored markers placed at the finger tips.

Projector:

                                                                    
                                                                 
The information that is interpreted through the smart phone can be projected into any surface. The projector projects the visual information enabling surfaces and physical objects to be used as interfaces. The projector itself consists of a battery which have 3 hours of battery life.
 A tiny LED projector displays the data sent from the smart phone on any surface in view- object, wall or person. The downward facing projector projects the image on to a mirror.

Mirror:

                                                      
The usage of a mirror is important as the projector dangles pointing downwards from the neck. The mirror reflects the image on to a desire surface. Thus finally the digital image is freed from its confines and placed in the physical world.

Workingz


                                       
                          

The Sixth Sense technology works as follows:


Step 1.      It captures the image of the object in view and track the user’s hand gesture.
 
Step 2.      There are color  markers placed at the tip of users finger. Marking the user’s fingers with red, yellow green and blue color tape helps the webcam to recognize the hand gestures. The movements and arrangement of these markers are interpreted into gestures that act as a interaction instruction for the projected application interfaces.
 
Step 3.      The smart phone searches the web and interprets the hand gestures with help of the coloured markers placed at the finger tips
 
Step 4.      The information that is interpreted through the smart phone can be projected into any surface.
 
Step 5.      The mirror reflects the image on to a desire surface. 

Application fields of sixth sense technology:


Step 1. making hand as an mobile screen and dialing numbers displaying on hand through finger tips.

                                             
  Step 2. Taking pictures by angling yours finger tips to the picture you want to take.


                                               
     Step   3. Many others applications are reading newspaper,booking reservation tickets , reading facial expression locating place .  

Mobilez TOWERSZ

Information about every single mobile tower’s emissions!

Wish to know if the phone tower near your residence is emitting radiations within safe levels? Just log on to the national electromagnetic field (EMF) emission portal that will list every mobile phone tower in the country. The portal which is in its last stage of testing is expected to come online early next year. ‘The industry and the department of telecommunications (DoT) are working on a website which will list every cell tower in the country by location and whether it is compliant or not compliant.




‘Its in beta testing mode and we will take another two months to complete the testing,’ Rajan S. Mathews, director general, Cellular Operators Association of India(COAI), told reporters here Monday. ‘After that it will take another nine months to roll it out,’ he said. COAI is a leading mobile communications association. He said the local operators are responsible for putting the information in the database and the DoT will verify the information. Initially four states, including Punjab, Haryana and Maharashtra have been tested for the platform.
This initiative is part of the central government’s aim to debunk ‘myths’ surrounding emissions from cell phone towers, he said. Mathews cited a report by the WHO published in 2009, which said that ‘considering the very low exposure levels’, there is no convincing evidence that the week signals (from mobile towers) cause adverse health effects
Source: IANS

CDAC Cyber Security

 CDAC Cyber Security 

Increased Internet penetration has given exponential rise in sophisticated attacks on Information Technology (IT) infrastructure. Attackers are gaining access to sensitive information like credit card details and other financial information. Smartphone attacks are growing in multiple folds. Also with the growth of 3G services and business transactions using mobile phones, there is a substantial increase in mobile malware. In order to make our IT infrastructure resilient against these threats, there is a need for cutting-edge Research and Development efforts in Cyber Security. C-DAC has been actively pursuing R & D in a number of sub-areas in Cyber Security domain.

Click to view the site

CDAC's Admission Booklet

CDAC's Admission Booklet- Process of Admission to Post Graduate Diploma Courses of C-DAC

Here is the CDAC's Admission brochure I have. This brochure is of Feb, 2013 which can tell you everything about CDAC's Process in detail like C-CAT, Process of cancellation and refund of course fee, about hostel and canteen at CDAC's centers. 

 

Click

 

CDAC

CDAC A government initiative

Before going through this post, I would like to draw your attention towards the importance of this post. This page not only explains my experience in CDAC but also aims at answering the queries of you all who are going or looking to have a course from CDAC. Kindly post your queries at the bottom of this page and we will get back to you within 24 hours. Kindly do not post your queries as an Anonymous user and do not forget to subscribe via email so as to keep track of your query.


NOW a day lot of the graduates and post graduates are wondering most of the times on which course they should go for. What are the pros & cons of joining a particular centre of CDAC. Here is a comprehensive information on how to enroll ourselves for a course in CDAC. The below discussion is based on my explorations and my own experience as i have worked for cdac for more than a year.


CDAC's Admission Booklet- Process of Admission to Post Graduate Diploma Courses of C-DAC
Click here to see placement statistics
Cyber Security Course
CDAC CCAT Rank - Which Centre you Should go for...
About C-CAT, Exam Pattern and Books
No. of Seats Across Various Training Centres
Cyber Security

Although cdac does not guarantee any placement but you can grab many opportunities having a bit of idea about it.



1. CDAC HYDERABAD: The centre is known to have the best training environment for all type of courses. However, it is best known for DSSD based on the stats. CDAC HYDERABAD is the centre which organizes the common entrance test and is well known for its comprehensive training



COURSE PREFERENCE: DSSD, DESD, DABC



PLACEMENT: 7/10



2. CDAC PUNE: The centre is known to have the most successful in attracting a large percentage of trainees each time, a very good option for electronics people. Placement record is much better as compared to bangalore and noida. 



COURSE PREFERENCE : DESD, DABC, CDAD, CNSS

PLACEMENT : 8/10



3.  CDAC BANGALORE: The centre is well known for its infrastructure and training facilites. CDAC BANGLORE is a good option for DESD as well as DAC.



COURSE PREFERENCE: DAC, DESD, DSSD

PLACEMENT : 7/10





CDAC NOIDA and CDAC MOHALI are the two more & good options but the three i have discussed are the most reputed both in terms of placement and training environment. 



If your choice of course selection does not match with what i have given above, thats not an issue. Whatever i am posting is on a good exploration based on the previous records. I wish he best to you all regarding your courses.

CDAC's eLearning Courses:


About Courses
C-DAC Presently offers e-Learning courses in software process management & Cyber Security. It is our fond hope that e-Learning mode of education results in providing benefits such as reachability, Just-in-time learning, affordable, increased retention, well authored content Watch out for seminars/workshops in areas of your interest from C-DAC at www.cdachyd.in
Paid Courses
Key FocusDesigned ForAuthored byFeatures
To understand the security concerns, vulnerabilities, attacks and to plan and implement the desired e-Security solutions.
» Network System
» Administrators
» Information Security Officers
» IT professionals
An Expert having experience at all stages of Cyber Security & popular author of text books in many fields of IT
» Online Quizes
» Collaborative interaction 
   with instructor
» Access to remote 
» Virtual labs
Register Here
Key FocusDesigned ForAuthored byFeatures
To understand the security concerns, vulnerabilities, attacks and to plan and implement the desired e-Security solutions.
 Network System
 Administrators
 Information Security Officers
 IT professionals
An Expert having experience at all stages of Cyber Security & popular author of text books in many fields of IT
 Online Quizes
 Collaborative interaction 
   with instructor
 Access to remote 
   virtual labs
Register Here
Key FocusDesigned ForAuthored byFeatures
To give an edge to the Software professional in Software Engineering, Project Management & Quality ManagementSoftware Developers, Project Managers, Testing Teams & Who care for best practisesAn Expert having experience at all stages of Software project & popular author of text books in many fields of ITContinuous evalution at module level for self assessment through objective type tests & assignments for subjective evalution
Register Here



My experience in brief:



1. CDAC is one of the top courses by government of India in post graduate courses



2. The certification has a very good reputation and has a remarkable place in the market



3. You should go for CDAC rather than sitting idle and wasting your time. A little sincerity in CDAC will definitely serve your purpose.



4. Placement is up to you and on the batch. If you are from a good lot of students, you will get more opportunties. Your performance in CDAC will also play a crucial role. So dont overlook the course while thinking about placements all the time.


Your comments are welcomed. Post your queries if there is any. I will guide you to the best of what i can.

Mouse Simulator

C # NET Keyboard and Mouse Simulator in

Lets design a robot program which can simulate mouse and keyboard events on your desktop. Simulator which can automate the keyboard and mouse functions for you, can do almost all possible tasks on your desktop which ranges from setting up a task in the Task Scheduler to booking a movie ticket for you. You can smartly use and customize this piece of code to perform hectic tasks which you have to perform repeatedly like checking email.

We shall start with basics of how to simulate keyboard and mouse using c sharp, .NET. 

Creating Mouse Events

1. Importing user32.dll from Win32 API

[DllImport("user32")]
public static extern int SetCursorPos(int x, int y);
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
private const int MOUSEEVENTF_MOVE = 0x0001; /* mouse move */
private const int MOUSEEVENTF_LEFTDOWN = 0x0002; /* left button down */
private const int MOUSEEVENTF_LEFTUP = 0x0004; /* left button up */
private const int MOUSEEVENTF_RIGHTDOWN = 0x0008; /* right button down */

declare the function and other members of the user32.dll we are going to use. 

2. Setting the mouse position on the screen

SetCursorPos(x, y);

This function lets the virtual pointer to come at the specified co-ordinates (X,Y). You can also find the current pointer location using System.Windows.Forms.Control.MousePosition attribute.

3. Performing the mouse click event

mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);

The above two steps performs mouse down and mouse up function which eventually performs a single click of the mouse.

Creating KeyBoard Events


To perform a Keyboard event, we will use a pre-made dll avaliable to us which makes the code more compact and easy. Click Here to download the InputSimulator.dll...........

Example to write something automatically:

      InputSimulator.SimulateTextEntry("Hello World");

Example to simulate a Key Down:

     InputSimulator.SimulateKeyDown(VirtualKeyCode)

Simiarly you can explore many other methods exposed by InputSimulator.dll like:

* SimulateKeyUp
* SimulateKeyPress
* SimulateModifiedKeyStroke  // for Special Keys or a combination of keys

Adding Shortcuts to the Buttons on your GUI


See the below example in which we will over-ride the ProcessCmdKey method of System.Windows.Form. It will make your GUI more easy to operate

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
    if (keyData == (Keys.F1))
            {
                btnFindMouse.PerformClick();
                return true;
            }
            if (keyData == (Keys.F2))
            {
                btnSaveStep.PerformClick();
                return true;
            }
            if (keyData == (Keys.F3))
            {
                btnStartRobot.PerformClick();
                return true;
            }

            return base.ProcessCmdKey(ref msg, keyData);
        }

Wednesday 5 August 2015

An Atheist vs Dr Zakir Naik - Worth Watching Non muslims understand


ATM

If your ATM card blocked after entering wrong PASSWORD 3 times then here is the solution.

Last week a friend of mine tried to withdraw some cash using his HDFC Debit card at a Union Bank of India ATM. May be he was in some sort of hurry, he entered his PIN wrongly, thrice. As you’d expect, his Debit card was blocked. It was written on the ATM transaction slip: ‘ATM card blocked, please visit your branch’.

I told him that it’d only be blocked for a day and in case he remembers the PIN correctly he can use the same PIN without any problem from the next day. He wasn’t convinced and immediately went to his home branch, which was just a Kilometer or so away from where we were. Another friend of mine accompanied him to the branch while I was waiting there. They came back, with confirmation that the same PIN will work after 24 hours.
So why this story now?
Because in case you come across such situation, all you need to do is wait for a day and then try with the same PIN again tomorrow. My friend has a HDFC Debit card, and I can confirm this is also applicable to ATM/Debit cards of popular banks such as SBI (and all its associate banks), ICICI Bank, Axis Bank and PNB.
In case you really forgot the PIN, then you need to visit the branch or call the respective phone banking numbers to get your PIN reset. Different banks’ have different charges for resetting the PIN. For SBI or its associate banks’, its a nominal charge of Rs.100.
Note: Your card can also be blocked if you enter the PIN wrong (3 times) at a Point of Sale, for example at any merchant store. And it will also be blocked, if 3 wrong entries occur in a combination of ATM and Point of Sale tries, such as 2 at ATM and 1 at Point of Sale.

PIN RESET 
If you enter your PIN wrongly thrice or you have forgotten your PIN, you should immediately get a new PIN. Now, you don’t have to get a new ATM card to get a new PIN. You can simply get the PIN reset at the branch while using the existing card itself. A charge of Rs.51 will be charged to reset your PIN.
In future, the bank aims to make this process even more easy by bringing the feature of PIN reset online. Users will be able to reset their ATM PIN using their Internet Banking account. Certain prepaid travel cards from SBI already has this option to reset PIN online and this facility will soon be available for normal ATM Debit cards too.
In case where you know your PIN number and want to change it to something of your choice, you can do that by visiting any State Bank ATM itself. Insert your card and select services and then change the PIN number by entering your old PIN number first.