Showing posts with label Miscellaneous. Show all posts
Showing posts with label Miscellaneous. Show all posts

Sunday, December 21, 2008

How to empty Recycle bin with Delphi

Code :

Procedure EmptyRecycleBin ;
Const
SHERB_NOCONFIRMATION = $00000001 ;
SHERB_NOPROGRESSUI= $00000002 ;
SHERB_NOSOUND= $00000004 ;
Type
TSHEmptyRecycleBin = function (Wnd : HWND;
pszRootPath : PChar;
dwFlags : DWORD
) : HRESULT; stdcall ;
Var
SHEmptyRecycleBin : TSHEmptyRecycleBin;
LibHandle : THandle;
Begin
LibHandle := LoadLibrary(PChar('Shell32.dll')) ;
if LibHandle <> 0 then
@SHEmptyRecycleBin := GetProcAddress(LibHandle, 'SHEmptyRecycleBinA')
else
begin
MessageBox(GetActiveWindow,PChar('Gagal melakukan loading Shell32.dll.'),'Error',24);
Exit;
end;
if @SHEmptyRecycleBin <> nil then
SHEmptyRecycleBin(GetActiveWindow,
nil,
SHERB_NOCONFIRMATION or SHERB_NOPROGRESSUI or SHERB_NOSOUND);
FreeLibrary(LibHandle);
@SHEmptyRecycleBin := nil ;
end;

Read More...

Delphi > Procedure Disable Ctrl Alt Del

procedure DisableCtrlAltDel(BDisable:Boolean);
const
VAL_DisableTaskMgr='DisableTaskMgr';
var
MyW: Word;
begin
if Win32Platform = VER_PLATFORM_WIN32_NT then
Begin
with Tregistry.Create do try
RootKey:=HKEY_CURRENT_USER;
OpenKey(RegSystemKey,TRUE);
IF Bdisable=true then
WriteInteger(VAL_DisableTaskMgr,1)
else
DeleteValue(VAL_DisableTaskMgr);
CloseKey;
finally
Free;
end;
end
else
begin
// hanya untuk windows 95 / NT 4.0
if BDisable then
begin
{Disable ALT-TAB}
SystemParametersInfo( SPI_SETFASTTASKSWITCH, 1, @Myw, 0);
{Disable CTRL-ALT-DEL}
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 1, @Myw, 0);
end
else
begin
{Enable ALT-TAB}
SystemParametersInfo( SPI_SETFASTTASKSWITCH, 0, @Myw, 0);
{Enable CTRL-ALT-DEL}
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 0, @Myw, 0);
end;
end;
end;

Read More...

Friday, November 28, 2008

Delphi > Download Source Code KSpoold Disinfector

KSpoold Disinfector is a software that writen to restore Microsoft Office files (Word, Excel, PPT etc.) from damaged file because of KSpoold virus.

KSpoold infect the docs files by mergeing these docs to the virus file, original docs files will be delete & new file with the same name will be added to cheating the users with new file extention: .EXE So anytime you double click this infected file from explorer / open it using shell api your computer will be infected too.

The software is provided "as-is," without any express or implied warranty. In no event shall the Author be held liable for any damages arising from the use of the Software

The software is writen in Borland Delphi 7. Full source-code also provided, any comments are noted of the following:
"The const SAMPLE_SIZE = 524; is taken from the following figure: Microsoft Word & Excel using the same file header at the first 512, so we get unique header at the first 12 byte after 512 offset 512 + 12 = 524"

You can download sample of infected file by KSpoold here:
http://delphi-id.org/dpr/Downloads-index-req-viewdownloaddetails-lid-180.pas

Download Source Code

KSpoold Disinfector 1.0 - Freeware
Copyright © Indra Gunawan, 2ind@mail.com
www.delphiexpert.wordpress.com

Read More...

VB > Add a 3D Effect to Forms, Textboxes, and Labels


'Set form's AutoRedraw property toTrue
Sub PaintControl3D(frm As Form, Ctl As Control)
' This Sub draws lines around controls to make them 3d

' darkgrey, upper - horizontal
frm.Line (Ctl.Left, Ctl.Top - 15)-(Ctl.Left + _
Ctl.Width, Ctl.Top - 15), &H808080, BF
' darkgrey, left - vertical
frm.Line (Ctl.Left - 15, Ctl.Top)-(Ctl.Left - 15, _
Ctl.Top + Ctl.Height), &H808080, BF
' white, right - vertical
frm.Line (Ctl.Left + Ctl.Width, Ctl.Top)- _
(Ctl.Left + Ctl.Width, Ctl.Top + Ctl.Height), &HFFFFFF, BF
' white, lower - horizontal
frm.Line (Ctl.Left, Ctl.Top + Ctl.Height)- _
(Ctl.Left + Ctl.Width, Ctl.Top + Ctl.Height), &HFFFFFF, BF

End Sub

Sub PaintForm3D(frm As Form)
' This Sub draws lines around the Form to make it 3d

' white, upper - horizontal
frm.Line (0, 0)-(frm.ScaleWidth, 0), &HFFFFFF, BF
' white, left - vertical
frm.Line (0, 0)-(0, frm.ScaleHeight), &HFFFFFF, BF
' darkgrey, right - vertical
frm.Line (frm.ScaleWidth - 15, 0)-(frm.ScaleWidth - 15, _
frm.Height), &H808080, BF
' darkgrey, lower - horizontal
frm.Line (0, frm.ScaleHeight - 15)-(frm.ScaleWidth, _
frm.ScaleHeight - 15), &H808080, BF

End Sub

'DEMO USAGE
'Add 1 label and 1 textbox

Private Sub Form_Load()

Me.AutoRedraw = True
PaintForm3D Me
PaintControl3D Me, Label1 'Label1 is name of label
PaintControl3D Me, Text1 'Text1 is name of textbox

End Sub

Read More...

How to show-hide a combo drop down list on VB

Public Declare Function SendMessageLong Lib _
"user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long

Public Const CB_SHOWDROPDOWN = &H14F
Sub Form_Load()
Combo1.AddItem "Item 1"
Combo1.AddItem "Item 2"
Combo1.AddItem "Item 3"
End Sub

Private Sub Command1_Click()
Dim r as Long
r = SendMessageLong(Combo1.hWnd, CB_SHOWDROPDOWN, True, 0)
End Sub

Private Sub Command2_Click()
Dim r as Long
r = SendMessageLong(Combo1.hWnd, CB_SHOWDROPDOWN, False, 0)
End Sub

Read More...

Latest Comments

About Me

My photo
Makassar, Sulawesi Selatan, Indonesia

Guest Book


ShoutMix chat widget

Script Sense ©Template Blogger Green by Dicas Blogger.

TOPO