by Anonymous (267 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 25th January 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
USE OF POLYGON,SETPOLYFILLMODE AND OTHER API CALLS AN EXCELLENT EXPANDING STAR
API Declarations
Dim points(0 To 170) As POINTAPI
Dim j, RETVAL As Long
Const ALTERNATE = 1
Const WINDING = 2
Private Declare Function SetPolyFillMode Lib "gdi32" (ByVal hdc As Long, ByVal nPolyFillMode As Long) As Long
Private Declare Function Polygon Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
Private Declare Function SetTextColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Const SND_SYNC = &H0 ' play synchronously (default)
Const SND_ASYNC = &H1 ' play asynchronously
Const SND_NODEFAULT = &H2 ' silence not default, if sound not found
Const SND_MEMORY = &H4 ' lpszSoundName points to a memory file
Const SND_ALIAS = &H10000 ' name is a WIN.INI [sounds] entry
Const SND_FILENAME = &H20000 ' name is a file name
Const SND_RESOURCE = &H40004 ' name is a resource name or atom
Const SND_ALIAS_ID = &H110000 ' name is a WIN.INI [sounds] entry identifier
Const SND_ALIAS_START = 0 ' must be > 4096 to keep strings in same section of resource file
Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound
Const SND_NOSTOP = &H10 ' don't stop any currently playing sound
Const SND_VALID = &H1F ' valid flags / ;Internal /
Const SND_NOWAIT = &H2000 ' don't wait if the driver is busy
Const SND_VALIDFLAGS = &H17201F ' Set of valid flag bits. Anything outside
' this range will raise an error
Const SND_RESERVED = &HFF000000 ' In particular these flags are reserved
Const SND_TYPE_MASK = &H170007
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
R = 200
MsgBox "ENTER NO. OF POINTS UPTO 50 FOR GOOD EFFECT", vbOKOnly
X = InputBox$("INPUT NO OF POINTS", "Polygon")
End Sub
Private Sub Form_Paint()
NUMPOINTS = X
Form1.WindowState = 2
NUMPOINTS = X
Form1.WindowState = 2
Form1.ForeColor = RGB(0, 0, 0)
Form1.FillColor = RGB(Rnd * 256, Rnd * 256, Rnd * 256)
Form1.FillStyle = 0
Form1.DrawWidth = 4
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = 100
Form1.Refresh
Call RANG
X = z
If W < 200 Then
W = W + 10
End If
If W >= 200 Then
W = 0
End If
'RETVAL = PlaySound("C:\WINDOWS\MEDIA\START.WAV", 0, &H1)
End Sub
Sub RANG()
NUMPOINTS = X
z = X
Y = X / 2
Form1.ForeColor = RGB(0, 0, 0)
Form1.FillColor = RGB(Rnd * 256, Rnd * 256, Rnd * 256)
Form1.FillStyle = 0
Form1.DrawWidth = 4
If X Mod 2 = 1 Then
Call c1
End If
If X Mod 2 = 0 And Y Mod 2 = 0 Then
Call c2
End If
If X Mod 2 = 0 And Y Mod 2 = 1 Then
Call c3
End If
d = (X - i) * (3.1415926 / X)
For i = 1 To NUMPOINTS
points(i).X = W * Sin(d * i) + 310
points(i).Y = -W * Cos(d * i) + 220
Next i
M = SetWindowText(Form1.hwnd, "POLYGON")
L = SetTextColor(Form1.hdc, &H6)
j = SetPolyFillMode(hdc, WINDING)
j = Polygon(hdc, points(1), NUMPOINTS)
End Sub
Sub c1()
i = 1
End Sub
Sub c2()
i = 2
End Sub
Sub c3()
i = 2
X = X / 2
End Sub
No comments have been posted about USE OF POLYGON,SETPOLYFILLMODE AND OTHER API CALLS AN EXCELLENT EXPANDING STAR. Why not be the first to post a comment about USE OF POLYGON,SETPOLYFILLMODE AND OTHER API CALLS AN EXCELLENT EXPANDING STAR.