Archive for the 'Microsoft' Category

 

Vista: Disable Data Execution Prevention (DEP)

Jun 08, 2009 in Windows

From http://vistasupport.mvps.org/disable_data_execution_prevention.htm

1. Open command shell with ‘Run as administrator’

2. Run command:

bcdedit.exe /set {current} nx AlwaysOff

3. Response should be:

The operation completed successfully.

Pointers in C# (CSharp) .. example with bits..

Feb 12, 2009 in .Net, Microsoft

// 32 bit source Bitmap
System.Drawing.Bitmap b

int bWidth, bHeight;
int idx = 0;

bWidth = b.Width;
bHeight = b.Height;

byte[,] Disp = new byte[bWidth, bHeight];

// create a new 16 bit bitmap
Bitmap b565 = new Bitmap(b.Size.Width,b.Size.Height,System.Drawing.Imaging.PixelFormat.Format16bppRgb565);

Graphics g = Graphics.FromImage(b565);
// draw the 32 bit source bitmap to the 16 bit bitmap
g.DrawImage(b, new Point(0, 0));
g.Dispose();

BitmapData bmd = b565.LockBits(new Rectangle(0, 0, 480, 272), System.Drawing.Imaging.ImageLockMode.ReadOnly, b565.PixelFormat);

byte[] Result = new byte[bWidth * bHeight * 2];

unsafe
{
   // get a pointer to the beginning of image data in the 16 bit bitmap
   byte* bitdata = (byte*)bmd.Scan0;

   for (int y = 0; y < bmd.Height*bmd.Width*2; y++)
   {
       // just copy the image data from the Bitmap to the byte array
       Result[y] = bitdata[y];
   }
}

b565.UnlockBits(bmd);
USBD480_DrawFullScreen(ref di, Result);

Converting jpg to png in C# (CSharp) ..

Jan 12, 2009 in .Net, Uncategorized

using System.Drawing;
using System.Drawing.Imaging;

// apt-get install libgdiplus

class CGTest1 {

    public static void Main() {

        /* Image bmpImageToConvert =
           System.Drawing.Image.FromFile(
           Server.MapPath(strUploadImagePath));
         */

        Image bmpImageToConvert = Image.FromFile("images/sample3.jpg");
        Image bmpNewImage = new Bitmap(bmpImageToConvert.Width,
                                       bmpImageToConvert.Height);
        Graphics gfxNewImage = Graphics.FromImage(bmpNewImage);
        gfxNewImage.DrawImage(bmpImageToConvert,
                              new Rectangle(0, 0, bmpNewImage.Width,
                                            bmpNewImage.Height),
                              0, 0,
                              bmpImageToConvert.
                              Width,bmpImageToConvert.Height,
                              GraphicsUnit.Pixel);
        gfxNewImage.Dispose();
        bmpImageToConvert.Dispose();

        /*bmpNewImage.Save(Server.MapPath("userData/" &
          Request.QueryString("ID") & "/" & e.Item.Cells(2).Text &
          ".jpg"),ImageFormat.Jpeg)
         */

        bmpNewImage.Save("images/sample3t.png", ImageFormat.Png);
    }
}

Thanks to :

http://www.codeverge.net/ng.asp-net-forum.getting_started/converting-a-png-or-gif-to-a-jpeg

Program for scripting Windows Device Manager functions..

Oct 10, 2008 in Microsoft, Windows

To unmount a USB memory stick from a batch (or some other)
script in Windows, use the DevCon utility here:

http://support.microsoft.com/?kbid=311272

Activate Vista administrator account ..

Sep 26, 2008 in Windows

From http://www.computerperformance.co.uk/vista/vista_administrator_activate.htm

  1. Logon to Vista using your usual account.
  2. Launch the cmd prompt - Make sure you select, ‘Run as administrator’
  3. Net user administrator p@ssw0rD
  4. Net user administrator /active:yes
  5. Switch User, or logoff
  6. Logon as Administrator Password p@ssw0rD

Useful Excel tips website ..

Jun 25, 2008 in Microsoft, Office

Many useful bits of info.. like ‘Results without a formula’, ‘Generate random numbers’, ‘Add hidden text to formulas’ (add notes) and more..

http://www.rediff.com/getahead/2007/mar/05excel.htm

Microsoft Installer related problem..

Apr 30, 2007 in Microsoft, Windows

A friend of mine had a problem with a program trying to install continuously. Coupled with this, the .Net 1.1 framework seemed to have a few corrupted DLLs.

When I tried to uninstall .Net, I would get this error:

Another installation is already in progress

Info on the net pointed to the Microsoft Installer Cleanup Utility (msicuu) available here

http://support.microsoft.com/kb/290301

After unzipping the package, I used the MsiZapU.exe program from the command line with the “P” option. This removed all “pending” installations. The command looked like this:

C:\Software\msicuu2>MsiZapU.exe P
MsiZapInfo: Performing operations for user
S-1-5-21-2567120938-317048180-2202218
495-1009
Searching for the Windows Installer InProgress key. . .
Removed
SoftwareMicrosoftWindowsCurrentVersionInstallerInProgress

A very helpful blog pointed me to another utility used to clean up .Net installations. The blog is here

http://blogs.msdn.com/astebner/articles/492809.aspx

The utility is in a zip named dotnetfx_cleanup_tool.zip and it can be found here

http://astebner.sts.winisp.net/Tools/Forms/DispForm.aspx?ID=111

(or search for it.. it seems to appear in a few places..)