Pages

Search

Monday, August 24, 2009

Chameleon Button by Gonchuki Systems


CHAMELEON BUTTON
copyright ©2001-2003 by gonchuki

this custom control will emulate the most common
command buttons that everyone knows.

it took me three months to develop this control
but that was a first step now eight months after
it turned out to be a very professional control.

ALL THE CODE WAS WRITTEN FROM SCRATCH!!!

ever wanted to add cool buttons to your app???
this is the BEST solution!!!

Copyright © 2001-2003 by gonchuki

Commercial use of this control is FORBIDDEN
without registering first.
You can only use parts of this code for other
open source or freeware programs. Reuse of this
code in commercial applications is also FORBIDDEN
You can use this code without asking for your
personal projects or for freeware but remember
to give credits where its due

you MUST NOT build nor distribute OCX controls
based on the Chameleon Button, doing so is
against this terms.

Download source code here

How to customise your start button

First you need a tool called "Resource Hacker". This free program allows you to change resources in any .exe file such as "Explorer.exe", which includes the [Start] button's Label. You can visit Download.com and search there for "Resource Hacker".
After you download it, follow the guide here:

Step 1:

A - Run "Resource Hacker" and open the file "%windir%\Explorer.exe".
B - You see a Tree of all Resources in this file, expand the "String Table"
C - Find the "start" and replace it with your own text. then press the [Compile Script] button.
D - Save "Explorer.exe" as "MyStart.exe" DONT save it as Explorer.exe, do "save as.." and give it a new name.
E - Quit "Resource Hacker".

Step 2:

A - Click on the [Start] button and choose the "Run..." item from the start menu. (Or use the shortcut key WinKey+R)
B - Type "RegEdit" in the Run "Dialog Box". And then press the [Ok] buton to run the "Registry Editor" program.
C - Go to: "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon" and find the "Shell" property.
D - Replace value of the "Shell" property to "MyStart.exe".
E - Quit "Registry Editor".
F - Restart your system.

Note about Registry Editor:
if you did not find the key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon", you can search the Registry for the "Explorer.exe", to do this use the Edit Menu | Find Next (Ctrl+F).

Thursday, August 20, 2009

Change The Default Location For Installing Application

As the size of hardrives increase, more people are using partitions to seperate and store groups of files.

XP uses the C:\Program Files directory as the default base directory into which new programs are installed. However, you can change the default installation drive and/ or directory by using a Registry hack.

Run the Registry Editor (regedit)and go to

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion

Look for the value named ProgramFilesDir. by default,this value will be C:\Program Files. Edit the value to any valid drive or folder and XP will use that new location as the default installation directory for new programs.

Tuesday, August 4, 2009

Sample Thesis: For Surigao Students

This is a screen shots of the thesis I am working for Surigao Students
This is a inventory system for Pat's Purified Drinking Water, it is not yet finish but I will post some of the modules that I am done with.

This are the screen shots of it:

1. This is the main screen




2. Customer's Information Module

Align Center

3. Adding/Editing Customers Information



Monday, July 13, 2009

Steps In Creating Instance and Database in IBM DB2

01. Click Start on the Windows Toolbar

02. Click Run...

03. Type db2cw on the Open combo box and click OK button

=== please wait until DOS Prompt appears

04. On the DB2 Command Window, type the following commands and press Enter key for each line of command:

db2icrt DEV

db2 CATALOG LOCAL NODE DEV INSTANCE DEV SYSTEM OSTYPE WIN WITH 'Instance for OIS'

=== Substitute with the full computer name of the computer
=== You can see the full computer name by: right-click My Computer, Select Properties and Click Network Identification

05. Start DB2 - DEV instance on Services

=== make it automatic
=== Select This account on Log On tab
=== User name .\db2admin
=== Password password
=== Confirm password password

06. Start DB2 Governor on Services

=== make it automatic

07. On the DB2 Command Window, type the following commands and press Enter key for each line of command:

db2 ATTACH TO DEV

db2 CREATE DATABASE OIS ON C: WITH 'Database for OIS'

=== please wait until DOS Prompt appears

exit

08. Click Start on the Windows Toolbar

09. Click Run...

10. Type db2ca on the Open combo box and click OK button

=== please wait until Configuration Assitant appears

11. On the pane, right-click OIS and click Change Database...

=== please wait until Change Database Wizard appears

12. Click Database

13. Type S_OIS on Database alias text box and click Next button

14. Enter the following parameters:

Register this database for ODBC checked
As system data source selected
As user data source unselected
As file data source unselected
Data source name S_OIS
Optimize for application None

15. Click Finish button

16. Close the Configuration Assistant.

17. Open Data Sources (ODBC) on Administrative Tools

18. On System DSN tab, select S_OIS and click Configure button

19. Enter the following parameters:

Data source anme S_OIS
Description
User ID db2admin
Password password
Save Password checked (click OK button on the DB2 Message)

20. Click Connect button

=== DB2 Message must be "Connection tested successfully"
(click OK button on the DB2 Message)

21. Click Bind CLI/ODBC support utilities button

=== There must be result and click OK button

22. Click OK button

23. Click OK button

24. Click Start on the Windows Toolbar

25. Click Run...

26. Type db2cc on the Open combo box and click OK button

=== please wait until Control Center appears

27. On the Object View pane, click nodes of All Systems, , Instances until DEV instance OISplayed

28. Richt-click DEV instance and click Setup communications

29. Enter the following parameters:

NetBIOS unchecked
TCP/IP checked
NPIPE unchecked


30. Click Properties(2) button

31. Enter the following parameters:

Host name
Service name applctn
Port number 50001

32. Click OK button

=== message will appear

33. Click Close button

33. Click OK button

=== message will appear

34. Click Close button

35. Richt-click DEV instance and click Stop

36. Click OK button

=== message will appear

37. Click Close button

38. Richt-click DEV instance and click Start

=== message will appear

39. Click Close button

40. Close the Control Center.

How To Reseed Table Identity on SQL

To reseed table identity in SQL we will going to use the function DBCC CHECKIDENT

Syntax

DBCC CHECKIDENT
( 'table_name'
[ , { NORESEED
| { RESEED [ , new_reseed_value ] }
}
]
)

Arguments

'table_name'

Is the name of the table for which to check the current identity value. Table names must conform to the rules for identifiers. For more information, see Using Identifiers. The table specified must contain an identity column.

NORESEED

Specifies that the current identity value should not be corrected.

RESEED

Specifies that the current identity value should be corrected.

new_reseed_value

Is the value to use in reseeding the identity column.


Example:

DBCC CHECKIDENT (My_Table, reseed, 0)

This example will reseed table My_Table, and the identity seed will start 1 again

Monday, June 8, 2009

Image Button Control

This is an alternative button control, that can handle images even its flatstyle is set to System, this control is for VB.Net 2003 users.

To use this code, create new project and select windows controls libary, and add new control and name it Imagebutton, just copy this code and paste. Thats all.

Imports System.Runtime.InteropServices
Public Class ImageButton
Inherits System.Windows.Forms.Button
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
MyBase.WndProc(m)
If m.Msg = (NativeMethods.WM_REFLECT Or NativeMethods.WM_NOTIFY) Then
Dim CustomDrawHeader As NativeMethods.NMCUSTOMDRAW = DirectCast(Marshal.PtrToStructure(m.LParam, GetType(NativeMethods.NMCUSTOMDRAW)), NativeMethods.NMCUSTOMDRAW)
If CustomDrawHeader.dwDrawStage = NativeMethods.CustomDrawDrawStage.CDDS_PREPAINT Then
Dim g As Graphics = Graphics.FromHdc(CustomDrawHeader.hdc)
Dim pe As New PaintEventArgs(g, Me.Bounds)
OnPaint(pe)
pe.Dispose()
g.Dispose()
End If
End If
End Sub
Protected Overrides Sub OnPaint(ByVal pevent As System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(pevent)
DrawImage(pevent.Graphics)
End Sub
Protected Overridable Sub DrawImage(ByVal g As Graphics)
If Me.Image Is Nothing Then Return

Dim pt As PointF

Select Case Me.ImageAlign
Case ContentAlignment.TopLeft
pt.X = 5
pt.Y = 5
Case ContentAlignment.TopCenter
pt.X = Convert.ToSingle(Width - Me.Image.Width) / 2
pt.Y = 5
Case ContentAlignment.TopRight
pt.X = Width - Me.Image.Width - 5
pt.Y = 5
Case ContentAlignment.MiddleLeft
pt.X = 5
pt.Y = Convert.ToSingle(Height - Me.Image.Height) / 2
Case ContentAlignment.MiddleCenter
pt.X = Convert.ToSingle(Width - Me.Image.Width) / 2
pt.Y = Convert.ToSingle(Height - Me.Image.Height) / 2
Case ContentAlignment.MiddleRight
pt.X = Width - Me.Image.Width - 5
pt.Y = Convert.ToSingle(Height - Me.Image.Height) / 2
Case ContentAlignment.BottomLeft
pt.X = 5
pt.Y = Height - Me.Image.Height - 5
Case ContentAlignment.BottomCenter
pt.X = Convert.ToSingle(Width - Me.Image.Width) / 2
pt.Y = Height - Me.Image.Height - 5
Case Else
pt.X = Width - Me.Image.Width - 5
pt.Y = Height - Me.Image.Height - 5
End Select

If Me.Enabled Then
If Me.ImageList Is Nothing Then
g.DrawImage(Me.Image, pt.X, pt.Y, Me.Image.Width, Me.Image.Height)
Else
Me.ImageList.Draw(g, Point.Round(pt), Me.ImageIndex)
End If
Else
Dim p As Point = Point.Round(pt)
ControlPaint.DrawImageDisabled(g, Me.Image, p.X, p.Y, Me.BackColor)
End If

End Sub

End Class

Friend Class NativeMethods
Private Sub New()
'Uninstantiable Class
End Sub

Public Const WM_USER As Int32 = &H400&
Public Const WM_NOTIFY As Int32 = &H4E&
Public Const WM_REFLECT As Int32 = WM_USER + &H1C00&
Public Const NM_FIRST As Int32 = 0
Public Const NM_CUSTOMDRAW As Int32 = NM_FIRST Or -12

Public Enum CustomDrawDrawStage
CDDS_PREPAINT = &H1
CDDS_POSTPAINT = &H2
CDDS_PREERASE = &H3
CDDS_POSTERASE = &H4
CDDS_ITEM = &H10000
CDDS_ITEMPREPAINT = (CDDS_ITEM Or CDDS_PREPAINT)
CDDS_ITEMPOSTPAINT = (CDDS_ITEM Or CDDS_POSTPAINT)
CDDS_ITEMPREERASE = (CDDS_ITEM Or CDDS_PREERASE)
CDDS_ITEMPOSTERASE = (CDDS_ITEM Or CDDS_POSTERASE)
CDDS_SUBITEM = &H20000
End Enum

Public Enum CustomDrawItemState
CDIS_SELECTED = &H1
CDIS_GRAYED = &H2
CDIS_DISABLED = &H4
CDIS_CHECKED = &H8
CDIS_FOCUS = &H10
CDIS_DEFAULT = &H20
CDIS_HOT = &H40
CDIS_MARKED = &H80
CDIS_INDETERMINATE = &H100
CDIS_SHOWKEYBOARDCUES = &H200
End Enum

_
Public Structure NMHDR
Public HWND As Int32
Public idFrom As Int32
Public code As Int32
Public Overloads Function ToString() As String
Return String.Format("Hwnd: {0}, ControlID: {1}, Code: {2}", HWND, idFrom, code)
End Function
End Structure
_
Public Structure NMCUSTOMDRAW
Public hdr As NMHDR
Public dwDrawStage As CustomDrawDrawStage
Public hdc As IntPtr
Public rc As RECT
Public dwItemSpec As IntPtr
Public uItemState As CustomDrawItemState
Public lItemlParam As IntPtr
End Structure
_
Public Structure RECT
Public left, top, right, bottom As Int32
End Structure
End Class


I got this in some websites, Im sorry I forget the site, If your the original owner of the code please pm me: