Arduino Binary Clock

This is a simple Arduino Binary Clock. It comes with a program that generates the script and uploads it to the arduino board. Part of the code isn’t mine only the part that allows you to get the time from the computer and configure the script to use it.

Built and running displaying 02:05pm

You can download the script maker program from here. You can get this same circuit diagram by opening the program with the /C parameter. There are a lot of command-line options to choose from to configure your Binary Clock. R1 through R13 must have a value that will limit the current enough that it will not break the Arduino or any of its pins. Its probably best to use a 1kilo ohm resistor.

program binclock_uno;

{$APPTYPE CONSOLE}
{$RESOURCE binclock_uno32.RES}
{This program will need binclock.ino added to the resource as ID 1 
and type "ARDUINO" You can use Resource Hacker to build binclock_uno32.RES file.
 The schematic is id 1 and type is "JPEG"}

uses
  SysUtils,
  graphics,
  jpeg,
  windows,shellapi,
  Classes;
const INSERT_POINT='//INSERT_POINT';
//To make the program use less memory and file size, we will use format type string constants
STRING_VAR='String %s = "%s";';
ARDUINO_PINVALUES:ARRAY[0..1]OF STRING=('LOW','HIGH');
DEFINE_INTEGER='#define %s %d';
DEFINE_STRING='#define %s %s';
BYTE_VAR='byte %s=%u;';
INO_PATH='%s\%s.ino';
var args,inofile:tstringlist;
res:tresourcestream;
i:integer;
st:systemtime;
exename:string;
herr:hinst;
rs1:longint;
arduino_exename,inocommand,inoname:array[0..max_path]of char;
tid:dword;
function GetConsoleWindow:hwnd;stdcall;external kernel32;
function ConsolePicture(id:integer):dword;stdcall;
//This thread draws the schematic onto the console window
var jpg:tjpegimage;
ConsoleCanvas:tcanvas;
res:tresourcestream;
r:Trect;
label loop;
begin
jpg:=tjpegimage.Create;
res:=tresourcestream.CreateFromID(hinstance,id,'JPEG');
jpg.LoadFromStream(res);res.Free;
consolecanvas:=TCanvas.Create;
consolecanvas.Handle:=getdc(getconsolewindow);
loop:
getclientrect(getconsolewindow,r);
r.Left:=0;r.Top:=0;
consolecanvas.StretchDraw(r,jpg);
sleep(5000);
goto loop;
end;

begin
args:=tstringlist.Create;
for i:=1 to paramcount do
args.Add(Paramstr(i));
exename:=extractfilename(paramstr(0));
if paramcount=0then begin
writeln('Usage:',exename,' /BIAS=OFFSET /MIDNIGHT /C /F=FILENAME /UP /UTC /24 /12 /LED=number /HBTN=ANALOG_PIN /MBTN=ANALOG_PIN /NBTN');
writeln('/UTC       Use UTC Time instead of localtime.');
writeln('/BIAS      Uses a custom timezone bias');
writeln('/12        Use 12-hour format');
writeln('/24        Use 24-hour format');
writeln('/LED       Sets the LED on position logic, 0 for cathode 1 for anode');
writeln('/MBTN      Analog pin for Minute button');
writeln('/HBTN      Analog pin for Hour button');
Writeln('/NBTN      Disable the use of buttons');
writeln('/UP        Automatically upload file to Arduino');
writeln('/F         The output script name(without .ino extension),if omitted it will be stored as binclock\binclock.ino');
writeln('/C         Brings up the circuit diagram for the clock');
writeln('/MIDNIGHT  Use midnight as the starting time instead of computer clock');
writeln;
writeln('Example: Use a LOW value on all digital LED pins and UTC Time and 24-hour format');
writeln(exename,' /UTC /24 /LED=0 /F=MyBinClock /UP');
write('Press enter to quit...');
readln;
args.Free;
exitprocess(0);
end;
if args.IndexOf('/C')>-1Then
begin
createthread(nil,0,@consolepicture,pointer(1),0,tid);
readln;
exitprocess(0);
end;
getsystemtime(st);
if args.IndexOfName('/BIAS')=-1then args.Values['/BIAS']:='00:00';
datetimetosystemtime(systemtimetodatetime(st)-strtotime(args.Values['/BIAS']),
st);
gettimezoneinformation(tz);
if args.indexofname('/F')=-1 then args.Values['/F']:='binclock';
createdirectory(strpcopy(inoname,args.values['/F']),nil);
res:=tresourcestream.CreateFromID(hinstance,1,'ARDUINO');
inofile:=tstringlist.Create;
inofile.LoadFromStream(res);
res.Free;
if(strtointdef(args.values['/LED'],1)<0)or(strtointdef(args.values['/LED'],1)>1)
then begin writeln('Invalid /LED value');args.free;inofile.free;
exitprocess(error_invalid_parameter);end;
inofile.Insert(inofile.indexof(insert_point),format(define_string,['LED_ON',
ARDUINO_PINVALUES[strtointdef(args.values['/LED'],1)]]));
inofile.Insert(inofile.indexof(insert_point),FORMAT(DEFINE_STRING,['LED_OFF',
ARDUINO_PINVALUES[Strtointdef(args.values['/LED'],1)xor 1]]));
if args.IndexOf('/UTC')=-1Then getlocaltime(st);
if(args.IndexOf('/12')>-1)and(args.IndexOf('/24')>-1)then begin
writeln('Cannot use both /24 and /12 parameters at the same time');
args.Free;inofile.Free;
exitprocess(error_invalid_parameter);
end;
if args.IndexOf('/MIDNIGHT')>-1then begin if args.IndexOf('/12')>-1then
st.wHour:=12 else st.wHour:=0;st.wMinute:=0;st.wSecond:=0;end;
if(args.indexof('/24')=-1)and(args.IndexOf('/12')=-1)then begin
writeln('Must have a hour format parameter');inofile.Free;args.Free;
exitprocess(error_invalid_parameter);
end;
if args.indexof('/12')>-1then begin
inofile.Insert(inofile.indexof(insert_point),FORMAT(DEFINE_INTEGER,['HOUR_FORMAT',
12]));
if st.wHour=0then st.wHour:=12;
if st.wHour>12then
 st.wHour:=st.wHour-12;
end else
inofile.Insert(inofile.indexof(insert_point),FORMAT(DEFINE_INTEGER,['HOUR_FORMAT',
24]));
inofile.Insert(inofile.indexof(insert_point),FORMAT(DEFINE_INTEGER,['ANALOG_HSET',
STRTOINTDEF(ARGS.VALUES['/HBTN'],5)]));
inofile.Insert(inofile.indexof(insert_point),FORMAT(DEFINE_INTEGER,['ANALOG_MSET',
STRTOINTDEF(ARGS.VALUES['/MBTN'],0)]));
if args.IndexOf('/NBTN')=-1then inofile.Insert(inofile.indexof(insert_point),
FORMAT(DEFINE_STRING,['BUTTONS_ENABLED','true']))else inofile.Insert(
inofile.indexof(insert_point),FORMAT(DEFINE_STRING,['BUTTONS_ENABLED','false']));
inofile.Insert(inofile.indexof(insert_point),FORMAT(BYTE_VAR,['hour',ST.WHOUR]));
inofile.Insert(inofile.indexof(insert_point),FORMAT(BYTE_VAR,['minute',st.wminute]));
inofile.Insert(inofile.indexof(insert_point),FORMAT(BYTE_VAR,['second',st.wSecond]));
inofile.SaveToFile(format(ino_path,[inoname,inoname]));
writeln('Script saved to ',format(ino_path,[inoname,inoname]));
if args.IndexOf('/UP')>-1then begin rs1:=sizeof(arduino_exename);regqueryvalue(
hkey_classes_root,'Arduino File\shell\open\command',arduino_exename,rs1);herr:=
shellexecute(0,nil,strpcopy(arduino_exename,stringreplace(arduino_exename,' "%1"',
'',[])),strfmt(inocommand,'--upload "%s\%s.ino"',[inoname,inoname]),nil,sw_showdefault);
if herr<33then begin
if herr=0then writeln('Out of resources')else writeln(syserrormessage(herr));
args.Free;inofile.Free;
exitprocess(herr);
end;end;
args.Free;
inofile.Free;
exitprocess(0);
end.
/* Filename binclock.ino
An open-source binary clock for Arduino. 
Based on the code from by Rob Faludi (http://www.faludi.com)
Code under (cc) by Daniel Spillere Andrade, www.danielandrade.net
http://creativecommons.org/license/cc-gpl

I modified the code a little bit so it can have
12-hour format and pin configuration.

By Justin Roeder

/* IMPORTANT NOTICE BEFORE ADDING THIS SCRIPT TO THE RESOURCE OF THE GENERATOR EXECUTABLE
YOU MUST REMOVE ALL OF THE LINES UNTIL YOU GET TO //INSERT_POINT
LEAVE //INSERT_POINT IN SCRIPT. THAT TELLS THE GENERATOR WHERE TO PUT THE VARIABLES.
IF YOU ARE JUST GOING TO UPLOAD THHIS SCRIPT TO THE BOARD, YOU CAN LEAVE THE CODE ALONE. 
*/
#define LED_ON HIGH //LED Bit on logic
#define LED_OFF LOW //LED Bit off logic
#define HOUR_FORMAT 24 //Change to 12 for 12 hour time
#define ANALOG_HSET 5 //defines hour set button pin
#define ANALOG_MSET 0 //defines minure set buttonpin
#define BUTTONS_ENABLED true //set to false to disable buttons
byte hour=0;
byte minute=0;
byte second=0;
//Start at midnight 00:00:00
//INSERT_POINT

int munit,hunit,valm=0,valh=0,ledstats,i;
void setup() {
//set outputs 
for(int k=1;k<=13;k++) {
  pinMode(k, OUTPUT);
}
//set inputs
pinMode(0, INPUT);
}
void loop() {

static unsigned long lastTick = 0; // set up a local variable to hold the last time we moved forward one second
// (static variables are initialized once and keep their values between function calls)
// move forward one second every 1000 milliseconds

if (millis() - lastTick >= 1000) {
  lastTick = millis();
  second++;
}
// move forward one minute every 60 seconds
  if (second >= 60) {
  minute++;
  second = 0; // reset seconds to zero
}
// move forward one hour every 60 minutes
if (minute >=60) {
  hour++;
  minute = 0; // reset minutes to zero
}

if (hour >=24) {
  hour  = 0;
  minute  = 0; // reset minutes to zero
}
if(HOUR_FORMAT==12){
  if(hour>12){hour=hour-12;}
  if(hour==0){hour=12;}
}
  munit = minute%10; //sets the variable munit and hunit for the unit digits
  hunit = hour%10;
  ledstats = digitalRead(0);  // read input value, for setting leds off, but keeping count
  if (ledstats == LOW) {
   for(i=1;i<=13;i++){
    
    digitalWrite(i, LED_OFF);}

  } else  {

  //minutes units
  if(munit == 1 || munit == 3 || munit == 5 || munit == 7 || munit == 9) {  digitalWrite(1, LED_ON);} else {  digitalWrite(1,LED_OFF);}
  if(munit == 2 || munit == 3 || munit == 6 || munit == 7) {digitalWrite(2, LED_ON);} else {digitalWrite(2,LED_OFF);}
  if(munit == 4 || munit == 5 || munit == 6 || munit == 7) {digitalWrite(3, LED_ON);} else {digitalWrite(3,LED_OFF);}
  if(munit == 8 || munit == 9) {digitalWrite(4, LED_ON);} else {digitalWrite(4,LED_OFF);}

  //minutes 
  if((minute >= 10 && minute < 20) || (minute >= 30 && minute < 40) || (minute >= 50 && minute < 60))  {digitalWrite(5, LED_ON);} else {digitalWrite(5,LED_OFF);}
  if(minute >= 20 && minute < 40)  {digitalWrite(6, LED_ON);} else {digitalWrite(6,LED_OFF);}
  if(minute >= 40 && minute < 60) {digitalWrite(7, LED_ON);} else {digitalWrite(7,LED_OFF);}

  //hour units
  if(hunit == 1 || hunit == 3 || hunit == 5 || hunit == 7 || hunit == 9) {digitalWrite(8, LED_ON);} else {digitalWrite(8,LED_OFF);}
  if(hunit == 2 || hunit == 3 || hunit == 6 || hunit == 7) {digitalWrite(9, LED_ON);} else {digitalWrite(9,LED_OFF);}
  if(hunit == 4 || hunit == 5 || hunit == 6 || hunit == 7) {digitalWrite(10, LED_ON);} else {digitalWrite(10,LED_OFF);}
  if(hunit == 8 || hunit == 9) {digitalWrite(11, LED_ON);} else {digitalWrite(11,LED_OFF);}

  //hour
  if(hour >= 10 && hour < 20)  {digitalWrite(12, LED_ON);} else {digitalWrite(12,LED_OFF);}
  if(hour >= 20 && hour < 24)  {digitalWrite(13, LED_ON);} else {digitalWrite(13,LED_OFF);}

}
if(BUTTONS_ENABLED){ 
 valm = analogRead(ANALOG_MSET);    // add one minute when pressed
   if(valm<800) {
   minute++;
   second = 0;
   delay(250);
  }
  valh = analogRead(ANALOG_HSET);    // add one hour when pressed
   if(valh<800) {
   hour++;
   second = 0;
   delay(250);
  }}
}

How to read the display?

Each column represents a digit. As seen in the circuit diagram. A led has a row number the top LED like D4 in x1Minute is 8 below it is 4, 2, and 1. To get the digit for the column just add the row numbers. Below this paragraph is my binary clock screensaver showing 05:56:10 is read on the screen.

Binary Clock 05:56:10

I am going to leave the buttons out of the one I’m building. If you are doing this then use the /NBTN parameter. I will keep you updated

All programs are virus free. Some antivirus software might say its "suspicious" or a "Potentionaly Unwanted Program". Some of them rate them on what there code looks like no matter if theres a definition in the virus database. If any of them are detected any Antivirus I will zip the software with the password "justin" j is lowercase

Why recaptcha is annoying

Have you ever want to register something but get this annoying verification check:

google recaptcha on logging in to download Delphi Starter edition

What can I do to prove I’m human an not a robot that doesn’t take hours of clicking?

  1. Do not use VPNs or proxies( such as Tor) reCaptcha looks for that because bots want to be sneaky and they use thoses VPN services to get a way with it. You will be amazed when your not using a those and click on I’m not a robot and it turns into a green checkmark
  2. Type in words that you hear in the audio challenge by clicking the headphone icon. This here is still not easy and can be time consuming

Although some sites have that as a automatic requirement it should be secure enough to click the checkbox

If you are like me and just hate that verification step just leave a comment

Klondike Solitaire

Klondike solitaire is the original solitaire game.

Rules:

  1. Only kings can be moved to empty piles
  2. Cards from the seven piles below must be in a sequence and must be in a color changing pattern(red, black, red, black or black, red, black, red) and the sequence must be going downwards(king, queen, jack, 10, 9,…). And it can start from any card besides the kings.
  3. The four piles on the top-right of the screen are the foundations, you must get all of the cards there to win!
  4. Cards in the foundations have to be in a sequence starting with the aces then going up to the kings. They also must be in the same suit. And the sequence must start with the ace.

DIY Powersupply

This power supply is easy to build and fun to make. It will have 2 meters 1 for voltage and 1 for current. They will both be DC voltmeters, for the amp meter we will use a shunt resistor.

Here’s the part list:

Qty

Name

All Electronics Cat#

Sub-total

total

1

LM317T Adjustable regulator

LM317T

$0.70

$0.70

1(Min qty is 10)

270Ω ¼W resistor

291-270

$0.065

$0.65

1

5k pot

NLTP-5K

$0.75

$0.75

1

Voltage knob

KNB-125

$0.50

$0.50

2

Spring terminals

SWT-202

$0.50

$1

1

24VDC WALL WART

PS-2414

$8.45

$8.45

1

Bridge Rectifier

FWB-14

$0.40

$0.40

1

3300µF Capacitor

3300R50

$1.60

$1.60

1

1Ω 50W Resistor

1-50

$2.75

$2.75

1

20V Voltmeter

PM-120

$15

$15

1

200mV Voltmeter(current)

PM-122

$15

$15

2

+5VDC Regulator

7805T

$0.50

$1

1

Fuse holder

FHPM-31

$1.25

$1.25

1

1A Fuse

FS-1

$0.75

$0.75

 

Sub-total

 

 

$49.80

 

Shipping

 

 

$8

 

Total

 

 

$57.80

 

YouTube video

Schematic

Front of the power supply
Powered on
Back of the power supply with input terminal and Lm7805k regulator for meters

PN Junction tester

This transistor tester tests bipolar junction transistors junctions. It tests the junctions for open and short circuits. It uses 4 resistors, 4 LEDs and 1 SPDT switch. A good transistor will only have 2 out of 4 LEDs lit, on one side of the switch and 4 on the other. You can also test standard diodes (rectifiers and switching diodes). A diode will have 3 out of 4 LEDs lit on one side and 4 on the other.

Here’s a table of all possible readings and their meanings

2 LED lit

Both emitter/collectors are short circuited

3 LEDs lit

Only one emitter/collector

4 LEDs lit

Open circuit

1 LED lit

Circuit design error

Android Scope Probe

This useful cord can allow an Android Phone/Tablet to be used as an osciloscope. All you need is the 4-pole 3.5mm jack to 3 rca cable. The cord will need to be modified and be tested with an resistance meter, so you can figure out which wire goes where. NOTE: EVERY CORD IS DIFFERNET! Also some phones or tablets can be stuborn and only use the cord if theres a load on the left and right speaker pins. Use a 7.5 ohm resistor, wattage shouldn’t matter because headphone standard is 1 miliwatt. The schematic is below:

The only thing bad about this circuit is sometimes series resistances with the signal you’re measuring increase the division.

Links:
4-pole 3.5mm to rca(thus link has changed because All Electronics went out of stock on the other one)
Software
Youtube video(old)

YouTube video(new)

Window Hacker

This program is a great tool to have. It allows you to take control of

window controls and their handles. This is like Spy++ but free. Theres

a dll that allows you to control a window from a batch file just use

rundll32 with it like

 

rundll32 libwndhack.dll,CloseHWND search_query

rundll32 libwndhack.dll,ShowHWND search_query

rundll32 libwndhack.dll,ClickButton search_query

rundll32 libwndhack.dll,EnableHWND search_query

rundll32 libwndhack.dll,DisableHWND search_query

 

The search_query is the string that will be searched for.

 

Here’s a screenshot of the program:

wndhacker.jpg

 

            More tools and apps avaliable at

                  www.delphijustin.biz

 

unit wndhackUnit1;
{$RESOURCE wndhack32.res}
interface
//Main window unit
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Menus, StdCtrls, ExtCtrls,shellapi, ComCtrls, ScktComp, Spin;

type
  TWNDHacker = class(TForm)
    Panel1: TPanel;
    Label1: TLabel;
    HWNDEdit: TEdit;
    Label2: TLabel;
    Button1: TButton;
    Label3: TLabel;
    cname: TEdit;
    WNDEn: TCheckBox;
    WNDV: TCheckBox;
    Label4: TLabel;
    WNDTxt: TMemo;
    MainMenu1: TMainMenu;
    UpdateList1: TMenuItem;
    HWNDIcon: TPaintBox;
    GroupBox1: TGroupBox;
    ComboBox1: TComboBox;
    Label5: TLabel;
    Label6: TLabel;
    Edit1: TEdit;
    Label7: TLabel;
    Edit2: TEdit;
    Button2: TButton;
    CheckBox1: TCheckBox;
    Button3: TButton;
    Label8: TLabel;
    Memo1: TMemo;
    Label9: TLabel;
    Edit3: TEdit;
    Label10: TLabel;
    Edit4: TEdit;
    ListBox1: TListBox;
    Label11: TLabel;
    Edit5: TEdit;
    Label12: TLabel;
    Edit6: TEdit;
    GroupBox2: TGroupBox;
    Label13: TLabel;
    ComboBox2: TComboBox;
    CheckBox2: TCheckBox;
    Button4: TButton;
    Help1: TMenuItem;
    AboutWindowHacker1: TMenuItem;
    HWNDP: TComboBox;
    ComboBox3: TComboBox;
    Label14: TLabel;
    Tools1: TMenuItem;
    FindWindow1: TMenuItem;
    FindDialog1: TFindDialog;
    OpenDialog1: TOpenDialog;
    MouseFollower1: TMenuItem;
    Timer1: TTimer;
    StatusBar1: TStatusBar;
    ViewAtomTable1: TMenuItem;
    PopupMenu1: TPopupMenu;
    SaveIcon1: TMenuItem;
    LoadIcon1: TMenuItem;
    Cancel1: TMenuItem;
    SaveDialog1: TSaveDialog;
    RestoreWindow1: TMenuItem;
    ShowWindow1: TMenuItem;
    GetWindowLong1: TMenuItem;
    Label15: TLabel;
    SpinEdit1: TSpinEdit;
    Label16: TLabel;
    SpinEdit2: TSpinEdit;
    Label17: TLabel;
    SpinEdit3: TSpinEdit;
    SpinEdit4: TSpinEdit;
    Label18: TLabel;
    Button5: TButton;
    CheckBox3: TCheckBox;
    FindWindowEx1: TMenuItem;
    procedure UpdateList1Click(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
    procedure HWNDIconPaint(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure WNDVClick(Sender: TObject);
    procedure WNDEnClick(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Label12Click(Sender: TObject);
    procedure ComboBox2Change(Sender: TObject);
    procedure Label2Click(Sender: TObject);
    procedure AboutWindowHacker1Click(Sender: TObject);
    procedure FindDialog1Find(Sender: TObject);
    procedure FindWindow1Click(Sender: TObject);
    procedure MouseFollower1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure ViewAtomTable1Click(Sender: TObject);
    procedure SaveIcon1Click(Sender: TObject);
    procedure HWNDIconClick(Sender: TObject);
    procedure RestoreWindow1Click(Sender: TObject);
    procedure LoadIcon1Click(Sender: TObject);
    procedure ShowWindow1Click(Sender: TObject);
    procedure GetWindowLong1Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure FindWindowEx1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
{  THWNDPPacket=record  Reserved for Remote controllu

  op:integer;
  Handle:hwnd;
  classname,windowname:array[0..255]of ansichar;
  msg,startms,cms:dword;
  wparam,lparam:lparam;
  Return:LRESULT;
  end;           }
  function GetConsoleWindow:hwnd;stdcall;external 'kernel32.dll';
var
  WNDHacker: TWNDHacker;
  hico:hicon;
  nochange:boolean;
  searchres,msgs,winstyles,shows,gwl:tstringlist;
  childenum:tlist;
implementation

{$R *.DFM}

uses wndhackunit2;

function EnumHWND(hw:hwnd;lp:lparam):bool;stdcall;
var cname,wtxt:array[0..1024] of char;
pid:dword;
begin
getwindowtext(hw,wtxt,1025);
getclassname(hw,cname,1025);
result:=true;
 GEtWindowThreadProcessId(hw,@pid);
 if pid=getcurrentprocessid then exit;
wndhacker.ListBox1.Items.AddObject(StrPas(CName)+','+strpas(wtxt),TObject(hw));
wndhacker.HWNDP.Items.Add('$'+inttohex(hw,0));
if lp=0 then
enumchildwindows(hw,@enumhwnd,1);
end;

procedure TWNDHacker.UpdateList1Click(Sender: TObject);
begin
listbox1.Items.Clear;
childenum.Clear;
hwndp.Items.Clear;
listbox1.Items.AddObject('HWND_DESKTOP',TObject(getdesktopwindow));
enumwindows(@enumhwnd,0);
end;

procedure AddConsts(combo:tcombobox; slConsts:tstringlist);
var i:integer;
begin
for i:=0 to slConsts.Count-1 do
if StrToInt64Def(slconsts.values[slconsts.names[i]],-1)>-1 then
combo.Items.Add(slConsts.names[i]);
end;

procedure TWNDHacker.ListBox1Click(Sender: TObject);
var classname:array[0..255] of char;
windowtxt:pchar;
wtlen:integer;
r:trect;
dwprocess:dword;
begin
nochange:=true;
HWNDEdit.Text:='$'+IntToHex(HWnd(listbox1.items.objects[listbox1.ItemIndex]),0);
hwndp.Text:='$'+inttohex(getparent(hwnd(listbox1.items.objects[listbox1.ItemIndex])),0);
hico:=GetClassLong(hwnd(ListBox1.items.objects[listbox1.itemindex]),GCL_HICON);
if hico=0 then
hico:=GetClassLong(getparent(hwnd(listbox1.items.objects[listbox1.itemindex])),
gcl_hicon);
if hico=0then hico:=loadicon(0,IDI_APPLICATION);
drawicon(hwndicon.canvas.handle,0,0,hico);
edit5.Text:='$'+inttohex(globalfindatom(classname),4);
edit3.Text:=inttostr(GetWindowThreadProcessID(strtoint(hwndedit.text),
@dwprocess));
edit4.Text:=inttostr(dwprocess);
edit6.Text:=IntTohex(getwindowlong(strtoint(hwndedit.text),gwl_style),8)+'-'+
inttohex(getwindowlong(strtoint(hwndedit.text),gwl_exstyle),8);
getclassname(hwnd(listbox1.items.objects[listbox1.itemindex]),classname,256);
cname.Text:=strpas(classname);
Wtlen:=GetWindowTextLength(hwnd(listbox1.items.objects[listbox1.itemindex]))+1;
windowtxt:=stralloc(wtlen);
GetWindowText(hwnd(listbox1.items.objects[listbox1.itemindex]),windowtxt,wtlen);
wnden.Checked:= iswindowenabled(hwnd(listbox1.items.objects[listbox1.ItemIndex]));
wndv.Checked:= iswindowvisible(hwnd(listbox1.items.objects[listbox1.itemindex]));
wndtxt.Text:=strpas(windowtxt);
strdispose(windowtxt);
getwindowrect(strtoint(hwndedit.text),r);
spinedit1.Value:=r.Bottom;
spinedit2.Value:=r.Right;
spinedit3.Value:=r.Top;
spinedit4.Value:=r.Left;
nochange:=false;
end;

procedure TWNDHacker.HWNDIconPaint(Sender: TObject);
begin
drawicon(HWNDIcon.Canvas.handle,0,0,hico);
end;

procedure TWNDHacker.FormCreate(Sender: TObject);
var i:integer;
msgr:tresourcestream;
stylesr,showr,gwlr:tresourcestream;
begin
searchres:=tstringlist.Create;
shows:=tstringlist.Create;
showr:=tresourcestream.Create(hinstance,'SHOW','TXT');
shows.LoadFromStream(showr);
showr.Free;
gwlr:=tresourcestream.Create(hinstance,'GWL','TXT');
gwl:=tstringlist.Create;
gwl.LoadFromStream(gwlr);
gwlr.Free;
childenum:=tlist.Create;
combobox3.ItemIndex:=0;
hico:=loadicon(0,IDI_APPLICATION);
msgr:=tresourcestream.Create(hinstance,'MESSAGES','TXT');
msgs:=tstringlist.Create;
msgs.LoadFromStream(msgr);
msgr.Free;
stylesr:=tresourcestream.Create(hinstance,'WINSTYLES','TXT');
winstyles:=tstringlist.Create;
winstyles.LoadFromStream(stylesr);
stylesr.Free;
addconsts(combobox2,winstyles);
for i:= 0 to msgs.Count-1 do
if(msgs.Names[i]<>'') and(strscan(pchar(msgs[i]),'{')=nil) then
combobox1.Items.Add(msgs.Names[i]);
application.Title:=caption;
UpdateList1.Click;
end;

procedure TWNDHacker.Button1Click(Sender: TObject);
begin
windows.SetParent(strtoint(hwndedit.text),strtoint(hwndp.text));
end;

procedure MyWndMsgProc(hw:hwnd;msg:uint;Startms:DWORD;lres:lresult);stdcall;
begin
wndhacker.Memo1.Lines.Add(IntToHex(hw,0)+' replied within '+inttostr(
gettickcount-startms)+'ms, returned '+inttohex(lres,0));
end;

procedure TWNDHacker.Button2Click(Sender: TObject);
var b:boolean;
hw:hwnd;
res:lresult;
begin
b:=true;
res:=0;
memo1.Clear;
if not checkbox1.Checked then
hw:=strtoint(hwndedit.text)else hw:=hwnd_broadcast;
case combobox3.ItemIndex of
0:b:=sendmessagecallback(hw,strtointdef(msgs.values[combobox1.text],
registerwindowmessage(pchar(combobox1.text))),strtoint(edit1.text),
strtoint(edit2.text),@mywndmsgproc,gettickcount);
1:b:=PostMessage(hw,strtointdef(msgs.values[combobox1.text],
registerwindowmessage(pchar(combobox1.text))),strtoint(edit1.text),
strtoint(edit2.text));
2:res:=defwindowproc(hw,strtointdef(msgs.values[combobox1.text],
registerwindowmessage(pchar(combobox1.text))),strtoint(edit1.text),strtoint(
edit2.text));
3:res:=sendmessage(hw,strtointdef(msgs.values[combobox1.text],
registerwindowmessage(pchar(combobox1.text))),strtoint(edit1.text),strtoint(
edit2.text));
end;
if not b then
messagebox(handle,pchar(syserrormessage(getlasterror)),'Window Hacker',mb_iconerror);
if res<>0 then memo1.Text :='Returned with '+inttohex(res,0);
end;

procedure TWNDHacker.WNDVClick(Sender: TObject);
begin
if nochange then exit;
if wndv.Checked then
showwindow(strtoint(hwndedit.text),sw_show)else
showwindow(strtoint(hwndedit.Text),sw_hide);

end;

procedure TWNDHacker.WNDEnClick(Sender: TObject);
begin
if nochange then exit;
enablewindow(strtoint(hwndedit.text),wnden.checked);

end;

procedure TWNDHacker.Button3Click(Sender: TObject);
begin
setwindowtext(strtoint(hwndedit.text),pchar(wndtxt.text));
end;

procedure TWNDHacker.Button4Click(Sender: TObject);
var hw:hwnd;
x:integer;
begin
hw:=strtoint(hwndedit.text);
if winstyles.Values[combobox2.Text]<>''then
x:=Strtoint(winstyles.values[combobox2.text])else
x:=strtoint(combobox2.text);
if pos('_EX_',Uppercase(combobox2.text))>0 then
begin
if checkbox2.Checked then
setwindowlong(hw,gwl_exstyle,getwindowlong(hw,gwl_exstyle) or x)else
setwindowlong(hw,gwl_exstyle,getwindowlong(hw,gwl_exstyle) and(not x));
end else begin
if checkbox2.Checked then
setwindowlong(hw,gwl_exstyle,getwindowlong(hw,gwl_exstyle) or x)else
setwindowlong(hw,gwl_exstyle,getwindowlong(hw,gwl_exstyle) and(not x));
end;
end;

procedure TWNDHacker.Label12Click(Sender: TObject);
var s:string;
I,x:integer;
y:longint;
begin
s:='The window has the following styles set:'+#13#10;
for i:=0to combobox2.Items.Count-1 do
begin
if pos('_EX_',combobox2.Items[i])>0 then
x:= gwl_exstyle else x:=gwl_style;
y:= strtoint(winstyles.values[ combobox2.items[i]]);
if y and GetWindowLong(StrToInt(hwndedit.text),x)=y then
s:=s+combobox2.Items[i]+#13#10;
end;
Messagebox(handle,pchar(s),'Window Hacker',0);
end;

procedure TWNDHacker.ComboBox2Change(Sender: TObject);
var x:integer;
begin
if strtoint64def(Combobox2.text,-1)>-1 then
x:=strtoint(combobox2.text) else
if combobox2.Items.IndexOf(combobox2.text)>-1 then
x:=strtoint(winstyles.values[combobox2.Text]);
if pos('_EX_',Uppercase(combobox2.text))=0 then
checkbox2.Checked:=(GetWindowLong(strtoint(hwndedit.Text),gwl_style) and x=x)else
checkbox2.Checked:=(GetWindowLong(strtoint(hwndedit.Text),gwl_exstyle) and x=x);
end;

procedure TWNDHacker.Label2Click(Sender: TObject);
var classn:array[0..1024]of char;
wtxt:pchar;
wtxtlen:integer;
begin
wtxtlen:=1+getwindowtextlength(strtoint(hwndp.Text));
wtxt:=stralloc(wtxtlen);
getwindowtext(strtoint(hwndp.text),wtxt,wtxtlen);
getclassname(strtoint(hwndp.text),classn,1025);
messagebox(handle,PChar('Window Text: '+strpas(wtxt)+#13#10+
                        'Class Name: '+strpas(classn)),
'Window Hacker',0);
strdispose(wtxt);
end;

procedure TWNDHacker.AboutWindowHacker1Click(Sender: TObject);
var hexe:thandle;
compiletime:tfiletime;
t:tdatetime;
st:tsystemtime;
begin
hexe:=createfile(PChar(application.exename),generic_read,file_share_read or
file_share_write,nil,open_existing,file_attribute_normal,0);
getfiletime(hexe,nil,nil,@compiletime);
closehandle(hexe);
filetimetosystemtime(compiletime,st);
t:=encodedate(st.wyear,st.wmonth,st.wday)+encodetime(st.whour,st.wminute,st.wsecond,0);
messagebox(handle,pchar('Window Hacker v1.0 By Justin Roeder'+#13#10+
                        'Compiled on: '+DateTimeToStr(t))
,'About Window Hacker',0);
end;

procedure TWNDHacker.FindDialog1Find(Sender: TObject);
var i:integer;
q:string;
begin
allocconsole;
findwindow1.enabled:=false;
bringwindowtotop(getconsolewindow);
finddialog1.CloseDialog;
for i:=0 to listbox1.Items.Count-1 do
if (pos(uppercase(finddialog1.findtext),uppercase(listbox1.items[i]))>0)or
('$'+inttohex(hwnd(listbox1.items.objects[i]),0)=uppercase(finddialog1.findtext))
or ('$'+inttohex(getparent(hwnd(listbox1.items.objects[i])),0)=uppercase(
finddialog1.findtext))then
searchres.Add(listbox1.items[i]);
if searchres.Count=0 then begin
writeln('Nothing found, press enter to continue...');
readln(q);
findwindow1.Enabled:=true;
freeconsole;
exit;
end;
for i:=0 to searchres.Count-1 do
writeln(i,'.',searchres[i]);
write('Enter your choice or hit enter to cancel: ');
readln(q);
if q<>'' then begin
listbox1.ItemIndex:=listbox1.Items.IndexOf(searchres[strtointdef(q,0)]);
wndhacker.ListBox1Click(nil);
end;
findwindow1.Enabled:=true;
freeconsole;
end;

procedure TWNDHacker.FindWindow1Click(Sender: TObject);
begin
finddialog1.Execute;
end;

procedure TWNDHacker.MouseFollower1Click(Sender: TObject);
begin
timer1.Enabled:=not timer1.Enabled;
end;

procedure TWNDHacker.Timer1Timer(Sender: TObject);
var hw:hwnd;
mouse:tpoint;
desktopdc:hdc;
s:String;
cn,wtxt:array[0..255]of char;
begin
getcursorpos(mouse);
hw:= windowfrompoint(mouse);
if listbox1.Items.IndexOfObject(TObject(hw))>-1 then begin
listbox1.ItemIndex:=listbox1.Items.IndexOfObject(tobject(hw));
listbox1click(nil);
end;
desktopdc:=getwindowdc(getdesktopwindow);
getclassname(hw,cn,256);
GetWindowText(hw,wtxt,256);
s:=Format('Classname:%s WindowText:%s Handle:%x Parent:%x',[cn,wtxt,hw,
getparent(hw)]);
textout(desktopdc,0,0,pchar(s),length(s));
releasedc(getdesktopwindow,desktopdc);
end;

procedure TWNDHacker.ViewAtomTable1Click(Sender: TObject);
var a:atom;
aname:array[0..255]of char;
hf:thandle;
sherr,bwrite:dword;
l:uint;
s:String;
cs:tstringlist;
begin
cs:=tstringlist.Create;
hf:=CreateFile('ATOMTABL.CSV',generic_write,0,nil,create_always,
file_attribute_normal,0);
if hf=INVALID_HANDLE_VALUE then begin
messagebox(handle,PChar(syserrormessage(getlasterror)),'Window Hacker(Create)',
mb_iconerror);
exit;
end;
s:='';
for a:=1 to $FFFF do
begin
l:= globalgetatomname(a,aname,256);
if l>0 then begin
cs.Add('0x'+inttohex(a,4));
cs.Add(aname);
s:=cs.CommaText+#13#10;
if not writefile(hf,s[1],length(s),bwrite,nil) then begin
messagebox(handle,pchar(syserrormessage(getlasterror)),'Window Hacker(write)',
mb_iconerror);
exit;
end;
end;
cs.Clear;
end;
closehandle(hf);
cs.Free;
sherr:=33;
if shellexecute(0,nil,'ATOMTABL.CSV',nil,nil,sw_show)<33 then
sherr:=shellexecute(0,nil,'notepad.exe','ATOMTABL.CSV',nil,sw_show);
if sherr<33 then messagebox(handle,PChar(syserrormessage(sherr)),
'Window Hacker(shell)',mb_iconerror);
end;

procedure TWNDHacker.SaveIcon1Click(Sender: TObject);
var ico:ticon;
begin
if not savedialog1.Execute then exit;
ico:=ticon.Create;
ico.Handle:=hico;
ico.SaveToFile(savedialog1.filename);
ico.Free;
end;

procedure TWNDHacker.HWNDIconClick(Sender: TObject);
var poin:tpoint;
begin
getcursorpos(poin);
restorewindow1.Enabled:=isiconic(strtoint(hwndedit.text));
popupmenu1.Popup(poin.x,poin.y);
end;

procedure TWNDHacker.RestoreWindow1Click(Sender: TObject);
begin
showwindow(strtoint(hwndedit.text),sw_show);
if not openicon(strtoint(hwndedit.text)) then
messagebox(handle,pchar(syserrormessage(getlasterror)),'Window Hacker',
mb_iconerror);

end;

procedure TWNDHacker.LoadIcon1Click(Sender: TObject);
var hins:hinst;
ind:dword;
begin
if not opendialog1.Execute then exit;
ind:=StrTointdef(inputbox('Icon Index#','Enter Icon Index Number','0'),0);
hins:=getclasslong(strtoint(hwndedit.text),GCL_HMODULE);
setclasslong(strtoint(hwndedit.text),GCL_HICON,ExtractIcon(hins,pchar(
opendialog1.FileName),ind));
end;

procedure TWNDHacker.ShowWindow1Click(Sender: TObject);
var sw:integer;
hw:hwnd;
s:string;
begin
hw:=strtoint(hwndedit.text);
s:=inputbox('ShowWindow','Enter SW_ Constant','SW_SHOWNA');
if pos('SW_',uppercase(s))=1 then
sw:=StrToInt(shows.values[s])else
sw:=Strtointdef(s,sw_showna);
showwindow(hw,sw);
end;

procedure TWNDHacker.GetWindowLong1Click(Sender: TObject);
var ind:integer;
hw:hwnd;
s:string;
begin
hw:=strtoint(hwndedit.text);
s:=InputBox('GetWindowLong','Enter GWL Constant:','GWL_STYLE');
if strscan(pchar(s),'_')=nil then ind:=strtointdef(s,gwl_style) else
ind:=strtoint(gwl.values[s]);
s:=Format('Index %x equals %x',[ind,GetWindowLong(hw,ind)]);
messagebox(handle,PChar(s),'Window Hacker',0);
end;

procedure TWNDHacker.Button5Click(Sender: TObject);
begin
setwindowpos(strtoint(hwndedit.text),0,spinedit3.value,spinedit4.value,
spinedit2.Value,spinedit1.Value,swp_noactivate or
(Byte(checkbox3.checked)*SWP_NOSENDCHANGING));
end;

procedure TWNDHacker.FindWindowEx1Click(Sender: TObject);
begin
findwndex.Visible:=true;
findwndex.BringToFront;
end;

end.
unit wndhackunit2;
//Find Window Unit
interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TFindWNDEx = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Memo1: TMemo;
    Button1: TButton;
    Button2: TButton;
    Label3: TLabel;
    Edit2: TEdit;
    Button3: TButton;
    CheckBox1: TCheckBox;
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FindWNDEx: TFindWNDEx;
childaf:hwnd;
implementation

{$R *.DFM}

uses wndhackunit1;

procedure TFindWNDEx.Button1Click(Sender: TObject);
var hw:hwnd;
begin
if checkbox1.Checked then childaf:=0;
if memo1.Text='' then
hw:=findwindowex(strtointdef(edit2.text,0),childaf,pchar(edit1.text),nil)else
hw:=findwindowex(strtointdef(edit2.text,0),childaf,pchar(edit1.text),pchar(
memo1.text));
childaf:=hw;
checkbox1.Checked:=false;
if hw=0 then exit;
if wndhacker.ListBox1.Items.IndexOfObject(tobject(hw))=-1 then
wndhacker.UpdateList1.Click;
wndhacker.ListBox1.ItemIndex:=wndhacker.ListBox1.Items.IndexOfObject(tobject(hw));
wndhacker.ListBox1Click(nil);
end;

procedure TFindWNDEx.Button3Click(Sender: TObject);
begin
edit2.text:=wndhacker.HWNDEdit.Text
end;

end.
library libwndhack;
//API Library for Window Hacker
uses
  SysUtils,windows,messages,
  Classes;
{$RESOURCE wndhackdll.res}

type THWNDCommand=record
Opcode:byte;
etc,ret,found:integer;
hwnds:tlist;
query:pchar;
end;
PHWNDCommand=^THWNDCommand;
function GetConsoleWindow:HWND;stdcall;external 'kernel32.dll';
var lasterr:pchar=nil;
def_cmd:thwndcommand;
dc:hdc;

function WNDGetLastError:pchar;stdcall;
begin
result:=lasterr;
end;

function MyWNDEnum(hw:hwnd;var lp:thwndcommand):bool;stdcall;
var wtxt,cn:array[0..255]of char;
begin
getclassname(hw,cn,256);
getwindowtext(hw,wtxt,256);
result:=true;
if (strpos(cn,lp.query)<>nil)or(strpos(wtxt,lp.query)<>nil)then begin
lp.found:=lp.found+1;
case lp.Opcode of
1:lp.ret:= Integer(ShowWindow(hw,lp.etc));
2:lp.ret:= integer(EnableWindow(hw,(lp.etc=1)));
3:lp.ret:= sendmessage(hw,bm_Click,0,0 );
4:lp.ret:=sendmessage(hw,wm_destroy,0,0);
5:lp.ret:=sendmessage(hw,wm_close,0,0);
6:lp.ret:=setparent(hw,lp.etc);
end;
lp.hwnds.Add(Pointer(hw));
end;
if not enumchildwindows(hw,@mywndenum,integer(@lp))then
lasterr:='EnumChildWindows failed';
end;

function ShowHWND(hwnderr:hwnd;reserved:dword;lpQuery:pchar;nshow:integer):POINTER;stdcall;
var cmd:phwndcommand;
begin
new(cmd);
cmd.query:=lpquery;
cmd.found:=0;
cmd.Opcode:=1;
cmd.etc:=nshow;
cmd.hwnds:=tlist.Create;
if not enumwindows(@mywndenum,Integer(cmd))then
if reserved>0 then begin
messagebox(hwnderr,'EnumWindows Failed',nil,mb_iconerror);
exitprocess(0);
end else
lasterr:='EnumWindows failed';
if reserved>0 then exitprocess(cmd.found);
result:=cmd;
end;

function ClickButton(hwnderr:hwnd;reserved:dword;lpQuery:pchar;
nshow:integer):POINTER;stdcall;
var cmd:phwndcommand;
begin
new(cmd);
cmd.query:=lpquery;
cmd.found:=0;
cmd.Opcode:=3;
cmd.etc:=0;
cmd.hwnds:=tlist.Create;
if not enumwindows(@mywndenum,Integer(cmd))then
if reserved>0 then begin
messagebox(hwnderr,'EnumWindows Failed',nil,mb_iconerror);
exitprocess(0);
end else
lasterr:='EnumWindows failed';
if reserved>0 then exitprocess(cmd.found);
result:=cmd;
end;

function GetFoundWindowCount(var lpHWNDCMD:THWNDCommand):integer;stdcall;
begin
result:=lphwndcmd.found;
end;

function GetWNDReturnValue(var lpWND:THWNDCommand):integer;stdcall;
begin
result:=lpWND.ret;
end;

function HWNDPop(lpWND:pHWNDCommand):hwnd;stdcall;
begin
result:=0;
try
result:=hwnd(lpwnd.hwnds[0]);
lpwnd.hwnds.Delete(0);
except on e:exception do lasterr:=PChar(e.message);
end;
end;

procedure WNDHackFree(p:phwndcommand);stdcall;
begin
if p.hwnds<>nil then p.hwnds.Free;
dispose(p);
end;

procedure WNDResetError;stdcall;
begin
lasterr:=nil;
end;

function DestroyHWND(hwnderr:hwnd;reserved:dword;lpQuery:pchar;
nshow:integer):POINTER;stdcall;
var cmd:phwndcommand;
begin
new(cmd);
cmd.query:=lpquery;
cmd.found:=0;
cmd.Opcode:=4;
cmd.hwnds:=tlist.Create;
if not enumwindows(@mywndenum,Integer(cmd))then
if reserved>0 then begin
messagebox(hwnderr,'EnumWindows Failed',nil,mb_iconerror);
exitprocess(0);
end else
lasterr:='EnumWindows failed';
if reserved>0 then exitprocess(cmd.found);
result:=cmd;
end;

function CloseHWND(hwnderr:hwnd;reserved:dword;lpQuery:pchar;
nshow:integer):POINTER;stdcall;
var cmd:phwndcommand;
begin
new(cmd);
cmd.query:=lpquery;
cmd.found:=0;
cmd.Opcode:=5;
cmd.hwnds:=tlist.Create;
if not enumwindows(@mywndenum,Integer(cmd))then
if reserved>0 then begin
messagebox(hwnderr,'EnumWindows Failed',nil,mb_iconerror);
exitprocess(0);
end else
lasterr:='EnumWindows failed';
if reserved>0 then exitprocess(cmd.found);
result:=cmd;
end;

procedure ScreenSaverBox(hwn:hwnd;inst:hinst;lpscrfile:pchar;nshow:integer);stdcall;
begin
allocconsole;
setconsoletitle(lpscrfile);
if winexec(pchar(strpas(lpscrfile)+' /P '+inttostr(getconsolewindow)),sw_show)>31
then while true do asm NOP end;
MessageBox(hwn,'Error opening screensaver','Window Hacker',mb_iconerror);
end;

function CreateBox(shw:hwnd;resered:dword;lpQuery:PCHAR;nshow:integer):bool;stdcall;
var cmd:phwndcommand;
hw:hwnd;
i:integer;
S,q:string;
begin
result:=allocconsole;
setconsoletitle('WNDHackerBox');
setclasslong(getconsolewindow,gcl_hicon,loadicon(getmodulehandle('libwndhack.dll'),
'WNDMAN'));
writeln('Box for ',lpquery);
writeln('Box handle is $',inttohex(getconsolewindow,0));
new(cmd);
cmd.Opcode:=6;
cmd.etc:= Integer(Getconsolewindow);
cmd.found:=0;
cmd.query:=lpquery;
cmd.hwnds:=tlist.Create;
enumwindows(@mywndenum,Integer(cmd));
writeln(cmd.found,' windows has joined this box');
hw:=HWNDPop(cmd);
while hw<>0 do begin
writeln('Window Handle $',inttohex(hw,0),' has joined this box');hw:=hwndpop(cmd);
end;
while true do begin
write('WNDHack>');
readln(s);
s:=trim(s);
if Uppercase(s)='HELP' then begin
writeln('Commands Avaliable:');
writeln('ADD      searches for a window objects and adds them to this box');
writeln('CLOSE    Sends WM_CLOSE message to all window objects that are apart of this box');
end;
if uppercase(s)='ADD' then begin
write('WindowName/Classname:');
readln(q);
cmd.query:=PChar(q);
enumwindows(@mywndenum,Integer(cmd));
end;
if Uppercase(s)='CLOSE' then 
for i:= 0 to cmd.hwnds.count-1do
sendmessage(HWND(CMD.hwnds[i]),wm_close,0,0);
end;
end;

function EnableHWND(hwnderr:hwnd;reserved:dword;lpQuery:pchar;
nshow:integer):POINTER;stdcall;
var cmd:phwndcommand;
begin
new(cmd);
cmd.query:=lpquery;
cmd.found:=0;
cmd.Opcode:=2;
cmd.etc:=1;
cmd.hwnds:=tlist.Create;
if not enumwindows(@mywndenum,Integer(cmd))then
if reserved>0 then begin
messagebox(hwnderr,'EnumWindows Failed',nil,mb_iconerror);
exitprocess(0);
end else
lasterr:='EnumWindows failed';
if reserved>0 then exitprocess(cmd.found);
result:=cmd;
end;

function DisableHWND(hwnderr:hwnd;reserved:dword;lpQuery:pchar;
nshow:integer):POINTER;stdcall;
var cmd:phwndcommand;
begin
new(cmd);
cmd.query:=lpquery;
cmd.found:=0;
cmd.Opcode:=2;
cmd.etc:=0;
cmd.hwnds:=tlist.Create;
if not enumwindows(@mywndenum,Integer(cmd))then
if reserved>0 then begin
messagebox(hwnderr,'EnumWindows Failed',nil,mb_iconerror);
exitprocess(0);
end else
lasterr:='EnumWindows failed';
if reserved>0 then exitprocess(cmd.found);
result:=cmd;
end;

function WindowSearch(lpQuery:pchar):phwndcommand;stdcall;
begin
new(result);
result.Opcode:=0;
result.hwnds:=tlist.Create;
result.found:=0;
if not enumwindows(@mywndenum,integer(result)) then
lasterr:='EnumWindows failed';
end;

function ChangeParent(hwnderr:hwnd;reserved:dword;lpQuery:pchar;
nshow:integer):POINTER;stdcall;
var cmd:phwndcommand;
sl:tstringlist;
begin
sl:=tstringlist.Create;
sl.CommaText:=strpas(lpQuery);
new(cmd);
cmd.query:=PChar(sl[0]);
cmd.found:=0;
cmd.Opcode:=6;
cmd.etc:=strtointdef(sl[1],getdesktopwindow);
cmd.hwnds:=tlist.Create;
sl.Free;
if not enumwindows(@mywndenum,Integer(cmd))then
if reserved>0 then begin
messagebox(hwnderr,'EnumWindows Failed',nil,mb_iconerror);
exitprocess(0);
end else
lasterr:='EnumWindows failed';
if reserved>0 then exitprocess(cmd.found);
result:=cmd;
end;

function WNDHackSize(var wnddata:thwndcommand):integer;stdcall;
begin
result:=sizeof(wnddata);
end;

procedure QueryFirstWindow(hw:hwnd;inst:hinst;lpQuery:pchar;nShow:integer);stdcall;
var cmd:phwndcommand;
begin
new(cmd);
cmd.Opcode:=0;
cmd.query:=lpquery;
cmd.found:=0;
cmd.hwnds:=tlist.Create;
enumwindows(@mywndenum,integer(cmd));
if cmd.found=0 then exitprocess(0);
exitprocess(hwndpop(cmd));
end;

exports WNDGetLastError,ShowHWND,HWNDPop,WNDHackFree,GetWNDReturnValue,CreateBox,
GetFoundWindowCount,WNDResetError,ClickButton,CloseHWND,DestroyHWND,DisableHWND,
EnableHWND,WindowSearch,ChangeParent,WNDHackSize,QueryFirstWindow,ScreenSaverBox;
begin
end.

All programs are virus free. Some antivirus software might say its "suspicious" or a "Potentionaly Unwanted Program". Some of them rate them on what there code looks like no matter if theres a definition in the virus database. If any of them are detected any Antivirus I will zip the software with the password "justin" j is lowercase

Lightnix Serial Port Light Flasher

Lightnix is a open source serial/parallel port holiday flasher driver for windows. You can see its full capability by opening winlight.exe at the command prompt.

Examples

Flashing lights from serial port com1

Winlight.exe flash=100 com=\\.\COM1

The number in blue is the slowness speed of the flash in milliseconds and \\.\com1 is the com port path. This way can only flash up to 2 strains of lights at once.

program winlight;
{$APPTYPE CONSOLE}
{$RESOURCE Lightnix.res}
uses
  SysUtils,
  windows,
  Classes;
const DRVF_USERDEF_MASK=1;

type
TDriverInfo=record
cbSize,Flags,mask:integer;
CurrentBuildDate,RequiredBuildDate:TSYSTEMTIME;
etc,errormsg:ShortString;
end;
TOut32=procedure(io:word;x:byte);stdcall;
TInp32=function(io:word):byte;stdcall;
TDriverInit=function(var drvinfo:tdriverinfo):integer;stdcall;
TDriverInp=function(xdefault:integer):integer;stdcall;
TDriverOut=function(x:integer):integer;stdcall;
var x,y,i:integer;
params:tstringlist;
io:word;
dinfo:TDriverInfo;
Out32:tout32;
Inp32:tinp32;
inpout32,drv:hmodule;
driverinit:tdriverinit;
driverinp:tdriverinp;
driverout:tdriverout;
happ,com:thandle;
url:string;
verinfo:_BY_HANDLE_FILE_INFORMATION;
label loop1,loop2;
begin
dinfo.cbSize:=sizeof(dinfo);
happ:=createfile(PChar(paramstr(0)),generic_read,file_share_read,nil,open_existing,
file_attribute_normal,0);
getfileinformationbyhandle(happ,verinfo);
closehandle(happ);
filetimetosystemtime(verinfo.ftLastWriteTime,dinfo.currentbuilddate);
writeln('Lightnix32 build ',dinfo.currentbuilddate.wMonth,'/',
dinfo.currentbuilddate.wDay,'/',dinfo.currentbuilddate.wYear);
if paramcount = 0 then begin
writeln('Usage: WINLIGHT [option=value]');
writeln('I/O Options:');
writeln('IOAddr     Specifies the I/O address to use');
writeln('OUT        Specifies what value to set the I/O Address');
writeln('WAIT       Specifies the number of seconds to wait,before the address reverts back');
Writeln('FLASH      Enter flash mode, its value is a delay in miliseconds');
writeln('MASK       Defines the maximum value that it will oscilate to, use with FLASH');
writeln('');
writeln('Serial Options:');
writeln('COM        Specifies the COM Port to use. Example COM=\\.\COM1');
writeln('MCR        Specifies what to set the Modem Control Register D for Data Terminal Ready and R for Request To Send');
writeln('WAIT       Same as above but for serial ports');
writeln('FLASH      Same as above but for serial ports');
writeln('');
writeln('Plugin Options:');
writeln('DRIVER     Defines the driver DLL file');
writeln('ETC        Defines extra settings for the driver');
writeln('WAIT       Same as above but for driver');
writeln('OUT        Same as above but for driver');
writeln('OUT2       Used only when WAIT is used, its the reverting value');
writeln('FLASH      Same as above but for driver');
writeln('MASK       Same as above but for driver');
exit;
end;
params:=tstringlist.create;
for i:= 1 to paramcount do
params.Add(paramstr(i));
if params.Values['DRIVER']<>'' then begin
dinfo.CurrentBuildDate.wDayOfWeek:=0;
copymemory(@dinfo.requiredbuilddate,@dinfo.currentbuilddate,sizeof(tsystemtime));
drv:=loadlibrary(pchar(params.values['driver']));
if drv=0 then begin writeln(Syserrormessage(getlasterror));exit;end;
@DriverInit:=GetProcAddress(drv,'DriverInit');
@DriverInp:=GetProcAddress(drv,'DriverInp');
@DriverOut:=GetProcAddress(drv,'DriverOut');
if (@driverinit=nil)or(@driverinp=nil)or(@driverout=nil) then begin
writeln('Some functions couldnt load');
exitprocess(error_bad_driver);
end;
dinfo.mask:=strtointdef(params.values['Mask'],255);
dinfo.etc:=params.Values['etc'];
i:=driverinit(dinfo);
if encodedate(dinfo.currentbuilddate.wYear,dinfo.currentbuilddate.wMonth,
dinfo.currentbuilddate.wDay)<encodedate(dinfo.requiredbuilddate.wyear,
dinfo.requiredbuilddate.wMonth,dinfo.requiredbuilddate.wDay) then begin
writeln('This driver requires a newer build in order to run.');
exitprocess(error_bad_device);
end;
if (i<>0) or (dinfo.errormsg<>'') then begin
if dinfo.errormsg='' then begin
writeln('DriverInit:',syserrormessage(i));
exitprocess(i);
end else begin writeln('DriverInit:',dinfo.errormsg);
exitprocess(error_bad_driver);
end;
end;
if params.Values['wait']<>''then begin
writeln('Requesting for starting value...');
x:=DriverInp(strtointdef(params.values['out2'],0));
if x<-1 then begin writeln('Driver failed!');exitprocess(error_bad_driver);end;
if x=-1 then writeln('There is no starting value') else
writeln('Starting value is $',IntToHex(x,0));
driverout(strtointdef(params.values['out'],0));
sleep(1000*strtointdef(params.values['wait'],1));
driverout(x);
end;
end else
if params.Values['IOAddr']<>'' then
begin
inpout32:=LoadLibrary('inpout32.dll');
@out32:=getprocaddress(inpout32,'Out32');
@inp32:=Getprocaddress(inpout32,'Inp32');
io:= strtointdef(params.values['IOAddr'],$378);
x:=inp32(io);
writeln('Starting value for $'+inttohex(io,0)+' is $'+inttohex(x,2));
if strtointdef(Params.values['Wait'],0)>0 then begin
y:=strtointdef(params.values['out'],$ff);
writeln('Outputing $'+inttohex(y,2));
out32(io,y);
sleep(1000*strtointdef(params.Values['wait'],1));
writeln('Reverting back');
out32(io,x);
exitprocess(0);
end;
if params.Values['Flash']<>'' then begin
write('Sending pulses');
loop1:
for x:= 0 to StrTointDef(params.values['Mask'],255) do
begin
out32(io,x);
write('.');
sleep(strtointdef(params.values['flash'],100));
end;
goto loop1;
end else begin
 writeln('Sending Byte');
 Out32(io,StrToIntDef(params.values['out'],0));
end;
end else if params.Values['COM']<>'' then begin
com:=createfile(@params.values['com'][1],generic_read,0,nil,open_existing,
file_attribute_normal,0);
if com=INVALID_HANDLE_VALUE then begin
writeln(Syserrormessage(getlasterror));
exitprocess(getlasterror);
end;
if not escapecommfunction(com,clrdtr) then begin
writeln(syserrormessage(getlasterror));
closehandle(com);
exitprocess(getlasterror);
end;
if Params.Values['WAIT']<>'' then begin
writeln('Waiting...');
sleep(1000*strtointdef(params.values['wait'],1));
if pos('D',params.values['MCR'])>0 then escapecommfunction(com,setdtr);
if pos('R',params.values['MCR'])>0 then escapecommfunction(com,setrts);
end;
if params.Values['Flash']<>'' then begin
write('Sending Pulses');
loop2:
EscapeCommfunction(com,clrdtr);
EscapeCommFunction(com,clrrts);
write('.');
sleep(strtointdef(Params.values['flash'],100));
EscapeCommfunction(com,setdtr);
EscapeCommFunction(com,clrrts);
write('.');
sleep(strtointdef(Params.values['flash'],100));
EscapeCommfunction(com,clrdtr);
EscapeCommFunction(com,setrts);
write('.');
sleep(strtointdef(Params.values['flash'],100));
EscapeCommfunction(com,setdtr);
EscapeCommFunction(com,setrts);
write('.');
sleep(strtointdef(Params.values['flash'],100));
goto loop2;
end;
closehandle(com);
end else writeln('Cannot tell what to use, perhaps you forgot an option.');
end.

All programs are virus free. Some antivirus software might say its "suspicious" or a "Potentionaly Unwanted Program". Some of them rate them on what there code looks like no matter if theres a definition in the virus database. If any of them are detected any Antivirus I will zip the software with the password "justin" j is lowercase

Remember StopWatch for windows

What is remember?

Remember is a stopwatch and timer that can remember where it left

off if the computer crashed, rebooted, or the program closes. The

program creates a file called remember.sav which contains the time

and settings. The proram features a wave file built-into the exe file

that plays when the stopwatch has finished in stopwatch mode.

 

To enter stopwatch mode open this program from the command prompt with

the following parameters:

 

remember.exe hh:mm:ss

 

where hh:mm:ss is the starting time of the stopwatch. You can enter a

time up to 23:59:59

 

If you would like a regular timer then just open it directly.

 

Just remember to delete remember.sav file when you need to reset the

timer!

program remember;
{$RESOURCE rem32.res}
{$APPTYPE Console}
uses
  SysUtils,
  windows,mmsystem,
Classes;


var
hcon,hf:THandle;
dummy:dword;
save:array[0..1]of tdatetime;
coor:tcoord;
i:integer;
s:String;

label loop,timerdone,alarm;
begin
zeromemory(@save,sizeof(save));
hf :=createfile( 'remember.sav',GENERIC_READ or GENERIC_WRITE,0,nil,open_always,
file_attribute_normal,0);
save[0]:=now;
if hf=INVALID_HANDLE_VALUE then begin
writeln(syserrormessage(getlasterror));
exitprocess(getlasterror);
end;
for i:=1 to paramcount do s:=s+paramstr(i)+#32;
s:=trim(s);
if s<>'' then save[1]:=strtodatetime(s);
readfile(hf,save,sizeof(save),dummy,nil);
setfilepointer(hf,0,nil,file_begin);
writefile(hf,save,sizeof(save),dummy,nil);
closehandle(hf);
hcon:=getstdhandle(std_output_handle);
loop:
coor.x:=0;coor.y:=0;
setconsolecursorposition(hcon,coor);
if save[1]>0 then
if now-save[0]>save[1] then goto timerdone;
if save[1]=0 then
writeln(Trunc(now-save[0]),' days ',FormatDateTime('hh:mm:ss',now-save[0]))
else if now-save[0]>save[1] then goto timerdone else
write(Trunc(save[1]-(now-save[0])),' days ',FormatDateTime('hh:mm:ss',save[1]-(
now-save[0])),' left ');
for i:=1 to 100 do write(#32);
sleep(1000);
goto loop;
timerdone:writeln('Timer finished at '+DateTimeToStr(now));
alarm:
playsound('ALARM',hinstance,snd_resource);
goto alarm;
end.

All programs are virus free. Some antivirus software might say its "suspicious" or a "Potentionaly Unwanted Program". Some of them rate them on what there code looks like no matter if theres a definition in the virus database. If any of them are detected any Antivirus I will zip the software with the password "justin" j is lowercase

delphijustin Industries is an Autism Supported Business
Social Media Auto Publish Powered By : XYZScripts.com
All in one
Start
Amazon.com, Inc. OH Dublin
Your cart is empty.
Loading...