تبليغاتX
Book,Vb,Dehphi,Larning,download,jok,Ebook,ghayeshRyanrh,naservb
English|Farsi(Persian)Welcome To MySite ,Enjoy This Book&Tools!!.
HomePage PresianSite PictureGalery VisualBasic Delphi FreeEBook Mail SiteList OtherSite
Creat ActiveX In VB6

Toyday Post Is Creat ActiveX(UserControl) in VB

Create New Empty Project In VB & Goto Project Menu And Select "Add User Control"

Creat A Command Button on UserControl & Resize to 200 x 200

Rename User Control To 'Command'.Open UserControl CodePage & Insert This Code

'---------User Control Code

Option Explicit

'-------Crerate New Event

Public Event Click()

Public Event Move( Button As Integer,Shift As Integer,X as Single,Y As Single)

'------Uses Prevate For Creat New Evnt Creat Runtime Erorr!

Dim X1!,Y1!

'---------Create New Property

Public Property Let Width1(Value As Integer)'-----------Let For Get Data Of User

If Value >100 then Command1.Width=Value

End Property

Public Property Get Width1() As Integer'--------------Get For Send Data For User

Width1=Command1.Width

End Property

'---------------------------

'This Property Need Uses In Code Page & Not View In Propertis Window

'For View Prpperty In Propertis Windows ,Insert Code In ActiveX Read & Write Property Event

'--------------------------

Private Sub Command1_Click()

'-----------Call You'r Created Event By KeyWord"RaiseEvent"

RaiseEvent Click

End Sub

Private Sub Command1_MouseMove(Button%,Shift%,X!,Y!)

If Button=1 then call Command1.move((command1.Left+X)-X1,(Command1.Top+Y)-Y1)

'-----------Call You'r Created Event By KeyWord"RaiseEvent"

RaiseEvent Move(Button,Shift,X,Y)

End sub

Private Sub UserControl_MouseMove(Button%, Shift%, X!, Y! )
UserControl.BackColor = Ambient.BackColor

'---------------------AmBient Is Form .User Control Created On Ambient(Form Or PictureBox Or Frame)

Command1.BackColor = Ambient.BackColor

End Sub

'--------------------------------------------

Close All ActiveX Windows And Open Design Form Window .Insert A You'r UserControl On Form.

Insert This Code In UserControl Move Event

'-------------------------------

Me.Caption = UserControl1.Width1
UserControl1.Width1 = X + 100

-----------------------------

Run Project And MouseMove On ActiveX And Drag Drop This


[+]By NasserNiazy in10:36 Thu 19 Apr 2007|


 
Call Function & Procedure

 

Hello!

Forms Send Data For Function

ByRef: in this form send main data for function

if change data in function or procedure changed data in all program

model:

Private Function Zarb(ByRef Value1%,ByRef Value2%)as Integer

Zarb=value1*value2

value1=0:value2=0

End Function

in this function change send data in line3 & changed this data in program

in line3 value1&value2=0

ByVal:if send data in function by ByRef .not sended main data in function

send need copy of data in functioin.

Model:

Private Function Zarb(ByVal Value1%,ByVal Value2%)As Integer

Zarb=value1*value2

value1=0:value2=0

End Function

in this function change data.not change data in program need change in function

if insert free space in by and val creat compile Error


[+]By NasserNiazy in10:25 Thu 19 Apr 2007|


 
Form Metod API

this post is larning a form api.creating form and move it and write formcaption Form.Left & Form.Top

in this project not used timercontrol

creat new project and add a module ,copy this code in module.


module code:

'API Types

Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

'API Constants
Const WM_MOVING = 534
Const GWL_WNDPROC = (-4)

'API declarations
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nindex As Long, ByVal dwnewlong As Long) As Long
Private Declare Function CallWindowProc Lib "user32.dll" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, lParam As RECT) As Long
Private Declare Function DefWindowProc Lib "user32.dll" Alias "DefWindowProcA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Dim OldhWndProc As Long

Private Function OnMove(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, lParam As RECT) As Long
'Handle the OnMove event
If uMsg = WM_MOVING Then
'The form is moving!!
Form1.Caption = "Left: " & lParam.Left & " ,Top: " & lParam.Top
'Insert your code HERE
End If
'Call the old WindowProc
OnMove = CallWindowProc(OldhWndProc, hWnd, uMsg, wParam, lParam)
End Function

Public Sub InstallOnMovingEvent(frm As Form)
'Install the new WindowProc - SubClassing
OldhWndProc = SetWindowLong(frm.hWnd, GWL_WNDPROC, AddressOf OnMove)
End Sub

Public Sub RemoveOnMovingEvent(frm As Form)
'Restore the original WindowProc
SetWindowLong frm.hWnd, GWL_WNDPROC, OldhWndProc
End Sub


dublclick on form and crear all form code and copy this code in form

Private Sub Form_Load()
InstallOnMovingEvent Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
RemoveOnMovingEvent Me
End Sub

efew meve form and enjoy!!


[+]By NasserNiazy in10:24 Thu 19 Apr 2007|


 
Hello!hi
 
InTheNameOf Allah

Send Mail For Me

Add To Frind List

Set To Home Page


NasserNiazy:

hello,welcome to my site.this site for larning programming and reference of computer Ebook . For Best Useing this site goto archive and see all post.tank's



Archive
3/20/2008 - 4/19/2008
8/23/2007 - 9/22/2007
7/23/2007 - 8/22/2007
5/22/2007 - 6/21/2007
4/21/2007 - 5/21/2007
3/21/2007 - 4/20/2007
All Archive
 
Best Post
All Programing Ebook
Java And C++ Ebook
800 Ebook In Ftp
Net Programing Ebook .
Best Programing Ebook
Web Programing Ebook
Ajax-Web-Linux Ebook
PHP,JSP Ebook
All Programing book
World Free Librery
Programing Librery
3d Programing
ajax,all Ebook
Pyton,All Ebook
Web Programing & XML
HTML, XML & CSS
Programming with sockets
c# And .Net 2005 Ebook
Librery Link
Ebook For Computer
Need Ajax Ebook
Best Ebook
Book -Ebook!!
Graphic Ebook
All Languge Ebook
Best Programing Ebook(150)
good Ebook

Search
Search In Site Word's
In All Posts


My Frind's
Free EBook
IranJavaScript
Main IranProgramer's
Main IranProgramer's
Delphi For All
Free Softwar Downlod۩۞۩
FarsiVB

Terafik Site

Frame:SabzRod

By:NasserNiazy

 
BackGround Music

For Stop Music RightClick In GreenBox And Select Play Or Forward

Copyright: GhayeshSoft All Right Reserved,By NasserNiazyMobasser