Tuesday, 25 October 2011

Tools To Validate Output\Get all dependencies objects From Store Procedure.

                                **********TALK 2 DB**************
I have developed an application/tool to get the output from a store procedure after connecting to the source and target storprocedure on a specific server.

Just you need to pass inputs parameter on UI and this will show all the output values generated by selected store procedure. Even you will get flexibility to get all the dependencies object names on particular selected store procedure name. These entire interfaces on UI itself.

Still i am working to come with full article or details.

Soon I will share an article with all of you.

To just give a glimpse of the application, i have added few snaps shot of tool.

"Talk2DB" that’s the name of this tool.
1. Main Window:

Main Window
  2. Connecting to DataBase
Connecting to DataBase
 3. Getting all the dependecies from Sp.
Getting all the dependecies from Sp.
4. Showing Out Put from Store procedure
Showing Out Put from Store procedure
Thank you,
Md. jawed

Tuesday, 4 October 2011

Get List of open windows in a machine including pop up windows

class Program
foreach (KeyValuePair<IntPtr, string>lWindow in OpenWindowGetter.GetOpenWindows())

IntPtr lHandle = lWindow.Key;
string lTitle = lWindow.Value;
Console.WriteLine("{0}: {1}", lHandle, lTitle);}}

using System;

using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace GetOpenWindows
using HWND = IntPtr;/// Contains a method to get all the open windows.
public static class OpenWindowGetter{/// Returns a dictionary that contains the handle and title of all the open windows./// A dictionary that contains the handle and title of all the open windows.
    EnumWindows(delegate(HWND hWnd, int lParam)
        if (hWnd == lShellWindow) return true;

        if (!IsWindowVisible(hWnd)) return true;
        int processId;
        processId= GetWindowThreadProcessId(hWnd,out processId);
        int lLength = GetWindowTextLength(hWnd);
        if (lLength == 0) return true;
        StringBuilder lBuilder = new StringBuilder(lLength);
        GetWindowText(hWnd, lBuilder, lLength + 1);
        lWindows[hWnd] = lBuilder.ToString();
         return true;
      }, 0);
   return lWindows;

delegate bool EnumWindowsProc(HWND hWnd, int lParam);

static extern bool EnumWindows(EnumWindowsProc enumFunc, int lParam);

static extern int GetWindowText(HWND hWnd, StringBuilder lpString, int nMaxCount);

static extern int GetWindowTextLength(HWND hWnd);

static extern int GetWindowThreadProcessId(HWND hWnd, out int processId);

static extern bool IsWindowVisible(HWND hWnd);

static extern IntPtr GetShellWindow();


Md. Jawed

Monday, 3 October 2011

Compare bitmaps images.

Here is the code to compare 2 bitmaps images.
public class ComparingImages
   public enum CompareResult

public static CompareResult Compare(Bitmap bmp1, Bitmap bmp2)
   CompareResult cr = CompareResult.Match;
   //Test to see if we have the same size of image
   if (bmp1.Size != bmp2.Size)
     cr = CompareResult.SizeMismatch;
    //Convert each image to a byte array
    ImageConverter ic = new ImageConverter();
   byte[] btImage1 = new byte[1];
   btImage1 = (byte[])ic.ConvertTo(bmp1, btImage1.GetType());
   byte[] btImage2 = new byte[1];
   btImage2 = (byte[])ic.ConvertTo(bmp2, btImage2.GetType());
   //Compute a hash for each image
   var shaM = new SHA256Managed();
   byte[] hash1 = shaM.ComputeHash(btImage1);
   byte[] hash2 = shaM.ComputeHash(btImage2);
   //Compare the hash values
   for (int i = 0; i < hash1.Length && i < hash2.Length
   && cr == CompareResult.Match; i++)
     if (hash1[i] != hash2[i])
     cr = CompareResult.Mismatch;
   return cr;