Jump to content
Sign in to follow this  
mesale0077

GUIConstants dont show

Recommended Posts

mesale0077

#include <Date.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Memory.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

;Opt("MouseCoordMode",0)
opt("TrayIconDebug", 1)
Opt("TrayOnEventMode",1)
Opt("TrayMenuMode", 3)


;#include "OpenGLconstants.au3" ; constants are extracred for this examle
;Opt("GUIOnEventMode", 1)
_Fofff()
Func _Fofff()
Global $Input2,$Input1,$exititem_2,$exititem_1,$exititem
Global $speed = 0.5 ; speed of projectile, 0.28 defult
Global $relitave = 0

If $relitave = 1 Then
    Global $tail = $speed * 3.2145
Else
    Global $tail = 14.0
EndIf

; Used constants from OpenGLconstants.au3
Global Const $GL_VERSION_1_1 = 1
Global Const $GL_DEPTH_BUFFER_BIT = 0x00000100
Global Const $GL_COLOR_BUFFER_BIT = 0x00004000
Global Const $GL_SRC_COLOR = 0x0300
Global Const $GL_DST_COLOR = 0x0306
Global Const $GL_FOG = 0x0B60
Global Const $GL_FOG_DENSITY = 0x0B62
Global Const $GL_FOG_START = 0x0B63
Global Const $GL_FOG_END = 0x0B64
Global Const $GL_FOG_MODE = 0x0B65
Global Const $GL_FOG_COLOR = 0x0B66
Global Const $GL_BLEND = 0x0BE2
Global Const $GL_FOG_HINT = 0x0C54
Global Const $GL_DONT_CARE = 0x1100
Global Const $GL_MODELVIEW = 0x1700
Global Const $GL_PROJECTION = 0x1701
Global Const $GL_LINEAR = 0x2601

; Some other constants
Global Const $PFD_TYPE_RGBA = 0
Global Const $PFD_MAIN_PLANE = 0
Global Const $PFD_DOUBLEBUFFER = 1
Global Const $PFD_DRAW_TO_WINDOW = 4
Global Const $PFD_SUPPORT_OPENGL = 32

; Number of stars
Global $iNumStars = 9999 ; for example

; Make a GUI
Global $iWidthGUI = 334

Global $iHeightGUI = 118
 Global $Form1 = GUICreate("[#]Zaman başlatma by @mesale0077[#]", $iWidthGUI, $iHeightGUI, -1, -1, $WS_OVERLAPPEDWINDOW)
$Label1 = GUICtrlCreateLabel("BEKLETME DK CİNSİ :", 8, 16, 112, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label2 = GUICtrlCreateLabel("SINAV SÜRE DK CİNSİ :", 8, 60, 120, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetLimit(-1, 2)
$Input2 = GUICtrlCreateInput("3", 192, 56, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
GUICtrlSetLimit(-1, 2)
$Input1 = GUICtrlCreateInput("1", 192, 16, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
$Button1 = GUICtrlCreateButton("BAŞLA", 256, 24, 57, 41, $WS_GROUP)
GUICtrlSetCursor (-1, 0)
$Label3 = GUICtrlCreateLabel("Hazırlayan: @mesale0077", 176, 88, 144, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
$exititem_1 = TrayCreateItem("SIFIRLA")
TrayItemSetOnEvent(-1, "Close")
$exititem = TrayCreateItem("ÇIKIŞ")
TrayItemSetOnEvent(-1, "Close")
$exititem_2 = TrayCreateItem("HAKKINDA")
TrayItemSetOnEvent(-1, "Close")

TraySetState()

GUISetState(@SW_SHOW)
; Black? Yes black.
GUISetBkColor(0)

; Device context and rendering context
Global $hDC, $hRC ; this two goes in _EnableOpenGL() ByRef

; Enabling OpenGL
If Not _EnableOpenGL($Form1, $hDC, $hRC) Then
    MsgBox(48, "Error", "Error initializing usage of OpenGL functions" & @CRLF & "Error code: " & @error) ; this is bad
    Exit
EndIf

; Initially cleaning buffers - this is almost redundant. wglMakeCurrent is to associate rendering context with the current thread
DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDC, "hwnd", $hRC)
_glClear(BitOR($GL_COLOR_BUFFER_BIT, $GL_DEPTH_BUFFER_BIT)) ; initially cleaning buffers in case something is left there


Global $tRandom = DllStructCreate("dword") ; this will hold generated random walues by RtlRandomEx function
Global $pRandom = DllStructGetPtr($tRandom)

Global $tFogColor = DllStructCreate("float[4]") ; fog color structure. Needed for _glFogfv function
DllStructSetData($tFogColor, 1, 1, 4) ; other two values are 0
Global $pFogColor = DllStructGetPtr($tFogColor)

Global $tStars = DllStructCreate("float[" & 3 * $iNumStars & "]") ; this structure holds coordinates for every star
Global $pStars = DllStructGetPtr($tStars)

Global $tInt = DllStructCreate("dword") ; this will dynamically hold the address of $tStars
DllStructSetData($tInt, 1, $pStars)
Global $pInt = DllStructGetPtr($tInt)

Global $tInt1 = DllStructCreate("int") ; this is placeholder for the integer used in assembly code in different places
Global $pInt1 = DllStructGetPtr($tInt1)

Global $tInt2 = DllStructCreate("int") ; this is placeholder for the float value of the same value. It's the main 'frequency'
DllStructSetData($tInt2, 1, 150)
Global $pInt2 = DllStructGetPtr($tInt2)

Global $tEndColor = DllStructCreate("float[3]") ; this structure holds ending color of each star (same value for all of them)
DllStructSetData($tEndColor, 1, 0.2, 3) ; other two values are 0
Global $pEndColor = DllStructGetPtr($tEndColor)

Global $tStartColor = DllStructCreate("float[3]") ; this structure holds start color for each star
DllStructSetData($tStartColor, 1, 0.5, 1) ; color crap=============================================================
DllStructSetData($tStartColor, 1, 0.9, 2) ; color crap=============================================================
DllStructSetData($tStartColor, 1, 0.9, 3) ; color crap=============================================================
Global $pStartColor = DllStructGetPtr($tStartColor)

Global $tZoffset = DllStructCreate("float") ; this is determining the tail of passing stars
DllStructSetData($tZoffset, 1, $tail) ; length of tail=============================================================
Global $pZoffset = DllStructGetPtr($tZoffset)

Global $tZincrement = DllStructCreate("float") ; I call this 'repetitive density value' ...or spead if you like
DllStructSetData($tZincrement, 1, $speed) ; 0.28
Global $pZincrement = DllStructGetPtr($tZincrement)

Global $tThreshold = DllStructCreate("float") ; this structure will hold a threshold value
DllStructSetData($tThreshold, 1, 5) ; value is 5 (star will be out of scope when 5 is reached)
Global $pThreshold = DllStructGetPtr($tThreshold)


; SwapBuffers to fully use double-buffering
Global $aSwapBuffers = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("gdi32.dll"), "str", "SwapBuffers")
Global $pSwapBuffers = $aSwapBuffers[0]

; glClear to clean buffers
Global $aglClear = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glClear")
Global $pglClear = $aglClear[0]

; glBegin to initialize drawing procedure
Global $aglBegin = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glBegin")
Global $pglBegin = $aglBegin[0]

; glEnd to end drawing procedure
Global $aglEnd = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glEnd")
Global $pglEnd = $aglEnd[0]

; $pwglMakeCurrent for rendering context
Global $awglMakeCurrent = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "wglMakeCurrent")
Global $pwglMakeCurrent = $awglMakeCurrent[0]

; RtlRandomEx for generating random integers
Global $aRtlRandomEx = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("ntdll.dll"), "str", "RtlRandomEx")
Global $pRtlRandomEx = $aRtlRandomEx[0]

; glVertex3fv for drawing
Global $aglVertex3fv = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glVertex3fv")
Global $pglVertex3fv = $aglVertex3fv[0]

; glColor3fv for color of lines
Global $aglColor3fv = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glColor3fv")
Global $pglColor3fv = $aglColor3fv[0]


; Allocating enough memory (512 bytes) with $PAGE_EXECUTE_READWRITE
Global $pRemoteCode = _MemVirtualAlloc(0, 512, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE)

; Standard allocation in reserved address (512 bytes again)
Global $tCodeBuffer = DllStructCreate("byte[512]", $pRemoteCode)


; Writing to it (this is setting initial values - coordinates for aech and every star)
DllStructSetData($tCodeBuffer, 1, _
        "0x" & _
        "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, $pInt
        "" & _
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
        "FFD0" & _                                                 ; call eax
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
        "F7F1" & _                                                 ; div ecx
        "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D95B" & Hex(0, 2) & _                                     ; fstp 32real[ebx+0d]
        "" & _
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
        "FFD0" & _                                                 ; call eax
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
        "F7F1" & _                                                 ; div ecx
        "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D95B" & Hex(4, 2) & _                                     ; fstp 32real[ebx+4d]
        "" & _
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
        "FFD0" & _                                                 ; call eax
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(14316558) & _                            ; mov ecx, 14316558d
        "F7F1" & _                                                 ; div ecx
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D9E0" & _                                                 ; fchs  ;<-  change sign of st(0)
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d]
        "" & _
        "81C3" & SwapEndian(12) & _                                ; add ebx, 12
        "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
        "75" & Hex(-124, 2) & _                                    ; jne -124 bytes ;<- go back 124 bytes if not equal
        "C3" _                                                     ; ret
        )

; Executing code
DllCall("user32.dll", "int", "CallWindowProcW", _
        "ptr", $pRemoteCode, _
        "int", 0, _
        "int", 0, _
        "int", 0, _
        "int", 0)


; Writing new code (will use the same buffer since the code from it is already executed)
DllStructSetData($tCodeBuffer, 1, _
        "0x" & _
        "" & _ ; >>>>>>>>>>>>>>>>>>>> GENERAL JOB <<<<<<<<<<<<<<<<<<<<<<<
        "" & _ ; 10. $hRC TO THIS THREAD (17 bytes code):
        "68" & SwapEndian($hRC) & _                                ; push $hRC
        "68" & SwapEndian($hDC) & _                                ; push $hDC
        "B8" & SwapEndian($pwglMakeCurrent) & _                    ; mov eax, wglMakeCurrent
        "FFD0" & _                                                 ; call eax ;<- calling function
        "" & _ ; 20. CLEAR BUFFERS (12 bytes code):
        "68" & SwapEndian(16640) & _                               ; push $GL_COLOR_BUFFER_BIT|$GL_DEPTH_BUFFER_BIT
        "B8" & SwapEndian($pglClear) & _                           ; mov eax, glClear
        "FFD0" & _                                                 ; call eax ;<- calling function
        "" & _ ; 30. WILL DRAW LINES - INITIALIZE LINES (12 bytes code):
        "68" & SwapEndian(1) & _                                   ; push $GL_LINES
        "B8" & SwapEndian($pglBegin) & _                           ; mov eax, glBegin
        "FFD0" & _                                                 ; call eax ;<- calling function
        "" & _ ; >>>>>>>>>>>>>>>>>>>> FIRST LOOP <<<<<<<<<<<<<<<<<<<<<<<
        "" & _ ; 40. INITIALIZE LOOP BY ASSIGNING INITIAL VALUE TO ebx (6 bytes code):
        "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, [$pInt] ;<- assigning ebx to address of $pStars (stored in $tInt)
        "" & _ ; 50. DETERMINING INITIAL COLOR (12 bytes code):
        "68" & SwapEndian($pStartColor) & _                        ; push $pStartColor ;<- this is float[3] with start color (r, g, b)
        "B8" & SwapEndian($pglColor3fv) & _                        ; mov eax, $pglColor3fv ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling glColor3fv function
        "" & _ ; 60. DETERMINING INITIAL POINT (8 bytes code):
        "53" & _                                                   ; push ebx ;<- this is float[3] with start coordinates (x, y, z)
        "B8" & SwapEndian($pglVertex3fv) & _                       ; mov eax, $pglVertex3fv ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling glVertex3fv function
        "" & _ ; 70. DETERMINING END COLOR (12 bytes code):
        "68" & SwapEndian($pEndColor) & _                          ; push $pEndColor ;<- this is float[3] with ending color (r, g, b)
        "B8" & SwapEndian($pglColor3fv) & _                        ; mov eax, $pglColor3fv
        "FFD0" & _                                                 ; call eax ;<- calling glColor3fv function
        "" & _ ; 80. DETERMINING END POINT (dislocate z coordinate by value of $tZoffset) (20 bytes code):
        "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
        "D825" & SwapEndian($pZoffset) & _                         ; fsub [$pZoffset] ; <- substract value stored in $tZoffset
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<- save changes and pop
        "53" & _                                                   ; push ebx ;<- this is float[3] with ending coordinates (x, y, z)
        "B8" & SwapEndian($pglVertex3fv) & _                       ; mov eax, $pglVertex3fv ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling glVertex3fv function
        "" & _ ; 90. RESTORE z COORDINATE (12 bytes code):
        "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
        "D805" & SwapEndian($pZoffset) & _                         ; fadd [$pZoffset] ;<- add value of $tZoffset
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<- save changes and pop
        "" & _ ; 100. ADD SIZE OF float[3] TO ebx (3 bytes code):
        "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
        "" & _ ; 110. COMPARE IT (6 bytes code):
        "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
        "" & _ ; 120. MAKE A CONDITION (2 bytes code):
        "73" & Hex(2, 2) & _                                       ; jnb 2d ;<- jump forward 2 bytes on not below; to <135>
        "" & _ ; 130. GO BACK (2 bytes code):
        "EB" & Hex(-77, 2) & _                                     ; jump -77d ;<- jump 77 bytes back otherwise; to <50>
        "" & _ ; >>>>>>>>>>>>>>>>>>>> GENERAL JOB <<<<<<<<<<<<<<<<<<<<<<<
        "" & _ ; 135. CALL glEnd FUNCTION (7 bytes code):
        "B8" & SwapEndian($pglEnd) & _                             ; mov eax, glEnd
        "FFD0" & _                                                 ; call eax ;<- calling glEnd
        "" & _ ; >>>>>>>>>>>>>>>>>>>> SECOND LOOP <<<<<<<<<<<<<<<<<<<<<<<
        "" & _ ; 140. INITIALIZING NEW LOOP (6 bytes code):
        "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, [$pInt] ;<- assigning ebx to address of $pStars (stored in $tInt)
        "" & _ ; 150. CHECK  THRESHOLD (12 bytes code):
        "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
        "D81D" & SwapEndian($pThreshold) & _                       ; fcomp [$pThreshold] ;<- compare st(0) to float at $tThreshold and pop
        "DFE0" & _                                                 ; fnstsw ax ; update ax register (this is essential for conditional jumps with floats)
        "9E" & _                                                   ; sahf ; copy ah register (same remark as above)
        "" & _ ; 160. MAKE A CONDITION (2 bytes code):
        "73" & Hex(25, 2) & _                                      ; jnb 25d ;<- jump 25 bytes forward on not below; to <220>
        "" & _ ; 170. 'MOVE' IT (12 bytes code):
        "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
        "D805" & SwapEndian($pZincrement) & _                      ; fadd [$pZincrement] ;<-  add (increment by) value of $tZincrement
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<-  save changes
        "" & _ ; 180. ADD SIZE OF float[3] TO ebx (3 bytes code):
        "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
        "" & _ ; 190. COMPARE IT (6 bytes code):
        "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
        "" & _ ; 200. MAKE A CONDITION (2 bytes code):
        "73" & Hex(103, 2) & _                                     ; jnb  103d ;<- jump forward 103 bytes on not below; to <290>
        "" & _ ; 210. GO BACK (2 bytes code):
        "EB" & Hex(-39, 2) & _                                     ; jump -39d ;<- jump 39 bytes back otherwise; to <150>
        "" & _ ; 220. GENERATE RANDOM INTEGER IN RANGE OF -25, 25 AND SAVE IT TO x COORDINATE FLOAT (37 bytes code):
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling RtlRandomEx function
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
        "F7F1" & _                                                 ; div ecx
        "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D95B" & Hex(0, 2) & _                                     ; fstp 32real[ebx+0d]
        "" & _ ; 230. GENERATE RANDOM INTEGER IN RANGE OF -25, 25 AND SAVE IT TO y COORDINATE FLOAT (37 bytes code):
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom ;<-
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling RtlRandomEx
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(42949673) & _                            ; mov ecx, 4294967d
        "F7F1" & _                                                 ; div ecx
        "83E8" & Hex(25, 2) & _                                    ; sub eax, 250d
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D95B" & Hex(4, 2) & _                                     ; fstp 32real[ebx+4d]
        "" & _ ; 240. SET z COORDINATE to -150 FLOAT VALUE (11 bytes code):
        "DB05" & SwapEndian($pInt2) & _                            ; fild $pInt2
        "D9E0" & _                                                 ; fchs  ;<-  change sign of st(0)
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<-  save it to proper location
        "" & _ ; 250. ADD SIZE OF float[3] TO ebx (3 bytes code):
        "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
        "" & _ ; 260. COMPARE IT (6 bytes code):
        "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
        "" & _ ; 270. MAKE A CONDITION (2 bytes code):
        "73" & Hex(5, 2) & _                                       ; jnb  5d ;<- jump forward 5 bytes on not below; to <290>
        "" & _ ; 280. GO BACK (5 bytes code):
        "E9" & SwapEndian(-140) & _                                ; jump -140d ;<- jump 140 bytes back otherwise; to <150>
        "" & _ ; 290. CALL SwapBuffers function (12 bytes code):
        "68" & SwapEndian($hDC) & _                                ; push $hDC
        "B8" & SwapEndian($pSwapBuffers) & _                       ; mov eax, SwapBuffers
        "FFD0" & _                                                 ; call eax ;<- calling SwapBuffers
        "" & _ ; 300. RETURN (1 byte code):
        "C3" _                                                    ; ret
        )


; associate contexts with the current thread
DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDC, "hwnd", $hRC)

;Initializing gl environment
_glClearColor(0, 0, 0, 1) ; we said black
_glFogi($GL_FOG_MODE, $GL_LINEAR)
_glFogfv($GL_FOG_COLOR, $pFogColor)
_glFogf($GL_FOG_DENSITY, 0.1)
_glHint($GL_FOG_HINT, $GL_DONT_CARE)
_glFogf($GL_FOG_START, 70)
_glFogf($GL_FOG_END, 150)
_glEnable($GL_FOG)
_glBlendFunc($GL_SRC_COLOR, $GL_DST_COLOR)
_glEnable($GL_BLEND)

; Initially put things in place (literally)
_glLoadIdentity()
_glViewport(0, 0, $iWidthGUI, $iHeightGUI)
_glMatrixMode($GL_PROJECTION)
_glLoadIdentity()
Global $nRatio = $iWidthGUI / $iHeightGUI
_glFrustum(-$nRatio * 0.75, $nRatio * 0.75, -0.75, 0.75, 6, 150)
_glMatrixMode($GL_MODELVIEW)


; Installing function to do the refreshment
GUIRegisterMsg(133, "_Preserve") ; WM_NCPAINT

; Installing function to do handle resizing
GUIRegisterMsg(5, "_ResizeGL") ; WM_SIZE

; Handling things on Exit
;GUISetOnEvent(-3, "_Quit") ; $GUI_EVENT_CLOSE

; Show GUI
GUISetState(@SW_SHOW, $Form1)


; Loop till the end
While 1

    _GLDraw()
    Sleep(20)
$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            ;_BlockInputEx(0)
            TrayBoxCreate("", "HAZIRLAYAN:"&@CRLF&"@mesale0077"&@CRLF&"Bilgi:"&@CRLF&"İlginiz için teşekkürler")
            Exit
CASE $Button1
GUISetState(@SW_HIDE, $Form1)

        r1()
    EndSwitch
WEnd


EndFunc

Func Close_skin()

ToolTip("")



; Make a GUI
; Make a GUI
Global $iWidthGUI = @DesktopWidth
Global $iHeightGUI = @DesktopHeight

Global $hGUI = GUICreate("OpenGL Space", $iWidthGUI, $iHeightGUI, 0, 0, $WS_POPUP, $WS_EX_TOPMOST)
$Label1121 = GUICtrlCreateLabel("SÜRE BİTTİ !", (@DesktopWidth/2)-100, (@DesktopHeight/2)-100, 207, 41, $SS_CENTER)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)

    sleep(500)
        $Button2123 = GUICtrlCreateLabel("ÇIKIŞ", (@DesktopWidth/2)-50, (@DesktopHeight/2)-30, 92, 25, BitOR($SS_CENTER,$WS_BORDER), $WS_EX_CLIENTEDGE)
GUICtrlSetCursor (-1, 0)
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label3 = GUICtrlCreateLabel("Hazırlayan: @mesale0077", (@DesktopWidth/2)-75, (@DesktopHeight/2) ,144, 17, $SS_CENTER)

GUICtrlSetColor(-1, 0xFFFFFF)
; Black? Yes black.
GUISetBkColor(0)

; Device context and rendering context
Global $hDC, $hRC ; this two goes in _EnableOpenGL() ByRef

; Enabling OpenGL
If Not _EnableOpenGL($hGUI, $hDC, $hRC) Then
    MsgBox(48, "Error", "Error initializing usage of OpenGL functions" & @CRLF & "Error code: " & @error) ; this is bad
    Exit
EndIf

; Initially cleaning buffers - this is almost redundant. wglMakeCurrent is to associate rendering context with the current thread
DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDC, "hwnd", $hRC)
_glClear(BitOR($GL_COLOR_BUFFER_BIT, $GL_DEPTH_BUFFER_BIT)) ; initially cleaning buffers in case something is left there


Global $tRandom = DllStructCreate("dword") ; this will hold generated random walues by RtlRandomEx function
Global $pRandom = DllStructGetPtr($tRandom)

Global $tFogColor = DllStructCreate("float[4]") ; fog color structure. Needed for _glFogfv function
DllStructSetData($tFogColor, 1, 1, 4) ; other two values are 0
Global $pFogColor = DllStructGetPtr($tFogColor)

Global $tStars = DllStructCreate("float[" & 3 * $iNumStars & "]") ; this structure holds coordinates for every star
Global $pStars = DllStructGetPtr($tStars)

Global $tInt = DllStructCreate("dword") ; this will dynamically hold the address of $tStars
DllStructSetData($tInt, 1, $pStars)
Global $pInt = DllStructGetPtr($tInt)

Global $tInt1 = DllStructCreate("int") ; this is placeholder for the integer used in assembly code in different places
Global $pInt1 = DllStructGetPtr($tInt1)

Global $tInt2 = DllStructCreate("int") ; this is placeholder for the float value of the same value. It's the main 'frequency'
DllStructSetData($tInt2, 1, 150)
Global $pInt2 = DllStructGetPtr($tInt2)

Global $tEndColor = DllStructCreate("float[3]") ; this structure holds ending color of each star (same value for all of them)
DllStructSetData($tEndColor, 1, 0.2, 3) ; other two values are 0
Global $pEndColor = DllStructGetPtr($tEndColor)

Global $tStartColor = DllStructCreate("float[3]") ; this structure holds start color for each star
DllStructSetData($tStartColor, 1, 0.5, 1) ; color crap=============================================================
DllStructSetData($tStartColor, 1, 0.9, 2) ; color crap=============================================================
DllStructSetData($tStartColor, 1, 0.9, 3) ; color crap=============================================================
Global $pStartColor = DllStructGetPtr($tStartColor)

Global $tZoffset = DllStructCreate("float") ; this is determining the tail of passing stars
DllStructSetData($tZoffset, 1, $tail) ; length of tail=============================================================
Global $pZoffset = DllStructGetPtr($tZoffset)

Global $tZincrement = DllStructCreate("float") ; I call this 'repetitive density value' ...or spead if you like
DllStructSetData($tZincrement, 1, $speed) ; 0.28
Global $pZincrement = DllStructGetPtr($tZincrement)

Global $tThreshold = DllStructCreate("float") ; this structure will hold a threshold value
DllStructSetData($tThreshold, 1, 5) ; value is 5 (star will be out of scope when 5 is reached)
Global $pThreshold = DllStructGetPtr($tThreshold)


; SwapBuffers to fully use double-buffering
Global $aSwapBuffers = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("gdi32.dll"), "str", "SwapBuffers")
Global $pSwapBuffers = $aSwapBuffers[0]

; glClear to clean buffers
Global $aglClear = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glClear")
Global $pglClear = $aglClear[0]

; glBegin to initialize drawing procedure
Global $aglBegin = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glBegin")
Global $pglBegin = $aglBegin[0]

; glEnd to end drawing procedure
Global $aglEnd = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glEnd")
Global $pglEnd = $aglEnd[0]

; $pwglMakeCurrent for rendering context
Global $awglMakeCurrent = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "wglMakeCurrent")
Global $pwglMakeCurrent = $awglMakeCurrent[0]

; RtlRandomEx for generating random integers
Global $aRtlRandomEx = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("ntdll.dll"), "str", "RtlRandomEx")
Global $pRtlRandomEx = $aRtlRandomEx[0]

; glVertex3fv for drawing
Global $aglVertex3fv = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glVertex3fv")
Global $pglVertex3fv = $aglVertex3fv[0]

; glColor3fv for color of lines
Global $aglColor3fv = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glColor3fv")
Global $pglColor3fv = $aglColor3fv[0]


; Allocating enough memory (512 bytes) with $PAGE_EXECUTE_READWRITE
Global $pRemoteCode = _MemVirtualAlloc(0, 512, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE)

; Standard allocation in reserved address (512 bytes again)
Global $tCodeBuffer = DllStructCreate("byte[512]", $pRemoteCode)


; Writing to it (this is setting initial values - coordinates for aech and every star)
DllStructSetData($tCodeBuffer, 1, _
        "0x" & _
        "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, $pInt
        "" & _
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
        "FFD0" & _                                                 ; call eax
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
        "F7F1" & _                                                 ; div ecx
        "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D95B" & Hex(0, 2) & _                                     ; fstp 32real[ebx+0d]
        "" & _
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
        "FFD0" & _                                                 ; call eax
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
        "F7F1" & _                                                 ; div ecx
        "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D95B" & Hex(4, 2) & _                                     ; fstp 32real[ebx+4d]
        "" & _
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
        "FFD0" & _                                                 ; call eax
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(14316558) & _                            ; mov ecx, 14316558d
        "F7F1" & _                                                 ; div ecx
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D9E0" & _                                                 ; fchs  ;<-  change sign of st(0)
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d]
        "" & _
        "81C3" & SwapEndian(12) & _                                ; add ebx, 12
        "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
        "75" & Hex(-124, 2) & _                                    ; jne -124 bytes ;<- go back 124 bytes if not equal
        "C3" _                                                     ; ret
        )

; Executing code
DllCall("user32.dll", "int", "CallWindowProcW", _
        "ptr", $pRemoteCode, _
        "int", 0, _
        "int", 0, _
        "int", 0, _
        "int", 0)


; Writing new code (will use the same buffer since the code from it is already executed)
DllStructSetData($tCodeBuffer, 1, _
        "0x" & _
        "" & _ ; >>>>>>>>>>>>>>>>>>>> GENERAL JOB <<<<<<<<<<<<<<<<<<<<<<<
        "" & _ ; 10. $hRC TO THIS THREAD (17 bytes code):
        "68" & SwapEndian($hRC) & _                                ; push $hRC
        "68" & SwapEndian($hDC) & _                                ; push $hDC
        "B8" & SwapEndian($pwglMakeCurrent) & _                    ; mov eax, wglMakeCurrent
        "FFD0" & _                                                 ; call eax ;<- calling function
        "" & _ ; 20. CLEAR BUFFERS (12 bytes code):
        "68" & SwapEndian(16640) & _                               ; push $GL_COLOR_BUFFER_BIT|$GL_DEPTH_BUFFER_BIT
        "B8" & SwapEndian($pglClear) & _                           ; mov eax, glClear
        "FFD0" & _                                                 ; call eax ;<- calling function
        "" & _ ; 30. WILL DRAW LINES - INITIALIZE LINES (12 bytes code):
        "68" & SwapEndian(1) & _                                   ; push $GL_LINES
        "B8" & SwapEndian($pglBegin) & _                           ; mov eax, glBegin
        "FFD0" & _                                                 ; call eax ;<- calling function
        "" & _ ; >>>>>>>>>>>>>>>>>>>> FIRST LOOP <<<<<<<<<<<<<<<<<<<<<<<
        "" & _ ; 40. INITIALIZE LOOP BY ASSIGNING INITIAL VALUE TO ebx (6 bytes code):
        "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, [$pInt] ;<- assigning ebx to address of $pStars (stored in $tInt)
        "" & _ ; 50. DETERMINING INITIAL COLOR (12 bytes code):
        "68" & SwapEndian($pStartColor) & _                        ; push $pStartColor ;<- this is float[3] with start color (r, g, b)
        "B8" & SwapEndian($pglColor3fv) & _                        ; mov eax, $pglColor3fv ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling glColor3fv function
        "" & _ ; 60. DETERMINING INITIAL POINT (8 bytes code):
        "53" & _                                                   ; push ebx ;<- this is float[3] with start coordinates (x, y, z)
        "B8" & SwapEndian($pglVertex3fv) & _                       ; mov eax, $pglVertex3fv ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling glVertex3fv function
        "" & _ ; 70. DETERMINING END COLOR (12 bytes code):
        "68" & SwapEndian($pEndColor) & _                          ; push $pEndColor ;<- this is float[3] with ending color (r, g, b)
        "B8" & SwapEndian($pglColor3fv) & _                        ; mov eax, $pglColor3fv
        "FFD0" & _                                                 ; call eax ;<- calling glColor3fv function
        "" & _ ; 80. DETERMINING END POINT (dislocate z coordinate by value of $tZoffset) (20 bytes code):
        "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
        "D825" & SwapEndian($pZoffset) & _                         ; fsub [$pZoffset] ; <- substract value stored in $tZoffset
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<- save changes and pop
        "53" & _                                                   ; push ebx ;<- this is float[3] with ending coordinates (x, y, z)
        "B8" & SwapEndian($pglVertex3fv) & _                       ; mov eax, $pglVertex3fv ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling glVertex3fv function
        "" & _ ; 90. RESTORE z COORDINATE (12 bytes code):
        "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
        "D805" & SwapEndian($pZoffset) & _                         ; fadd [$pZoffset] ;<- add value of $tZoffset
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<- save changes and pop
        "" & _ ; 100. ADD SIZE OF float[3] TO ebx (3 bytes code):
        "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
        "" & _ ; 110. COMPARE IT (6 bytes code):
        "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
        "" & _ ; 120. MAKE A CONDITION (2 bytes code):
        "73" & Hex(2, 2) & _                                       ; jnb 2d ;<- jump forward 2 bytes on not below; to <135>
        "" & _ ; 130. GO BACK (2 bytes code):
        "EB" & Hex(-77, 2) & _                                     ; jump -77d ;<- jump 77 bytes back otherwise; to <50>
        "" & _ ; >>>>>>>>>>>>>>>>>>>> GENERAL JOB <<<<<<<<<<<<<<<<<<<<<<<
        "" & _ ; 135. CALL glEnd FUNCTION (7 bytes code):
        "B8" & SwapEndian($pglEnd) & _                             ; mov eax, glEnd
        "FFD0" & _                                                 ; call eax ;<- calling glEnd
        "" & _ ; >>>>>>>>>>>>>>>>>>>> SECOND LOOP <<<<<<<<<<<<<<<<<<<<<<<
        "" & _ ; 140. INITIALIZING NEW LOOP (6 bytes code):
        "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, [$pInt] ;<- assigning ebx to address of $pStars (stored in $tInt)
        "" & _ ; 150. CHECK  THRESHOLD (12 bytes code):
        "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
        "D81D" & SwapEndian($pThreshold) & _                       ; fcomp [$pThreshold] ;<- compare st(0) to float at $tThreshold and pop
        "DFE0" & _                                                 ; fnstsw ax ; update ax register (this is essential for conditional jumps with floats)
        "9E" & _                                                   ; sahf ; copy ah register (same remark as above)
        "" & _ ; 160. MAKE A CONDITION (2 bytes code):
        "73" & Hex(25, 2) & _                                      ; jnb 25d ;<- jump 25 bytes forward on not below; to <220>
        "" & _ ; 170. 'MOVE' IT (12 bytes code):
        "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
        "D805" & SwapEndian($pZincrement) & _                      ; fadd [$pZincrement] ;<-  add (increment by) value of $tZincrement
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<-  save changes
        "" & _ ; 180. ADD SIZE OF float[3] TO ebx (3 bytes code):
        "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
        "" & _ ; 190. COMPARE IT (6 bytes code):
        "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
        "" & _ ; 200. MAKE A CONDITION (2 bytes code):
        "73" & Hex(103, 2) & _                                     ; jnb  103d ;<- jump forward 103 bytes on not below; to <290>
        "" & _ ; 210. GO BACK (2 bytes code):
        "EB" & Hex(-39, 2) & _                                     ; jump -39d ;<- jump 39 bytes back otherwise; to <150>
        "" & _ ; 220. GENERATE RANDOM INTEGER IN RANGE OF -25, 25 AND SAVE IT TO x COORDINATE FLOAT (37 bytes code):
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling RtlRandomEx function
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
        "F7F1" & _                                                 ; div ecx
        "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D95B" & Hex(0, 2) & _                                     ; fstp 32real[ebx+0d]
        "" & _ ; 230. GENERATE RANDOM INTEGER IN RANGE OF -25, 25 AND SAVE IT TO y COORDINATE FLOAT (37 bytes code):
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom ;<-
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling RtlRandomEx
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(42949673) & _                            ; mov ecx, 4294967d
        "F7F1" & _                                                 ; div ecx
        "83E8" & Hex(25, 2) & _                                    ; sub eax, 250d
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D95B" & Hex(4, 2) & _                                     ; fstp 32real[ebx+4d]
        "" & _ ; 240. SET z COORDINATE to -150 FLOAT VALUE (11 bytes code):
        "DB05" & SwapEndian($pInt2) & _                            ; fild $pInt2
        "D9E0" & _                                                 ; fchs  ;<-  change sign of st(0)
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<-  save it to proper location
        "" & _ ; 250. ADD SIZE OF float[3] TO ebx (3 bytes code):
        "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
        "" & _ ; 260. COMPARE IT (6 bytes code):
        "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
        "" & _ ; 270. MAKE A CONDITION (2 bytes code):
        "73" & Hex(5, 2) & _                                       ; jnb  5d ;<- jump forward 5 bytes on not below; to <290>
        "" & _ ; 280. GO BACK (5 bytes code):
        "E9" & SwapEndian(-140) & _                                ; jump -140d ;<- jump 140 bytes back otherwise; to <150>
        "" & _ ; 290. CALL SwapBuffers function (12 bytes code):
        "68" & SwapEndian($hDC) & _                                ; push $hDC
        "B8" & SwapEndian($pSwapBuffers) & _                       ; mov eax, SwapBuffers
        "FFD0" & _                                                 ; call eax ;<- calling SwapBuffers
        "" & _ ; 300. RETURN (1 byte code):
        "C3" _                                                    ; ret
        )


; associate contexts with the current thread
DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDC, "hwnd", $hRC)

;Initializing gl environment
_glClearColor(0, 0, 0, 1) ; we said black
_glFogi($GL_FOG_MODE, $GL_LINEAR)
_glFogfv($GL_FOG_COLOR, $pFogColor)
_glFogf($GL_FOG_DENSITY, 0.1)
_glHint($GL_FOG_HINT, $GL_DONT_CARE)
_glFogf($GL_FOG_START, 70)
_glFogf($GL_FOG_END, 150)
_glEnable($GL_FOG)
_glBlendFunc($GL_SRC_COLOR, $GL_DST_COLOR)
_glEnable($GL_BLEND)

; Initially put things in place (literally)
_glLoadIdentity()
_glViewport(0, 0, $iWidthGUI, $iHeightGUI)
_glMatrixMode($GL_PROJECTION)
_glLoadIdentity()
Global $nRatio = $iWidthGUI / $iHeightGUI
_glFrustum(-$nRatio * 0.75, $nRatio * 0.75, -0.75, 0.75, 6, 150)
_glMatrixMode($GL_MODELVIEW)


; Installing function to do the refreshment
GUIRegisterMsg(133, "_Preserve") ; WM_NCPAINT

; Installing function to do handle resizing
GUIRegisterMsg(5, "_ResizeGL") ; WM_SIZE

; Handling things on Exit
;GUISetOnEvent(-3, "_Quit") ; $GUI_EVENT_CLOSE
MouseMove((@DesktopWidth/2)-35, (@DesktopHeight/2)-20)
; Show GUI
GUISetState(@SW_SHOW, $hGUI)


; Loop till the end
;While 1

    ;_GLDraw()
    ;Sleep(20)

;WEnd

While 1

If ProcessExists('Taskmgr.exe') Then
       ProcessClose('Taskmgr.exe')
        ;GUISetState()
    Endif
_GLDraw()
    Sleep(20)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        ;Case $GUI_EVENT_CLOSE
        ;_Quit()
CASE $Button2123
    GuiCtrlSetData($Button2123, "çıkış")
        sleep(200)

        GuiCtrlSetData($Button2123, "ÇIKIŞ")
        ;_BlockInputEx(0)


_Quit()
    EndSwitch
WEnd


endfunc
func r1()
local $eieie = GUICtrlRead($Input1)
$start_1 = @HOUR & ":" & @MIN + $eieie
if @MIN + GUICtrlRead($Input1)< 10 then
 $start_1 = @HOUR & ":0" & @MIN + $eieie
endif
While 1
 $start2 = @HOUR & ":" & @MIN
  ToolTip(" "  ,@DesktopWidth - 220, @DesktopHeight - 120,"Bilgi: " &GUICtrlRead($Input1)& " dakika sonra başlayacak", 1)
If $start_1 = $start2   then
Beep(300,500)
    rr1()



   endif
WEnd
endfunc
func rr1()
Beep(300,500)
r2()


endfunc



func r2()

Global $start =  @HOUR & ":" & @MIN
Global $Minutes = GUICtrlRead($Input2) ; will wait 90 minutes

Global $60Count = 0, $begin = TimerInit()
While 1
$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        TrayBoxCreate("", "HAZIRLAYAN:"&@CRLF&"@mesale0077"&@CRLF&"Bilgi:"&@CRLF&"İlginiz için teşekkürler")
            Exit


    EndSwitch


  if $Minutes > $60Count then

    $dif = TimerDiff($begin)
    $dif2 = StringLeft($dif, StringInStr($dif, ".") -1)
    $Count = int($dif/1000)
    $60Count = Int($Count / 60)

    ;ToolTip("Minutes Required = " & $Minutes & @CRLF & "Minutes Past = " & $60Count & @CRLF & "Seconds Count = " & $Count & @CRLF & "Mili-Seconds Count = " & $dif2, 20, 20, "Time Machine #1", 1)
      ; TrayTip("Bilgi: 2.Reklamı gösterecek", "Başlama dakikası = " & $Minutes & @CRLF & "Geçen dakika = " & $60Count & @CRLF & "Geçen saniye = " & $Count ,"",1)

       ToolTip("Başlama saati = " & $start& @CRLF & "Şimdiki saat = " &@HOUR & ":" & @MIN& @CRLF & "Geçen dakika = " & $60Count ,@DesktopWidth - 220, @DesktopHeight - 120,"Bilgi: " &GUICtrlRead($Input2)& " dakika sonra bitecek", 1)

   else

  rr2()
   endif
WEnd
endfunc
func rr2()

 Beep(300,500)
;_DisableOpenGL($Form1, $hDC, $hRC)

 ToolTip("")

 Close_skin()


endfunc

Func Close()

        Select

Case @TRAY_ID = $exititem_2

        TrayBoxCreate("", "HAZIRLAYAN:"&@CRLF&"@mesale0077"&@CRLF&"Bilgi:"&@CRLF&"İlginiz için teşekkürler")
     Case @TRAY_ID = $exititem_1
    ;ScriptRestart()
    _DisableOpenGL($Form1 , $hDC, $hRC)
        _Self_Restart(1)
            Case @TRAY_ID = $exititem
                    ToolTip("")
#cs                     #NoTrayIcon
        Opt("TrayIconHide", 1)

    TrayBoxCreate("", "HAZIRLAYAN:"&@CRLF&"@mesale0077"&@CRLF&"Bilgi:"&@CRLF&"İlginiz için teşekkürler")
    #ce
TrayBoxCreate("", "HAZIRLAYAN:"&@CRLF&"@mesale0077"&@CRLF&"Bilgi:"&@CRLF&"İlginiz için teşekkürler")

            exit


        EndSelect

EndFunc
Func TrayBoxCreate($TBTitle, $TBText, $display_Time = 2500)
$TBgui = GUICreate($TBTitle,250, 100, @DesktopWidth - 300, @DesktopHeight - 150,$WS_POPUP,$WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
_GuiRoundCorners($TBgui, 0, 0, 100, 100)
GUISetBkColor(0x0000FF)
$Status = GUICtrlCreateLabel($TBText, 40,20, 210, 100)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00040008);slide-in from bottom

GUISetState()
Sleep($display_Time)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1500, "long", 0x00040008);slide-in from bottom
GUISetState(@SW_SHOW, $TBgui)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBGui, "int", 1000, "long", 0x00050010);implode
GUISetState(@SW_HIDE, $TBgui)

EndFunc


Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
   Dim $pos, $ret, $ret2
   $pos = WinGetPos($h_win)
    $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long",  $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3,  "long", $i_y3)
   If $ret[0] Then
      $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
      If $ret2[0] Then
         Return 1
      Else
         Return 0
      EndIf
   Else
      Return 0
   EndIf
EndFunc
#cs
Func ScriptRestart()
    ;BySpenger120
    Switch @Compiled
        Case True
            Run(@ScriptFullPath)
        Case False
            ShellExecute(@AutoItExe,@ScriptFullPath)
    EndSwitch
    Exit
EndFunc   ;==>ScriptRestart
#ce

Func _Self_Restart($iTime)
    Run(@ComSpec & ' /c Ping -n ' & $iTime & ' localhost > nul & "' & @ScriptFullPath & '" /CmdLineRun', @ScriptDir, @SW_HIDE)
    Exit
EndFunc


; USED FUNCTIONS:

Func _GLDraw()

    DllCall("user32.dll", "int", "CallWindowProcW", _
            "ptr", $pRemoteCode, _
            "int", 0, _
            "int", 0, _
            "int", 0, _
            "int", 0)

EndFunc   ;==>_GLDraw


Func SwapEndian($iValue)
    Return Hex(BinaryMid($iValue, 1, 4))
EndFunc   ;==>SwapEndian


Func _EnableOpenGL($hWnd, ByRef $hDeviceContext, ByRef $hOpenGLRenderingContext)

    Local $tPIXELFORMATDESCRIPTOR = DllStructCreate("ushort Size;" & _
            "ushort Version;" & _
            "dword Flags;" & _
            "ubyte PixelType;" & _
            "ubyte ColorBits;" & _
            "ubyte RedBits;" & _
            "ubyte RedShift;" & _
            "ubyte GreenBits;" & _
            "ubyte GreenShift;" & _
            "ubyte BlueBits;" & _
            "ubyte BlueShift;" & _
            "ubyte AlphaBits;" & _
            "ubyte AlphaShift;" & _
            "ubyte AccumBits;" & _
            "ubyte AccumRedBits;" & _
            "ubyte AccumGreenBits;" & _
            "ubyte AccumBlueBits;" & _
            "ubyte AccumAlphaBits;" & _
            "ubyte DepthBits;" & _
            "ubyte StencilBits;" & _
            "ubyte AuxBuffers;" & _
            "ubyte LayerType;" & _
            "ubyte Reserved;" & _
            "dword LayerMask;" & _
            "dword VisibleMask;" & _
            "dword DamageMask")

    DllStructSetData($tPIXELFORMATDESCRIPTOR, "Size", DllStructGetSize($tPIXELFORMATDESCRIPTOR))
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "Version", $GL_VERSION_1_1)
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "Flags", BitOR($PFD_DRAW_TO_WINDOW, $PFD_SUPPORT_OPENGL, $PFD_DOUBLEBUFFER))
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "PixelType", $PFD_TYPE_RGBA)
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "ColorBits", 24)
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "DepthBits", 32)
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "LayerType", $PFD_MAIN_PLANE)

    Local $a_hCall = DllCall("kernel32.dll", "hwnd", "GetModuleHandleW", "wstr", "opengl32.dll")
    If @error Then
        Return SetError(1, 0, 0) ; what???
    EndIf

    If Not $a_hCall[0] Then
        If DllOpen("opengl32.dll") = -1 Then
            Return SetError(2, 0, 0) ; could not open opengl32.dll
        EndIf
    EndIf

    $a_hCall = DllCall("user32.dll", "hwnd", "GetDC", "hwnd", $hWnd)

    If @error Or Not $a_hCall[0] Then
        Return SetError(3, 0, 0) ; could not retrieve a handle to a device context
    EndIf

    $hDeviceContext = $a_hCall[0]

    Local $a_iCall = DllCall("gdi32.dll", "int", "ChoosePixelFormat", "hwnd", $hDeviceContext, "ptr", DllStructGetPtr($tPIXELFORMATDESCRIPTOR))
    If @error Or Not $a_iCall[0] Then
        Return SetError(4, 0, 0) ; could not match an appropriate pixel format
    EndIf
    Local $iFormat = $a_iCall[0]

    $a_iCall = DllCall("gdi32.dll", "int", "SetPixelFormat", "hwnd", $hDeviceContext, "int", $iFormat, "ptr", DllStructGetPtr($tPIXELFORMATDESCRIPTOR))
    If @error Or Not $a_iCall[0] Then
        Return SetError(5, 0, 0) ; could not set the pixel format of the specified device context to the specified format
    EndIf

    $a_hCall = DllCall("opengl32.dll", "hwnd", "wglCreateContext", "hwnd", $hDeviceContext)
    If @error Or Not $a_hCall[0] Then
        Return SetError(6, 0, 0) ; could not create a rendering context
    EndIf

    $hOpenGLRenderingContext = $a_hCall[0]

    Return SetError(0, 0, 1) ; all OK!

EndFunc   ;==>_EnableOpenGL


Func _DisableOpenGL($hWnd, $hDeviceContext, $hOpenGLRenderingContext)

    ; No point in doing error checking if this is done on exit. Will just call the cleaning functions.

    DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", 0, "hwnd", 0)
    DllCall("opengl32.dll", "int", "wglDeleteContext", "hwnd", $hOpenGLRenderingContext)
    DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hWnd, "hwnd", $hDeviceContext)

EndFunc   ;==>_DisableOpenGL


Func _ResizeGL($hWnd, $iMsg, $wParam, $lParam)

    ; dealing with AU3Check.exe
    #forceref $hWnd, $iMsg, $wParam

    ; associate contexts with the current thread
    DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDC, "hwnd", $hRC)

    ; determine the size of our window
    Local $aClientSize[2] = [BitAND($lParam, 65535), BitShift($lParam, 16)] ; window dimension

    ; process changes... adopt to them
    _glLoadIdentity()
    _glViewport(0, 0, $aClientSize[0], $aClientSize[1])
    _glMatrixMode($GL_PROJECTION)
    _glLoadIdentity()
    Local $nRatio = $aClientSize[0] / $aClientSize[1]
    _glFrustum(-$nRatio * .75, $nRatio * .75, -.75, .75, 6.0, 150.0)
    _glMatrixMode($GL_MODELVIEW)

EndFunc   ;==>_ResizeGL


Func _glBegin($iMode)
    DllCall("opengl32.dll", "none", "glBegin", "dword", $iMode)
EndFunc   ;==>_glBegin


Func _glBlendFunc($iSfactor, $iDfactor)
    DllCall("opengl32.dll", "none", "glBlendFunc", "dword", $iSfactor, "dword", $iDfactor)
EndFunc   ;==>_glBlendFunc


Func _glColor3fv($pColorFloat)
    DllCall("opengl32.dll", "none", "glColor3fv", "ptr", $pColorFloat)
EndFunc   ;==>_glColor3fv


Func _glClear($iMask)
    DllCall("opengl32.dll", "none", "glClear", "dword", $iMask)
EndFunc   ;==>_glClear


Func _glClearColor($nRed, $nGreen, $nBlue, $nAlpha)
    DllCall("opengl32.dll", "none", "glClearColor", "float", $nRed, "float", $nGreen, "float", $nBlue, "float", $nAlpha)
EndFunc   ;==>_glClearColor


Func _glEnable($iCap)
    DllCall("opengl32.dll", "none", "glEnable", "dword", $iCap)
EndFunc   ;==>_glEnable


Func _glEnd()
    DllCall("opengl32.dll", "none", "glEnd")
EndFunc   ;==>_glEnd


Func _glFrustum($nLeft, $nRight, $nBottom, $nTop, $nZNear, $nZFar)
    DllCall("opengl32.dll", "none", "glFrustum", "double", $nLeft, "double", $nRight, "double", $nBottom, "double", $nTop, "double", $nZNear, "double", $nZFar)
EndFunc   ;==>_glFrustum


Func _glFogf($iName, $nParam)
    DllCall("opengl32.dll", "none", "glFogf", "dword", $iName, "float", $nParam)
EndFunc   ;==>_glFogf


Func _glFogi($iName, $iParam)
    DllCall("opengl32.dll", "none", "glFogi", "dword", $iName, "dword", $iParam)
EndFunc   ;==>_glFogi


Func _glFogfv($iName, $pParams)
    DllCall("opengl32.dll", "none", "glFogfv", "dword", $iName, "ptr", $pParams)
EndFunc   ;==>_glFogfv


Func _glHint($iTarget, $iMode)
    DllCall("opengl32.dll", "none", "glHint", "dword", $iTarget, "dword", $iMode)
EndFunc   ;==>_glHint


Func _glLoadIdentity()
    DllCall("opengl32.dll", "none", "glLoadIdentity")
EndFunc   ;==>_glLoadIdentity


Func _glMatrixMode($iMode)
    DllCall("opengl32.dll", "none", "glMatrixMode", "dword", $iMode)
EndFunc   ;==>_glMatrixMode


Func _glViewport($iX, $iY, $iWidth, $iHeight)
    DllCall("opengl32.dll", "none", "glViewport", "int", $iX, "int", $iY, "dword", $iWidth, "dword", $iHeight)
EndFunc   ;==>_glViewport


Func _glVertex3fv($pPointer)
    DllCall("opengl32.dll", "none", "glVertex3fv", "ptr", $pPointer)
EndFunc   ;==>_glVertex3fv


Func _SwapBuffers($hDC)
    DllCall("gdi32.dll", "int", "SwapBuffers", "hwnd", $hDC)
EndFunc   ;==>_SwapBuffers



Func _Preserve()
    _SwapBuffers($hDC)
EndFunc   ;==>_Preserve


Func _Quit()
    _DisableOpenGL($hGUI, $hDC, $hRC)
        _Self_Restart(1)
    ;Exit
EndFunc   ;==>_Quit

GUIConstants show error

xp worked but dont work w7  w8?

and tooltip te chills why?

autoit version 3.3.10,2

Edited by mesale0077

Share this post


Link to post
Share on other sites
water

GUIConstants show error

Which error message do you get?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
mesale0077

sorry

GUIConstants dont show

Share this post


Link to post
Share on other sites
water

Sorry, I still don't get it: What do you mean by "dont show"?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
water

By the way:

You include this files two times:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
mesale0077

_GLDraw() enable but

dont show

Global $Form1 = GUICreate("[#]Zaman başlatma by @mesale0077[#]", $iWidthGUI, $iHeightGUI, -1, -1, $WS_OVERLAPPEDWINDOW)
$Label1 = GUICtrlCreateLabel("BEKLETME DK CİNSİ :", 8, 16, 112, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label2 = GUICtrlCreateLabel("SINAV SÜRE DK CİNSİ :", 8, 60, 120, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetLimit(-1, 2)
$Input2 = GUICtrlCreateInput("3", 192, 56, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
GUICtrlSetLimit(-1, 2)
$Input1 = GUICtrlCreateInput("1", 192, 16, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
$Button1 = GUICtrlCreateButton("BAŞLA", 256, 24, 57, 41, $WS_GROUP)
GUICtrlSetCursor (-1, 0)
$Label3 = GUICtrlCreateLabel("

xp worked but dont work w7

Share this post


Link to post
Share on other sites
LarsJ

This has nothing to do with AutoIt constants in the include files.

What is the problem exactly? Can you see the OpenGL generated stars? Can you see the GUI? Does the program crash?

The assembler code is 32 bit code. It'll not run as a 64 bit program. If you run the script as a 64 bit program it'll crash.

How good are the video cards in the Win 7/8 PC's compared with the video card in the XP? If the Win 7/8 PC's are laptops with poor video cards, it can easily be the case that they can't show the OpenGL video.

Have you tried to run the script with most of the OpenGL code commented out like this:

#include <Date.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Memory.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

;Opt("MouseCoordMode",0)
opt("TrayIconDebug", 1)
Opt("TrayOnEventMode",1)
Opt("TrayMenuMode", 3)


;#include "OpenGLconstants.au3" ; constants are extracred for this examle
;Opt("GUIOnEventMode", 1)
_Fofff()
Func _Fofff()
Global $Input2,$Input1,$exititem_2,$exititem_1,$exititem
Global $speed = 0.5 ; speed of projectile, 0.28 defult
Global $relitave = 0

If $relitave = 1 Then
    Global $tail = $speed * 3.2145
Else
    Global $tail = 14.0
EndIf

; Used constants from OpenGLconstants.au3
Global Const $GL_VERSION_1_1 = 1
Global Const $GL_DEPTH_BUFFER_BIT = 0x00000100
Global Const $GL_COLOR_BUFFER_BIT = 0x00004000
Global Const $GL_SRC_COLOR = 0x0300
Global Const $GL_DST_COLOR = 0x0306
Global Const $GL_FOG = 0x0B60
Global Const $GL_FOG_DENSITY = 0x0B62
Global Const $GL_FOG_START = 0x0B63
Global Const $GL_FOG_END = 0x0B64
Global Const $GL_FOG_MODE = 0x0B65
Global Const $GL_FOG_COLOR = 0x0B66
Global Const $GL_BLEND = 0x0BE2
Global Const $GL_FOG_HINT = 0x0C54
Global Const $GL_DONT_CARE = 0x1100
Global Const $GL_MODELVIEW = 0x1700
Global Const $GL_PROJECTION = 0x1701
Global Const $GL_LINEAR = 0x2601

; Some other constants
Global Const $PFD_TYPE_RGBA = 0
Global Const $PFD_MAIN_PLANE = 0
Global Const $PFD_DOUBLEBUFFER = 1
Global Const $PFD_DRAW_TO_WINDOW = 4
Global Const $PFD_SUPPORT_OPENGL = 32

; Number of stars
Global $iNumStars = 9999 ; for example

; Make a GUI
Global $iWidthGUI = 334

Global $iHeightGUI = 118
 Global $Form1 = GUICreate("[#]Zaman baslatma by @mesale0077[#]", $iWidthGUI, $iHeightGUI, -1, -1, $WS_OVERLAPPEDWINDOW)
$Label1 = GUICtrlCreateLabel("BEKLETME DK CINSI :", 8, 16, 112, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label2 = GUICtrlCreateLabel("SINAV SÜRE DK CINSI :", 8, 60, 120, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetLimit(-1, 2)
$Input2 = GUICtrlCreateInput("3", 192, 56, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
GUICtrlSetLimit(-1, 2)
$Input1 = GUICtrlCreateInput("1", 192, 16, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
$Button1 = GUICtrlCreateButton("BASLA", 256, 24, 57, 41, $WS_GROUP)
GUICtrlSetCursor (-1, 0)
$Label3 = GUICtrlCreateLabel("Hazirlayan: @mesale0077", 176, 88, 144, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
$exititem_1 = TrayCreateItem("SIFIRLA")
TrayItemSetOnEvent(-1, "Close")
$exititem = TrayCreateItem("ÇIKIS")
TrayItemSetOnEvent(-1, "Close")
$exititem_2 = TrayCreateItem("HAKKINDA")
TrayItemSetOnEvent(-1, "Close")

TraySetState()

GUISetState(@SW_SHOW)
; Black? Yes black.
GUISetBkColor(0)

; Device context and rendering context
Global $hDC, $hRC ; this two goes in _EnableOpenGL() ByRef

#cs
; Enabling OpenGL
If Not _EnableOpenGL($Form1, $hDC, $hRC) Then
    MsgBox(48, "Error", "Error initializing usage of OpenGL functions" & @CRLF & "Error code: " & @error) ; this is bad
    Exit
EndIf
#ce

; Initially cleaning buffers - this is almost redundant. wglMakeCurrent is to associate rendering context with the current thread
;DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDC, "hwnd", $hRC)
;_glClear(BitOR($GL_COLOR_BUFFER_BIT, $GL_DEPTH_BUFFER_BIT)) ; initially cleaning buffers in case something is left there


Global $tRandom = DllStructCreate("dword") ; this will hold generated random walues by RtlRandomEx function
Global $pRandom = DllStructGetPtr($tRandom)

Global $tFogColor = DllStructCreate("float[4]") ; fog color structure. Needed for _glFogfv function
DllStructSetData($tFogColor, 1, 1, 4) ; other two values are 0
Global $pFogColor = DllStructGetPtr($tFogColor)

Global $tStars = DllStructCreate("float[" & 3 * $iNumStars & "]") ; this structure holds coordinates for every star
Global $pStars = DllStructGetPtr($tStars)

Global $tInt = DllStructCreate("dword") ; this will dynamically hold the address of $tStars
DllStructSetData($tInt, 1, $pStars)
Global $pInt = DllStructGetPtr($tInt)

Global $tInt1 = DllStructCreate("int") ; this is placeholder for the integer used in assembly code in different places
Global $pInt1 = DllStructGetPtr($tInt1)

Global $tInt2 = DllStructCreate("int") ; this is placeholder for the float value of the same value. It's the main 'frequency'
DllStructSetData($tInt2, 1, 150)
Global $pInt2 = DllStructGetPtr($tInt2)

Global $tEndColor = DllStructCreate("float[3]") ; this structure holds ending color of each star (same value for all of them)
DllStructSetData($tEndColor, 1, 0.2, 3) ; other two values are 0
Global $pEndColor = DllStructGetPtr($tEndColor)

Global $tStartColor = DllStructCreate("float[3]") ; this structure holds start color for each star
DllStructSetData($tStartColor, 1, 0.5, 1) ; color crap=============================================================
DllStructSetData($tStartColor, 1, 0.9, 2) ; color crap=============================================================
DllStructSetData($tStartColor, 1, 0.9, 3) ; color crap=============================================================
Global $pStartColor = DllStructGetPtr($tStartColor)

Global $tZoffset = DllStructCreate("float") ; this is determining the tail of passing stars
DllStructSetData($tZoffset, 1, $tail) ; length of tail=============================================================
Global $pZoffset = DllStructGetPtr($tZoffset)

Global $tZincrement = DllStructCreate("float") ; I call this 'repetitive density value' ...or spead if you like
DllStructSetData($tZincrement, 1, $speed) ; 0.28
Global $pZincrement = DllStructGetPtr($tZincrement)

Global $tThreshold = DllStructCreate("float") ; this structure will hold a threshold value
DllStructSetData($tThreshold, 1, 5) ; value is 5 (star will be out of scope when 5 is reached)
Global $pThreshold = DllStructGetPtr($tThreshold)


; SwapBuffers to fully use double-buffering
Global $aSwapBuffers = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("gdi32.dll"), "str", "SwapBuffers")
Global $pSwapBuffers = $aSwapBuffers[0]

; glClear to clean buffers
Global $aglClear = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glClear")
Global $pglClear = $aglClear[0]

; glBegin to initialize drawing procedure
Global $aglBegin = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glBegin")
Global $pglBegin = $aglBegin[0]

; glEnd to end drawing procedure
Global $aglEnd = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glEnd")
Global $pglEnd = $aglEnd[0]

; $pwglMakeCurrent for rendering context
Global $awglMakeCurrent = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "wglMakeCurrent")
Global $pwglMakeCurrent = $awglMakeCurrent[0]

; RtlRandomEx for generating random integers
Global $aRtlRandomEx = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("ntdll.dll"), "str", "RtlRandomEx")
Global $pRtlRandomEx = $aRtlRandomEx[0]

; glVertex3fv for drawing
Global $aglVertex3fv = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glVertex3fv")
Global $pglVertex3fv = $aglVertex3fv[0]

; glColor3fv for color of lines
Global $aglColor3fv = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glColor3fv")
Global $pglColor3fv = $aglColor3fv[0]


; Allocating enough memory (512 bytes) with $PAGE_EXECUTE_READWRITE
Global $pRemoteCode = _MemVirtualAlloc(0, 512, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE)

; Standard allocation in reserved address (512 bytes again)
Global $tCodeBuffer = DllStructCreate("byte[512]", $pRemoteCode)


; Writing to it (this is setting initial values - coordinates for aech and every star)
DllStructSetData($tCodeBuffer, 1, _
        "0x" & _
        "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, $pInt
        "" & _
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
        "FFD0" & _                                                 ; call eax
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
        "F7F1" & _                                                 ; div ecx
        "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D95B" & Hex(0, 2) & _                                     ; fstp 32real[ebx+0d]
        "" & _
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
        "FFD0" & _                                                 ; call eax
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
        "F7F1" & _                                                 ; div ecx
        "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D95B" & Hex(4, 2) & _                                     ; fstp 32real[ebx+4d]
        "" & _
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
        "FFD0" & _                                                 ; call eax
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(14316558) & _                            ; mov ecx, 14316558d
        "F7F1" & _                                                 ; div ecx
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D9E0" & _                                                 ; fchs  ;<-  change sign of st(0)
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d]
        "" & _
        "81C3" & SwapEndian(12) & _                                ; add ebx, 12
        "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
        "75" & Hex(-124, 2) & _                                    ; jne -124 bytes ;<- go back 124 bytes if not equal
        "C3" _                                                     ; ret
        )

; Executing code
DllCall("user32.dll", "int", "CallWindowProcW", _
        "ptr", $pRemoteCode, _
        "int", 0, _
        "int", 0, _
        "int", 0, _
        "int", 0)


; Writing new code (will use the same buffer since the code from it is already executed)
DllStructSetData($tCodeBuffer, 1, _
        "0x" & _
        "" & _ ; >>>>>>>>>>>>>>>>>>>> GENERAL JOB <<<<<<<<<<<<<<<<<<<<<<<
        "" & _ ; 10. $hRC TO THIS THREAD (17 bytes code):
        "68" & SwapEndian($hRC) & _                                ; push $hRC
        "68" & SwapEndian($hDC) & _                                ; push $hDC
        "B8" & SwapEndian($pwglMakeCurrent) & _                    ; mov eax, wglMakeCurrent
        "FFD0" & _                                                 ; call eax ;<- calling function
        "" & _ ; 20. CLEAR BUFFERS (12 bytes code):
        "68" & SwapEndian(16640) & _                               ; push $GL_COLOR_BUFFER_BIT|$GL_DEPTH_BUFFER_BIT
        "B8" & SwapEndian($pglClear) & _                           ; mov eax, glClear
        "FFD0" & _                                                 ; call eax ;<- calling function
        "" & _ ; 30. WILL DRAW LINES - INITIALIZE LINES (12 bytes code):
        "68" & SwapEndian(1) & _                                   ; push $GL_LINES
        "B8" & SwapEndian($pglBegin) & _                           ; mov eax, glBegin
        "FFD0" & _                                                 ; call eax ;<- calling function
        "" & _ ; >>>>>>>>>>>>>>>>>>>> FIRST LOOP <<<<<<<<<<<<<<<<<<<<<<<
        "" & _ ; 40. INITIALIZE LOOP BY ASSIGNING INITIAL VALUE TO ebx (6 bytes code):
        "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, [$pInt] ;<- assigning ebx to address of $pStars (stored in $tInt)
        "" & _ ; 50. DETERMINING INITIAL COLOR (12 bytes code):
        "68" & SwapEndian($pStartColor) & _                        ; push $pStartColor ;<- this is float[3] with start color (r, g, b)
        "B8" & SwapEndian($pglColor3fv) & _                        ; mov eax, $pglColor3fv ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling glColor3fv function
        "" & _ ; 60. DETERMINING INITIAL POINT (8 bytes code):
        "53" & _                                                   ; push ebx ;<- this is float[3] with start coordinates (x, y, z)
        "B8" & SwapEndian($pglVertex3fv) & _                       ; mov eax, $pglVertex3fv ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling glVertex3fv function
        "" & _ ; 70. DETERMINING END COLOR (12 bytes code):
        "68" & SwapEndian($pEndColor) & _                          ; push $pEndColor ;<- this is float[3] with ending color (r, g, b)
        "B8" & SwapEndian($pglColor3fv) & _                        ; mov eax, $pglColor3fv
        "FFD0" & _                                                 ; call eax ;<- calling glColor3fv function
        "" & _ ; 80. DETERMINING END POINT (dislocate z coordinate by value of $tZoffset) (20 bytes code):
        "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
        "D825" & SwapEndian($pZoffset) & _                         ; fsub [$pZoffset] ; <- substract value stored in $tZoffset
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<- save changes and pop
        "53" & _                                                   ; push ebx ;<- this is float[3] with ending coordinates (x, y, z)
        "B8" & SwapEndian($pglVertex3fv) & _                       ; mov eax, $pglVertex3fv ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling glVertex3fv function
        "" & _ ; 90. RESTORE z COORDINATE (12 bytes code):
        "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
        "D805" & SwapEndian($pZoffset) & _                         ; fadd [$pZoffset] ;<- add value of $tZoffset
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<- save changes and pop
        "" & _ ; 100. ADD SIZE OF float[3] TO ebx (3 bytes code):
        "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
        "" & _ ; 110. COMPARE IT (6 bytes code):
        "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
        "" & _ ; 120. MAKE A CONDITION (2 bytes code):
        "73" & Hex(2, 2) & _                                       ; jnb 2d ;<- jump forward 2 bytes on not below; to <135>
        "" & _ ; 130. GO BACK (2 bytes code):
        "EB" & Hex(-77, 2) & _                                     ; jump -77d ;<- jump 77 bytes back otherwise; to <50>
        "" & _ ; >>>>>>>>>>>>>>>>>>>> GENERAL JOB <<<<<<<<<<<<<<<<<<<<<<<
        "" & _ ; 135. CALL glEnd FUNCTION (7 bytes code):
        "B8" & SwapEndian($pglEnd) & _                             ; mov eax, glEnd
        "FFD0" & _                                                 ; call eax ;<- calling glEnd
        "" & _ ; >>>>>>>>>>>>>>>>>>>> SECOND LOOP <<<<<<<<<<<<<<<<<<<<<<<
        "" & _ ; 140. INITIALIZING NEW LOOP (6 bytes code):
        "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, [$pInt] ;<- assigning ebx to address of $pStars (stored in $tInt)
        "" & _ ; 150. CHECK  THRESHOLD (12 bytes code):
        "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
        "D81D" & SwapEndian($pThreshold) & _                       ; fcomp [$pThreshold] ;<- compare st(0) to float at $tThreshold and pop
        "DFE0" & _                                                 ; fnstsw ax ; update ax register (this is essential for conditional jumps with floats)
        "9E" & _                                                   ; sahf ; copy ah register (same remark as above)
        "" & _ ; 160. MAKE A CONDITION (2 bytes code):
        "73" & Hex(25, 2) & _                                      ; jnb 25d ;<- jump 25 bytes forward on not below; to <220>
        "" & _ ; 170. 'MOVE' IT (12 bytes code):
        "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
        "D805" & SwapEndian($pZincrement) & _                      ; fadd [$pZincrement] ;<-  add (increment by) value of $tZincrement
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<-  save changes
        "" & _ ; 180. ADD SIZE OF float[3] TO ebx (3 bytes code):
        "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
        "" & _ ; 190. COMPARE IT (6 bytes code):
        "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
        "" & _ ; 200. MAKE A CONDITION (2 bytes code):
        "73" & Hex(103, 2) & _                                     ; jnb  103d ;<- jump forward 103 bytes on not below; to <290>
        "" & _ ; 210. GO BACK (2 bytes code):
        "EB" & Hex(-39, 2) & _                                     ; jump -39d ;<- jump 39 bytes back otherwise; to <150>
        "" & _ ; 220. GENERATE RANDOM INTEGER IN RANGE OF -25, 25 AND SAVE IT TO x COORDINATE FLOAT (37 bytes code):
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling RtlRandomEx function
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
        "F7F1" & _                                                 ; div ecx
        "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D95B" & Hex(0, 2) & _                                     ; fstp 32real[ebx+0d]
        "" & _ ; 230. GENERATE RANDOM INTEGER IN RANGE OF -25, 25 AND SAVE IT TO y COORDINATE FLOAT (37 bytes code):
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom ;<-
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling RtlRandomEx
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(42949673) & _                            ; mov ecx, 4294967d
        "F7F1" & _                                                 ; div ecx
        "83E8" & Hex(25, 2) & _                                    ; sub eax, 250d
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D95B" & Hex(4, 2) & _                                     ; fstp 32real[ebx+4d]
        "" & _ ; 240. SET z COORDINATE to -150 FLOAT VALUE (11 bytes code):
        "DB05" & SwapEndian($pInt2) & _                            ; fild $pInt2
        "D9E0" & _                                                 ; fchs  ;<-  change sign of st(0)
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<-  save it to proper location
        "" & _ ; 250. ADD SIZE OF float[3] TO ebx (3 bytes code):
        "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
        "" & _ ; 260. COMPARE IT (6 bytes code):
        "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
        "" & _ ; 270. MAKE A CONDITION (2 bytes code):
        "73" & Hex(5, 2) & _                                       ; jnb  5d ;<- jump forward 5 bytes on not below; to <290>
        "" & _ ; 280. GO BACK (5 bytes code):
        "E9" & SwapEndian(-140) & _                                ; jump -140d ;<- jump 140 bytes back otherwise; to <150>
        "" & _ ; 290. CALL SwapBuffers function (12 bytes code):
        "68" & SwapEndian($hDC) & _                                ; push $hDC
        "B8" & SwapEndian($pSwapBuffers) & _                       ; mov eax, SwapBuffers
        "FFD0" & _                                                 ; call eax ;<- calling SwapBuffers
        "" & _ ; 300. RETURN (1 byte code):
        "C3" _                                                    ; ret
        )


#cs
; associate contexts with the current thread
DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDC, "hwnd", $hRC)

;Initializing gl environment
_glClearColor(0, 0, 0, 1) ; we said black
_glFogi($GL_FOG_MODE, $GL_LINEAR)
_glFogfv($GL_FOG_COLOR, $pFogColor)
_glFogf($GL_FOG_DENSITY, 0.1)
_glHint($GL_FOG_HINT, $GL_DONT_CARE)
_glFogf($GL_FOG_START, 70)
_glFogf($GL_FOG_END, 150)
_glEnable($GL_FOG)
_glBlendFunc($GL_SRC_COLOR, $GL_DST_COLOR)
_glEnable($GL_BLEND)

; Initially put things in place (literally)
_glLoadIdentity()
_glViewport(0, 0, $iWidthGUI, $iHeightGUI)
_glMatrixMode($GL_PROJECTION)
_glLoadIdentity()
Global $nRatio = $iWidthGUI / $iHeightGUI
_glFrustum(-$nRatio * 0.75, $nRatio * 0.75, -0.75, 0.75, 6, 150)
_glMatrixMode($GL_MODELVIEW)
#ce


; Installing function to do the refreshment
GUIRegisterMsg(133, "_Preserve") ; WM_NCPAINT

; Installing function to do handle resizing
GUIRegisterMsg(5, "_ResizeGL") ; WM_SIZE

; Handling things on Exit
;GUISetOnEvent(-3, "_Quit") ; $GUI_EVENT_CLOSE

; Show GUI
GUISetState(@SW_SHOW, $Form1)


; Loop till the end
While 1

    ;_GLDraw()
    Sleep(20)
$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            ;_BlockInputEx(0)
            TrayBoxCreate("", "HAZIRLAYAN:"&@CRLF&"@mesale0077"&@CRLF&"Bilgi:"&@CRLF&"Ilginiz için tesekkürler")
            Exit
CASE $Button1
GUISetState(@SW_HIDE, $Form1)

        r1()
    EndSwitch
WEnd


EndFunc

Func Close_skin()

ToolTip("")



; Make a GUI
; Make a GUI
Global $iWidthGUI = @DesktopWidth
Global $iHeightGUI = @DesktopHeight

Global $hGUI = GUICreate("OpenGL Space", $iWidthGUI, $iHeightGUI, 0, 0, $WS_POPUP, $WS_EX_TOPMOST)
$Label1121 = GUICtrlCreateLabel("SÜRE BITTI !", (@DesktopWidth/2)-100, (@DesktopHeight/2)-100, 207, 41, $SS_CENTER)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)

    sleep(500)
        $Button2123 = GUICtrlCreateLabel("ÇIKIS", (@DesktopWidth/2)-50, (@DesktopHeight/2)-30, 92, 25, BitOR($SS_CENTER,$WS_BORDER), $WS_EX_CLIENTEDGE)
GUICtrlSetCursor (-1, 0)
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetColor(-1, 0xFFFFFF)
$Label3 = GUICtrlCreateLabel("Hazirlayan: @mesale0077", (@DesktopWidth/2)-75, (@DesktopHeight/2) ,144, 17, $SS_CENTER)

GUICtrlSetColor(-1, 0xFFFFFF)
; Black? Yes black.
GUISetBkColor(0)

; Device context and rendering context
Global $hDC, $hRC ; this two goes in _EnableOpenGL() ByRef

; Enabling OpenGL
If Not _EnableOpenGL($hGUI, $hDC, $hRC) Then
    MsgBox(48, "Error", "Error initializing usage of OpenGL functions" & @CRLF & "Error code: " & @error) ; this is bad
    Exit
EndIf

; Initially cleaning buffers - this is almost redundant. wglMakeCurrent is to associate rendering context with the current thread
DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDC, "hwnd", $hRC)
_glClear(BitOR($GL_COLOR_BUFFER_BIT, $GL_DEPTH_BUFFER_BIT)) ; initially cleaning buffers in case something is left there


Global $tRandom = DllStructCreate("dword") ; this will hold generated random walues by RtlRandomEx function
Global $pRandom = DllStructGetPtr($tRandom)

Global $tFogColor = DllStructCreate("float[4]") ; fog color structure. Needed for _glFogfv function
DllStructSetData($tFogColor, 1, 1, 4) ; other two values are 0
Global $pFogColor = DllStructGetPtr($tFogColor)

Global $tStars = DllStructCreate("float[" & 3 * $iNumStars & "]") ; this structure holds coordinates for every star
Global $pStars = DllStructGetPtr($tStars)

Global $tInt = DllStructCreate("dword") ; this will dynamically hold the address of $tStars
DllStructSetData($tInt, 1, $pStars)
Global $pInt = DllStructGetPtr($tInt)

Global $tInt1 = DllStructCreate("int") ; this is placeholder for the integer used in assembly code in different places
Global $pInt1 = DllStructGetPtr($tInt1)

Global $tInt2 = DllStructCreate("int") ; this is placeholder for the float value of the same value. It's the main 'frequency'
DllStructSetData($tInt2, 1, 150)
Global $pInt2 = DllStructGetPtr($tInt2)

Global $tEndColor = DllStructCreate("float[3]") ; this structure holds ending color of each star (same value for all of them)
DllStructSetData($tEndColor, 1, 0.2, 3) ; other two values are 0
Global $pEndColor = DllStructGetPtr($tEndColor)

Global $tStartColor = DllStructCreate("float[3]") ; this structure holds start color for each star
DllStructSetData($tStartColor, 1, 0.5, 1) ; color crap=============================================================
DllStructSetData($tStartColor, 1, 0.9, 2) ; color crap=============================================================
DllStructSetData($tStartColor, 1, 0.9, 3) ; color crap=============================================================
Global $pStartColor = DllStructGetPtr($tStartColor)

Global $tZoffset = DllStructCreate("float") ; this is determining the tail of passing stars
DllStructSetData($tZoffset, 1, $tail) ; length of tail=============================================================
Global $pZoffset = DllStructGetPtr($tZoffset)

Global $tZincrement = DllStructCreate("float") ; I call this 'repetitive density value' ...or spead if you like
DllStructSetData($tZincrement, 1, $speed) ; 0.28
Global $pZincrement = DllStructGetPtr($tZincrement)

Global $tThreshold = DllStructCreate("float") ; this structure will hold a threshold value
DllStructSetData($tThreshold, 1, 5) ; value is 5 (star will be out of scope when 5 is reached)
Global $pThreshold = DllStructGetPtr($tThreshold)


; SwapBuffers to fully use double-buffering
Global $aSwapBuffers = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("gdi32.dll"), "str", "SwapBuffers")
Global $pSwapBuffers = $aSwapBuffers[0]

; glClear to clean buffers
Global $aglClear = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glClear")
Global $pglClear = $aglClear[0]

; glBegin to initialize drawing procedure
Global $aglBegin = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glBegin")
Global $pglBegin = $aglBegin[0]

; glEnd to end drawing procedure
Global $aglEnd = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glEnd")
Global $pglEnd = $aglEnd[0]

; $pwglMakeCurrent for rendering context
Global $awglMakeCurrent = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "wglMakeCurrent")
Global $pwglMakeCurrent = $awglMakeCurrent[0]

; RtlRandomEx for generating random integers
Global $aRtlRandomEx = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("ntdll.dll"), "str", "RtlRandomEx")
Global $pRtlRandomEx = $aRtlRandomEx[0]

; glVertex3fv for drawing
Global $aglVertex3fv = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glVertex3fv")
Global $pglVertex3fv = $aglVertex3fv[0]

; glColor3fv for color of lines
Global $aglColor3fv = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glColor3fv")
Global $pglColor3fv = $aglColor3fv[0]


; Allocating enough memory (512 bytes) with $PAGE_EXECUTE_READWRITE
Global $pRemoteCode = _MemVirtualAlloc(0, 512, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE)

; Standard allocation in reserved address (512 bytes again)
Global $tCodeBuffer = DllStructCreate("byte[512]", $pRemoteCode)


; Writing to it (this is setting initial values - coordinates for aech and every star)
DllStructSetData($tCodeBuffer, 1, _
        "0x" & _
        "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, $pInt
        "" & _
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
        "FFD0" & _                                                 ; call eax
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
        "F7F1" & _                                                 ; div ecx
        "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D95B" & Hex(0, 2) & _                                     ; fstp 32real[ebx+0d]
        "" & _
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
        "FFD0" & _                                                 ; call eax
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
        "F7F1" & _                                                 ; div ecx
        "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D95B" & Hex(4, 2) & _                                     ; fstp 32real[ebx+4d]
        "" & _
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
        "FFD0" & _                                                 ; call eax
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(14316558) & _                            ; mov ecx, 14316558d
        "F7F1" & _                                                 ; div ecx
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D9E0" & _                                                 ; fchs  ;<-  change sign of st(0)
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d]
        "" & _
        "81C3" & SwapEndian(12) & _                                ; add ebx, 12
        "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
        "75" & Hex(-124, 2) & _                                    ; jne -124 bytes ;<- go back 124 bytes if not equal
        "C3" _                                                     ; ret
        )

; Executing code
DllCall("user32.dll", "int", "CallWindowProcW", _
        "ptr", $pRemoteCode, _
        "int", 0, _
        "int", 0, _
        "int", 0, _
        "int", 0)


; Writing new code (will use the same buffer since the code from it is already executed)
DllStructSetData($tCodeBuffer, 1, _
        "0x" & _
        "" & _ ; >>>>>>>>>>>>>>>>>>>> GENERAL JOB <<<<<<<<<<<<<<<<<<<<<<<
        "" & _ ; 10. $hRC TO THIS THREAD (17 bytes code):
        "68" & SwapEndian($hRC) & _                                ; push $hRC
        "68" & SwapEndian($hDC) & _                                ; push $hDC
        "B8" & SwapEndian($pwglMakeCurrent) & _                    ; mov eax, wglMakeCurrent
        "FFD0" & _                                                 ; call eax ;<- calling function
        "" & _ ; 20. CLEAR BUFFERS (12 bytes code):
        "68" & SwapEndian(16640) & _                               ; push $GL_COLOR_BUFFER_BIT|$GL_DEPTH_BUFFER_BIT
        "B8" & SwapEndian($pglClear) & _                           ; mov eax, glClear
        "FFD0" & _                                                 ; call eax ;<- calling function
        "" & _ ; 30. WILL DRAW LINES - INITIALIZE LINES (12 bytes code):
        "68" & SwapEndian(1) & _                                   ; push $GL_LINES
        "B8" & SwapEndian($pglBegin) & _                           ; mov eax, glBegin
        "FFD0" & _                                                 ; call eax ;<- calling function
        "" & _ ; >>>>>>>>>>>>>>>>>>>> FIRST LOOP <<<<<<<<<<<<<<<<<<<<<<<
        "" & _ ; 40. INITIALIZE LOOP BY ASSIGNING INITIAL VALUE TO ebx (6 bytes code):
        "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, [$pInt] ;<- assigning ebx to address of $pStars (stored in $tInt)
        "" & _ ; 50. DETERMINING INITIAL COLOR (12 bytes code):
        "68" & SwapEndian($pStartColor) & _                        ; push $pStartColor ;<- this is float[3] with start color (r, g, b)
        "B8" & SwapEndian($pglColor3fv) & _                        ; mov eax, $pglColor3fv ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling glColor3fv function
        "" & _ ; 60. DETERMINING INITIAL POINT (8 bytes code):
        "53" & _                                                   ; push ebx ;<- this is float[3] with start coordinates (x, y, z)
        "B8" & SwapEndian($pglVertex3fv) & _                       ; mov eax, $pglVertex3fv ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling glVertex3fv function
        "" & _ ; 70. DETERMINING END COLOR (12 bytes code):
        "68" & SwapEndian($pEndColor) & _                          ; push $pEndColor ;<- this is float[3] with ending color (r, g, b)
        "B8" & SwapEndian($pglColor3fv) & _                        ; mov eax, $pglColor3fv
        "FFD0" & _                                                 ; call eax ;<- calling glColor3fv function
        "" & _ ; 80. DETERMINING END POINT (dislocate z coordinate by value of $tZoffset) (20 bytes code):
        "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
        "D825" & SwapEndian($pZoffset) & _                         ; fsub [$pZoffset] ; <- substract value stored in $tZoffset
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<- save changes and pop
        "53" & _                                                   ; push ebx ;<- this is float[3] with ending coordinates (x, y, z)
        "B8" & SwapEndian($pglVertex3fv) & _                       ; mov eax, $pglVertex3fv ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling glVertex3fv function
        "" & _ ; 90. RESTORE z COORDINATE (12 bytes code):
        "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
        "D805" & SwapEndian($pZoffset) & _                         ; fadd [$pZoffset] ;<- add value of $tZoffset
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<- save changes and pop
        "" & _ ; 100. ADD SIZE OF float[3] TO ebx (3 bytes code):
        "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
        "" & _ ; 110. COMPARE IT (6 bytes code):
        "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
        "" & _ ; 120. MAKE A CONDITION (2 bytes code):
        "73" & Hex(2, 2) & _                                       ; jnb 2d ;<- jump forward 2 bytes on not below; to <135>
        "" & _ ; 130. GO BACK (2 bytes code):
        "EB" & Hex(-77, 2) & _                                     ; jump -77d ;<- jump 77 bytes back otherwise; to <50>
        "" & _ ; >>>>>>>>>>>>>>>>>>>> GENERAL JOB <<<<<<<<<<<<<<<<<<<<<<<
        "" & _ ; 135. CALL glEnd FUNCTION (7 bytes code):
        "B8" & SwapEndian($pglEnd) & _                             ; mov eax, glEnd
        "FFD0" & _                                                 ; call eax ;<- calling glEnd
        "" & _ ; >>>>>>>>>>>>>>>>>>>> SECOND LOOP <<<<<<<<<<<<<<<<<<<<<<<
        "" & _ ; 140. INITIALIZING NEW LOOP (6 bytes code):
        "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, [$pInt] ;<- assigning ebx to address of $pStars (stored in $tInt)
        "" & _ ; 150. CHECK  THRESHOLD (12 bytes code):
        "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
        "D81D" & SwapEndian($pThreshold) & _                       ; fcomp [$pThreshold] ;<- compare st(0) to float at $tThreshold and pop
        "DFE0" & _                                                 ; fnstsw ax ; update ax register (this is essential for conditional jumps with floats)
        "9E" & _                                                   ; sahf ; copy ah register (same remark as above)
        "" & _ ; 160. MAKE A CONDITION (2 bytes code):
        "73" & Hex(25, 2) & _                                      ; jnb 25d ;<- jump 25 bytes forward on not below; to <220>
        "" & _ ; 170. 'MOVE' IT (12 bytes code):
        "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
        "D805" & SwapEndian($pZincrement) & _                      ; fadd [$pZincrement] ;<-  add (increment by) value of $tZincrement
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<-  save changes
        "" & _ ; 180. ADD SIZE OF float[3] TO ebx (3 bytes code):
        "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
        "" & _ ; 190. COMPARE IT (6 bytes code):
        "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
        "" & _ ; 200. MAKE A CONDITION (2 bytes code):
        "73" & Hex(103, 2) & _                                     ; jnb  103d ;<- jump forward 103 bytes on not below; to <290>
        "" & _ ; 210. GO BACK (2 bytes code):
        "EB" & Hex(-39, 2) & _                                     ; jump -39d ;<- jump 39 bytes back otherwise; to <150>
        "" & _ ; 220. GENERATE RANDOM INTEGER IN RANGE OF -25, 25 AND SAVE IT TO x COORDINATE FLOAT (37 bytes code):
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling RtlRandomEx function
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
        "F7F1" & _                                                 ; div ecx
        "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D95B" & Hex(0, 2) & _                                     ; fstp 32real[ebx+0d]
        "" & _ ; 230. GENERATE RANDOM INTEGER IN RANGE OF -25, 25 AND SAVE IT TO y COORDINATE FLOAT (37 bytes code):
        "68" & SwapEndian($pRandom) & _                            ; push $pRandom ;<-
        "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx ;<- 'preparing' to call
        "FFD0" & _                                                 ; call eax ;<- calling RtlRandomEx
        "99" & _                                                   ; cdq
        "B9" & SwapEndian(42949673) & _                            ; mov ecx, 4294967d
        "F7F1" & _                                                 ; div ecx
        "83E8" & Hex(25, 2) & _                                    ; sub eax, 250d
        "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
        "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
        "D95B" & Hex(4, 2) & _                                     ; fstp 32real[ebx+4d]
        "" & _ ; 240. SET z COORDINATE to -150 FLOAT VALUE (11 bytes code):
        "DB05" & SwapEndian($pInt2) & _                            ; fild $pInt2
        "D9E0" & _                                                 ; fchs  ;<-  change sign of st(0)
        "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<-  save it to proper location
        "" & _ ; 250. ADD SIZE OF float[3] TO ebx (3 bytes code):
        "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
        "" & _ ; 260. COMPARE IT (6 bytes code):
        "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
        "" & _ ; 270. MAKE A CONDITION (2 bytes code):
        "73" & Hex(5, 2) & _                                       ; jnb  5d ;<- jump forward 5 bytes on not below; to <290>
        "" & _ ; 280. GO BACK (5 bytes code):
        "E9" & SwapEndian(-140) & _                                ; jump -140d ;<- jump 140 bytes back otherwise; to <150>
        "" & _ ; 290. CALL SwapBuffers function (12 bytes code):
        "68" & SwapEndian($hDC) & _                                ; push $hDC
        "B8" & SwapEndian($pSwapBuffers) & _                       ; mov eax, SwapBuffers
        "FFD0" & _                                                 ; call eax ;<- calling SwapBuffers
        "" & _ ; 300. RETURN (1 byte code):
        "C3" _                                                    ; ret
        )


; associate contexts with the current thread
DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDC, "hwnd", $hRC)

;Initializing gl environment
_glClearColor(0, 0, 0, 1) ; we said black
_glFogi($GL_FOG_MODE, $GL_LINEAR)
_glFogfv($GL_FOG_COLOR, $pFogColor)
_glFogf($GL_FOG_DENSITY, 0.1)
_glHint($GL_FOG_HINT, $GL_DONT_CARE)
_glFogf($GL_FOG_START, 70)
_glFogf($GL_FOG_END, 150)
_glEnable($GL_FOG)
_glBlendFunc($GL_SRC_COLOR, $GL_DST_COLOR)
_glEnable($GL_BLEND)

; Initially put things in place (literally)
_glLoadIdentity()
_glViewport(0, 0, $iWidthGUI, $iHeightGUI)
_glMatrixMode($GL_PROJECTION)
_glLoadIdentity()
Global $nRatio = $iWidthGUI / $iHeightGUI
_glFrustum(-$nRatio * 0.75, $nRatio * 0.75, -0.75, 0.75, 6, 150)
_glMatrixMode($GL_MODELVIEW)


; Installing function to do the refreshment
GUIRegisterMsg(133, "_Preserve") ; WM_NCPAINT

; Installing function to do handle resizing
GUIRegisterMsg(5, "_ResizeGL") ; WM_SIZE

; Handling things on Exit
;GUISetOnEvent(-3, "_Quit") ; $GUI_EVENT_CLOSE
MouseMove((@DesktopWidth/2)-35, (@DesktopHeight/2)-20)
; Show GUI
GUISetState(@SW_SHOW, $hGUI)


; Loop till the end
;While 1

    ;_GLDraw()
    ;Sleep(20)

;WEnd

While 1

If ProcessExists('Taskmgr.exe') Then
       ProcessClose('Taskmgr.exe')
        ;GUISetState()
    Endif
_GLDraw()
    Sleep(20)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        ;Case $GUI_EVENT_CLOSE
        ;_Quit()
CASE $Button2123
    GuiCtrlSetData($Button2123, "çikis")
        sleep(200)

        GuiCtrlSetData($Button2123, "ÇIKIS")
        ;_BlockInputEx(0)


_Quit()
    EndSwitch
WEnd


endfunc
func r1()
local $eieie = GUICtrlRead($Input1)
$start_1 = @HOUR & ":" & @MIN + $eieie
if @MIN + GUICtrlRead($Input1)< 10 then
 $start_1 = @HOUR & ":0" & @MIN + $eieie
endif
While 1
 $start2 = @HOUR & ":" & @MIN
  ToolTip(" "  ,@DesktopWidth - 220, @DesktopHeight - 120,"Bilgi: " &GUICtrlRead($Input1)& " dakika sonra baslayacak", 1)
If $start_1 = $start2   then
Beep(300,500)
    rr1()



   endif
WEnd
endfunc
func rr1()
Beep(300,500)
r2()


endfunc



func r2()

Global $start =  @HOUR & ":" & @MIN
Global $Minutes = GUICtrlRead($Input2) ; will wait 90 minutes

Global $60Count = 0, $begin = TimerInit()
While 1
$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        TrayBoxCreate("", "HAZIRLAYAN:"&@CRLF&"@mesale0077"&@CRLF&"Bilgi:"&@CRLF&"Ilginiz için tesekkürler")
            Exit


    EndSwitch


  if $Minutes > $60Count then

    $dif = TimerDiff($begin)
    $dif2 = StringLeft($dif, StringInStr($dif, ".") -1)
    $Count = int($dif/1000)
    $60Count = Int($Count / 60)

    ;ToolTip("Minutes Required = " & $Minutes & @CRLF & "Minutes Past = " & $60Count & @CRLF & "Seconds Count = " & $Count & @CRLF & "Mili-Seconds Count = " & $dif2, 20, 20, "Time Machine #1", 1)
      ; TrayTip("Bilgi: 2.Reklami gösterecek", "Baslama dakikasi = " & $Minutes & @CRLF & "Geçen dakika = " & $60Count & @CRLF & "Geçen saniye = " & $Count ,"",1)

       ToolTip("Baslama saati = " & $start& @CRLF & "Simdiki saat = " &@HOUR & ":" & @MIN& @CRLF & "Geçen dakika = " & $60Count ,@DesktopWidth - 220, @DesktopHeight - 120,"Bilgi: " &GUICtrlRead($Input2)& " dakika sonra bitecek", 1)

   else

  rr2()
   endif
WEnd
endfunc
func rr2()

 Beep(300,500)
;_DisableOpenGL($Form1, $hDC, $hRC)

 ToolTip("")

 Close_skin()


endfunc

Func Close()

        Select

Case @TRAY_ID = $exititem_2

        TrayBoxCreate("", "HAZIRLAYAN:"&@CRLF&"@mesale0077"&@CRLF&"Bilgi:"&@CRLF&"Ilginiz için tesekkürler")
     Case @TRAY_ID = $exititem_1
    ;ScriptRestart()
    _DisableOpenGL($Form1 , $hDC, $hRC)
        _Self_Restart(1)
            Case @TRAY_ID = $exititem
                    ToolTip("")
#cs                     #NoTrayIcon
        Opt("TrayIconHide", 1)

    TrayBoxCreate("", "HAZIRLAYAN:"&@CRLF&"@mesale0077"&@CRLF&"Bilgi:"&@CRLF&"Ilginiz için tesekkürler")
    #ce
TrayBoxCreate("", "HAZIRLAYAN:"&@CRLF&"@mesale0077"&@CRLF&"Bilgi:"&@CRLF&"Ilginiz için tesekkürler")

            exit


        EndSelect

EndFunc
Func TrayBoxCreate($TBTitle, $TBText, $display_Time = 2500)
$TBgui = GUICreate($TBTitle,250, 100, @DesktopWidth - 300, @DesktopHeight - 150,$WS_POPUP,$WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
_GuiRoundCorners($TBgui, 0, 0, 100, 100)
GUISetBkColor(0x0000FF)
$Status = GUICtrlCreateLabel($TBText, 40,20, 210, 100)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00040008);slide-in from bottom

GUISetState()
Sleep($display_Time)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1500, "long", 0x00040008);slide-in from bottom
GUISetState(@SW_SHOW, $TBgui)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBGui, "int", 1000, "long", 0x00050010);implode
GUISetState(@SW_HIDE, $TBgui)

EndFunc


Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
   Dim $pos, $ret, $ret2
   $pos = WinGetPos($h_win)
    $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long",  $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3,  "long", $i_y3)
   If $ret[0] Then
      $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
      If $ret2[0] Then
         Return 1
      Else
         Return 0
      EndIf
   Else
      Return 0
   EndIf
EndFunc
#cs
Func ScriptRestart()
    ;BySpenger120
    Switch @Compiled
        Case True
            Run(@ScriptFullPath)
        Case False
            ShellExecute(@AutoItExe,@ScriptFullPath)
    EndSwitch
    Exit
EndFunc   ;==>ScriptRestart
#ce

Func _Self_Restart($iTime)
    Run(@ComSpec & ' /c Ping -n ' & $iTime & ' localhost > nul & "' & @ScriptFullPath & '" /CmdLineRun', @ScriptDir, @SW_HIDE)
    Exit
EndFunc


; USED FUNCTIONS:

Func _GLDraw()

    DllCall("user32.dll", "int", "CallWindowProcW", _
            "ptr", $pRemoteCode, _
            "int", 0, _
            "int", 0, _
            "int", 0, _
            "int", 0)

EndFunc   ;==>_GLDraw


Func SwapEndian($iValue)
    Return Hex(BinaryMid($iValue, 1, 4))
EndFunc   ;==>SwapEndian


Func _EnableOpenGL($hWnd, ByRef $hDeviceContext, ByRef $hOpenGLRenderingContext)

    Local $tPIXELFORMATDESCRIPTOR = DllStructCreate("ushort Size;" & _
            "ushort Version;" & _
            "dword Flags;" & _
            "ubyte PixelType;" & _
            "ubyte ColorBits;" & _
            "ubyte RedBits;" & _
            "ubyte RedShift;" & _
            "ubyte GreenBits;" & _
            "ubyte GreenShift;" & _
            "ubyte BlueBits;" & _
            "ubyte BlueShift;" & _
            "ubyte AlphaBits;" & _
            "ubyte AlphaShift;" & _
            "ubyte AccumBits;" & _
            "ubyte AccumRedBits;" & _
            "ubyte AccumGreenBits;" & _
            "ubyte AccumBlueBits;" & _
            "ubyte AccumAlphaBits;" & _
            "ubyte DepthBits;" & _
            "ubyte StencilBits;" & _
            "ubyte AuxBuffers;" & _
            "ubyte LayerType;" & _
            "ubyte Reserved;" & _
            "dword LayerMask;" & _
            "dword VisibleMask;" & _
            "dword DamageMask")

    DllStructSetData($tPIXELFORMATDESCRIPTOR, "Size", DllStructGetSize($tPIXELFORMATDESCRIPTOR))
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "Version", $GL_VERSION_1_1)
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "Flags", BitOR($PFD_DRAW_TO_WINDOW, $PFD_SUPPORT_OPENGL, $PFD_DOUBLEBUFFER))
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "PixelType", $PFD_TYPE_RGBA)
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "ColorBits", 24)
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "DepthBits", 32)
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "LayerType", $PFD_MAIN_PLANE)

    Local $a_hCall = DllCall("kernel32.dll", "hwnd", "GetModuleHandleW", "wstr", "opengl32.dll")
    If @error Then
        Return SetError(1, 0, 0) ; what???
    EndIf

    If Not $a_hCall[0] Then
        If DllOpen("opengl32.dll") = -1 Then
            Return SetError(2, 0, 0) ; could not open opengl32.dll
        EndIf
    EndIf

    $a_hCall = DllCall("user32.dll", "hwnd", "GetDC", "hwnd", $hWnd)

    If @error Or Not $a_hCall[0] Then
        Return SetError(3, 0, 0) ; could not retrieve a handle to a device context
    EndIf

    $hDeviceContext = $a_hCall[0]

    Local $a_iCall = DllCall("gdi32.dll", "int", "ChoosePixelFormat", "hwnd", $hDeviceContext, "ptr", DllStructGetPtr($tPIXELFORMATDESCRIPTOR))
    If @error Or Not $a_iCall[0] Then
        Return SetError(4, 0, 0) ; could not match an appropriate pixel format
    EndIf
    Local $iFormat = $a_iCall[0]

    $a_iCall = DllCall("gdi32.dll", "int", "SetPixelFormat", "hwnd", $hDeviceContext, "int", $iFormat, "ptr", DllStructGetPtr($tPIXELFORMATDESCRIPTOR))
    If @error Or Not $a_iCall[0] Then
        Return SetError(5, 0, 0) ; could not set the pixel format of the specified device context to the specified format
    EndIf

    $a_hCall = DllCall("opengl32.dll", "hwnd", "wglCreateContext", "hwnd", $hDeviceContext)
    If @error Or Not $a_hCall[0] Then
        Return SetError(6, 0, 0) ; could not create a rendering context
    EndIf

    $hOpenGLRenderingContext = $a_hCall[0]

    Return SetError(0, 0, 1) ; all OK!

EndFunc   ;==>_EnableOpenGL


Func _DisableOpenGL($hWnd, $hDeviceContext, $hOpenGLRenderingContext)

    ; No point in doing error checking if this is done on exit. Will just call the cleaning functions.

    DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", 0, "hwnd", 0)
    DllCall("opengl32.dll", "int", "wglDeleteContext", "hwnd", $hOpenGLRenderingContext)
    DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hWnd, "hwnd", $hDeviceContext)

EndFunc   ;==>_DisableOpenGL


Func _ResizeGL($hWnd, $iMsg, $wParam, $lParam)

    ; dealing with AU3Check.exe
    #forceref $hWnd, $iMsg, $wParam

    ; associate contexts with the current thread
    DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDC, "hwnd", $hRC)

    ; determine the size of our window
    Local $aClientSize[2] = [BitAND($lParam, 65535), BitShift($lParam, 16)] ; window dimension

    ; process changes... adopt to them
    _glLoadIdentity()
    _glViewport(0, 0, $aClientSize[0], $aClientSize[1])
    _glMatrixMode($GL_PROJECTION)
    _glLoadIdentity()
    Local $nRatio = $aClientSize[0] / $aClientSize[1]
    _glFrustum(-$nRatio * .75, $nRatio * .75, -.75, .75, 6.0, 150.0)
    _glMatrixMode($GL_MODELVIEW)

EndFunc   ;==>_ResizeGL


Func _glBegin($iMode)
    DllCall("opengl32.dll", "none", "glBegin", "dword", $iMode)
EndFunc   ;==>_glBegin


Func _glBlendFunc($iSfactor, $iDfactor)
    DllCall("opengl32.dll", "none", "glBlendFunc", "dword", $iSfactor, "dword", $iDfactor)
EndFunc   ;==>_glBlendFunc


Func _glColor3fv($pColorFloat)
    DllCall("opengl32.dll", "none", "glColor3fv", "ptr", $pColorFloat)
EndFunc   ;==>_glColor3fv


Func _glClear($iMask)
    DllCall("opengl32.dll", "none", "glClear", "dword", $iMask)
EndFunc   ;==>_glClear


Func _glClearColor($nRed, $nGreen, $nBlue, $nAlpha)
    DllCall("opengl32.dll", "none", "glClearColor", "float", $nRed, "float", $nGreen, "float", $nBlue, "float", $nAlpha)
EndFunc   ;==>_glClearColor


Func _glEnable($iCap)
    DllCall("opengl32.dll", "none", "glEnable", "dword", $iCap)
EndFunc   ;==>_glEnable


Func _glEnd()
    DllCall("opengl32.dll", "none", "glEnd")
EndFunc   ;==>_glEnd


Func _glFrustum($nLeft, $nRight, $nBottom, $nTop, $nZNear, $nZFar)
    DllCall("opengl32.dll", "none", "glFrustum", "double", $nLeft, "double", $nRight, "double", $nBottom, "double", $nTop, "double", $nZNear, "double", $nZFar)
EndFunc   ;==>_glFrustum


Func _glFogf($iName, $nParam)
    DllCall("opengl32.dll", "none", "glFogf", "dword", $iName, "float", $nParam)
EndFunc   ;==>_glFogf


Func _glFogi($iName, $iParam)
    DllCall("opengl32.dll", "none", "glFogi", "dword", $iName, "dword", $iParam)
EndFunc   ;==>_glFogi


Func _glFogfv($iName, $pParams)
    DllCall("opengl32.dll", "none", "glFogfv", "dword", $iName, "ptr", $pParams)
EndFunc   ;==>_glFogfv


Func _glHint($iTarget, $iMode)
    DllCall("opengl32.dll", "none", "glHint", "dword", $iTarget, "dword", $iMode)
EndFunc   ;==>_glHint


Func _glLoadIdentity()
    DllCall("opengl32.dll", "none", "glLoadIdentity")
EndFunc   ;==>_glLoadIdentity


Func _glMatrixMode($iMode)
    DllCall("opengl32.dll", "none", "glMatrixMode", "dword", $iMode)
EndFunc   ;==>_glMatrixMode


Func _glViewport($iX, $iY, $iWidth, $iHeight)
    DllCall("opengl32.dll", "none", "glViewport", "int", $iX, "int", $iY, "dword", $iWidth, "dword", $iHeight)
EndFunc   ;==>_glViewport


Func _glVertex3fv($pPointer)
    DllCall("opengl32.dll", "none", "glVertex3fv", "ptr", $pPointer)
EndFunc   ;==>_glVertex3fv


Func _SwapBuffers($hDC)
    DllCall("gdi32.dll", "int", "SwapBuffers", "hwnd", $hDC)
EndFunc   ;==>_SwapBuffers



Func _Preserve()
    _SwapBuffers($hDC)
EndFunc   ;==>_Preserve


Func _Quit()
    _DisableOpenGL($hGUI, $hDC, $hRC)
        _Self_Restart(1)
    ;Exit
EndFunc   ;==>_Quit

Share this post


Link to post
Share on other sites
UEZ

I assume he means that the controls are overwritten by the animation.

When using GDI+ you can exclude areas used by the controls, I don't know how to exclude areas using OpenGL but you can add a transparent child GUI where you can see the animated background.

@mesale0077 try this:

#include <Date.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Memory.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

;Opt("MouseCoordMode",0)
opt("TrayIconDebug", 1)
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 3)


;#include "OpenGLconstants.au3" ; constants are extracred for this examle
;Opt("GUIOnEventMode", 1)
_Fofff()


Func _Fofff()
    Global $Input2, $Input1, $exititem_2, $exititem_1, $exititem
    Global $speed = 0.5 ; speed of projectile, 0.28 defult
    Global $relitave = 0

    If $relitave = 1 Then
        Global $tail = $speed * 3.2145
    Else
        Global $tail = 14.0
    EndIf

    ; Used constants from OpenGLconstants.au3
    Global Const $GL_VERSION_1_1 = 1
    Global Const $GL_DEPTH_BUFFER_BIT = 0x00000100
    Global Const $GL_COLOR_BUFFER_BIT = 0x00004000
    Global Const $GL_SRC_COLOR = 0x0300
    Global Const $GL_DST_COLOR = 0x0306
    Global Const $GL_FOG = 0x0B60
    Global Const $GL_FOG_DENSITY = 0x0B62
    Global Const $GL_FOG_START = 0x0B63
    Global Const $GL_FOG_END = 0x0B64
    Global Const $GL_FOG_MODE = 0x0B65
    Global Const $GL_FOG_COLOR = 0x0B66
    Global Const $GL_BLEND = 0x0BE2
    Global Const $GL_FOG_HINT = 0x0C54
    Global Const $GL_DONT_CARE = 0x1100
    Global Const $GL_MODELVIEW = 0x1700
    Global Const $GL_PROJECTION = 0x1701
    Global Const $GL_LINEAR = 0x2601

    ; Some other constants
    Global Const $PFD_TYPE_RGBA = 0
    Global Const $PFD_MAIN_PLANE = 0
    Global Const $PFD_DOUBLEBUFFER = 1
    Global Const $PFD_DRAW_TO_WINDOW = 4
    Global Const $PFD_SUPPORT_OPENGL = 32

    ; Number of stars
    Global $iNumStars = 9999 ; for example

    ; Make a GUI
    Global $iWidthGUI = 334

    Global $iHeightGUI = 118
    Global $Form1 = GUICreate("[#]Zaman baþlatma by @mesale0077[#]", $iWidthGUI, $iHeightGUI, -1, -1, $WS_OVERLAPPEDWINDOW)
    Global $hGUI_Child = GUICreate("", $iWidthGUI, $iHeightGUI, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $Form1)
    GUISetBkColor(0xABCDEF, $hGUI_Child)
    GUISwitch($hGUI_Child)
    _WinAPI_SetLayeredWindowAttributes($hGUI_Child, 0xABCDEF)
    $Label1 = GUICtrlCreateLabel("BEKLETME DK CÝNSÝ :", 8, 16, 112, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label2 = GUICtrlCreateLabel("SINAV SÜRE DK CÝNSÝ :", 8, 60, 120, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetLimit(-1, 2)
    $Input2 = GUICtrlCreateInput("3", 192, 56, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
    GUICtrlSetLimit(-1, 2)
    $Input1 = GUICtrlCreateInput("1", 192, 16, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
    $Button1 = GUICtrlCreateButton("BAÞLA", 256, 24, 57, 41, $WS_GROUP)
    GUICtrlSetCursor(-1, 0)
    $Label3 = GUICtrlCreateLabel("Hazýrlayan: @mesale0077", 176, 88, 144, 17)
    GUICtrlSetColor(-1, 0xFFFFFF)

    $exititem_1 = TrayCreateItem("SIFIRLA")
    TrayItemSetOnEvent(-1, "Close")
    $exititem = TrayCreateItem("ÇIKIÞ")
    TrayItemSetOnEvent(-1, "Close")
    $exititem_2 = TrayCreateItem("HAKKINDA")
    TrayItemSetOnEvent(-1, "Close")

    TraySetState()

    GUISetState(@SW_SHOW, $Form1)
    GUISetState(@SW_SHOW, $hGUI_Child)
    ; Black? Yes black.
;~  GUISetBkColor(0)

    ; Device context and rendering context
    Global $hDC, $hRC ; this two goes in _EnableOpenGL() ByRef

    ; Enabling OpenGL
    If Not _EnableOpenGL($Form1, $hDC, $hRC) Then
        MsgBox(48, "Error", "Error initializing usage of OpenGL functions" & @CRLF & "Error code: " & @error) ; this is bad
        Exit
    EndIf

    ; Initially cleaning buffers - this is almost redundant. wglMakeCurrent is to associate rendering context with the current thread
    DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDC, "hwnd", $hRC)
    _glClear(BitOR($GL_COLOR_BUFFER_BIT, $GL_DEPTH_BUFFER_BIT)) ; initially cleaning buffers in case something is left there


    Global $tRandom = DllStructCreate("dword") ; this will hold generated random walues by RtlRandomEx function
    Global $pRandom = DllStructGetPtr($tRandom)

    Global $tFogColor = DllStructCreate("float[4]") ; fog color structure. Needed for _glFogfv function
    DllStructSetData($tFogColor, 1, 1, 4) ; other two values are 0
    Global $pFogColor = DllStructGetPtr($tFogColor)

    Global $tStars = DllStructCreate("float[" & 3 * $iNumStars & "]") ; this structure holds coordinates for every star
    Global $pStars = DllStructGetPtr($tStars)

    Global $tInt = DllStructCreate("dword") ; this will dynamically hold the address of $tStars
    DllStructSetData($tInt, 1, $pStars)
    Global $pInt = DllStructGetPtr($tInt)

    Global $tInt1 = DllStructCreate("int") ; this is placeholder for the integer used in assembly code in different places
    Global $pInt1 = DllStructGetPtr($tInt1)

    Global $tInt2 = DllStructCreate("int") ; this is placeholder for the float value of the same value. It's the main 'frequency'
    DllStructSetData($tInt2, 1, 150)
    Global $pInt2 = DllStructGetPtr($tInt2)

    Global $tEndColor = DllStructCreate("float[3]") ; this structure holds ending color of each star (same value for all of them)
    DllStructSetData($tEndColor, 1, 0.2, 3) ; other two values are 0
    Global $pEndColor = DllStructGetPtr($tEndColor)

    Global $tStartColor = DllStructCreate("float[3]") ; this structure holds start color for each star
    DllStructSetData($tStartColor, 1, 0.5, 1) ; color crap=============================================================
    DllStructSetData($tStartColor, 1, 0.9, 2) ; color crap=============================================================
    DllStructSetData($tStartColor, 1, 0.9, 3) ; color crap=============================================================
    Global $pStartColor = DllStructGetPtr($tStartColor)

    Global $tZoffset = DllStructCreate("float") ; this is determining the tail of passing stars
    DllStructSetData($tZoffset, 1, $tail) ; length of tail=============================================================
    Global $pZoffset = DllStructGetPtr($tZoffset)

    Global $tZincrement = DllStructCreate("float") ; I call this 'repetitive density value' ...or spead if you like
    DllStructSetData($tZincrement, 1, $speed) ; 0.28
    Global $pZincrement = DllStructGetPtr($tZincrement)

    Global $tThreshold = DllStructCreate("float") ; this structure will hold a threshold value
    DllStructSetData($tThreshold, 1, 5) ; value is 5 (star will be out of scope when 5 is reached)
    Global $pThreshold = DllStructGetPtr($tThreshold)


    ; SwapBuffers to fully use double-buffering
    Global $aSwapBuffers = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("gdi32.dll"), "str", "SwapBuffers")
    Global $pSwapBuffers = $aSwapBuffers[0]

    ; glClear to clean buffers
    Global $aglClear = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glClear")
    Global $pglClear = $aglClear[0]

    ; glBegin to initialize drawing procedure
    Global $aglBegin = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glBegin")
    Global $pglBegin = $aglBegin[0]

    ; glEnd to end drawing procedure
    Global $aglEnd = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glEnd")
    Global $pglEnd = $aglEnd[0]

    ; $pwglMakeCurrent for rendering context
    Global $awglMakeCurrent = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "wglMakeCurrent")
    Global $pwglMakeCurrent = $awglMakeCurrent[0]

    ; RtlRandomEx for generating random integers
    Global $aRtlRandomEx = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("ntdll.dll"), "str", "RtlRandomEx")
    Global $pRtlRandomEx = $aRtlRandomEx[0]

    ; glVertex3fv for drawing
    Global $aglVertex3fv = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glVertex3fv")
    Global $pglVertex3fv = $aglVertex3fv[0]

    ; glColor3fv for color of lines
    Global $aglColor3fv = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glColor3fv")
    Global $pglColor3fv = $aglColor3fv[0]


    ; Allocating enough memory (512 bytes) with $PAGE_EXECUTE_READWRITE
    Global $pRemoteCode = _MemVirtualAlloc(0, 512, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE)

    ; Standard allocation in reserved address (512 bytes again)
    Global $tCodeBuffer = DllStructCreate("byte[512]", $pRemoteCode)


    ; Writing to it (this is setting initial values - coordinates for aech and every star)
    DllStructSetData($tCodeBuffer, 1, _
            "0x" & _
            "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, $pInt
            "" & _
            "68" & SwapEndian($pRandom) & _                            ; push $pRandom
            "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
            "FFD0" & _                                                 ; call eax
            "99" & _                                                   ; cdq
            "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
            "F7F1" & _                                                 ; div ecx
            "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
            "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
            "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
            "D95B" & Hex(0, 2) & _                                     ; fstp 32real[ebx+0d]
            "" & _
            "68" & SwapEndian($pRandom) & _                            ; push $pRandom
            "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
            "FFD0" & _                                                 ; call eax
            "99" & _                                                   ; cdq
            "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
            "F7F1" & _                                                 ; div ecx
            "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
            "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
            "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
            "D95B" & Hex(4, 2) & _                                     ; fstp 32real[ebx+4d]
            "" & _
            "68" & SwapEndian($pRandom) & _                            ; push $pRandom
            "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
            "FFD0" & _                                                 ; call eax
            "99" & _                                                   ; cdq
            "B9" & SwapEndian(14316558) & _                            ; mov ecx, 14316558d
            "F7F1" & _                                                 ; div ecx
            "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
            "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
            "D9E0" & _                                                 ; fchs  ;<-  change sign of st(0)
            "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d]
            "" & _
            "81C3" & SwapEndian(12) & _                                ; add ebx, 12
            "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
            "75" & Hex(-124, 2) & _                                    ; jne -124 bytes ;<- go back 124 bytes if not equal
            "C3" _                                                     ; ret
            )

    ; Executing code
    DllCall("user32.dll", "int", "CallWindowProcW", _
            "ptr", $pRemoteCode, _
            "int", 0, _
            "int", 0, _
            "int", 0, _
            "int", 0)


    ; Writing new code (will use the same buffer since the code from it is already executed)
    DllStructSetData($tCodeBuffer, 1, _
            "0x" & _
            "" & _ ; >>>>>>>>>>>>>>>>>>>> GENERAL JOB <<<<<<<<<<<<<<<<<<<<<<<
            "" & _ ; 10. $hRC TO THIS THREAD (17 bytes code):
            "68" & SwapEndian($hRC) & _                                ; push $hRC
            "68" & SwapEndian($hDC) & _                                ; push $hDC
            "B8" & SwapEndian($pwglMakeCurrent) & _                    ; mov eax, wglMakeCurrent
            "FFD0" & _                                                 ; call eax ;<- calling function
            "" & _ ; 20. CLEAR BUFFERS (12 bytes code):
            "68" & SwapEndian(16640) & _                               ; push $GL_COLOR_BUFFER_BIT|$GL_DEPTH_BUFFER_BIT
            "B8" & SwapEndian($pglClear) & _                           ; mov eax, glClear
            "FFD0" & _                                                 ; call eax ;<- calling function
            "" & _ ; 30. WILL DRAW LINES - INITIALIZE LINES (12 bytes code):
            "68" & SwapEndian(1) & _                                   ; push $GL_LINES
            "B8" & SwapEndian($pglBegin) & _                           ; mov eax, glBegin
            "FFD0" & _                                                 ; call eax ;<- calling function
            "" & _ ; >>>>>>>>>>>>>>>>>>>> FIRST LOOP <<<<<<<<<<<<<<<<<<<<<<<
            "" & _ ; 40. INITIALIZE LOOP BY ASSIGNING INITIAL VALUE TO ebx (6 bytes code):
            "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, [$pInt] ;<- assigning ebx to address of $pStars (stored in $tInt)
            "" & _ ; 50. DETERMINING INITIAL COLOR (12 bytes code):
            "68" & SwapEndian($pStartColor) & _                        ; push $pStartColor ;<- this is float[3] with start color (r, g, b)
            "B8" & SwapEndian($pglColor3fv) & _                        ; mov eax, $pglColor3fv ;<- 'preparing' to call
            "FFD0" & _                                                 ; call eax ;<- calling glColor3fv function
            "" & _ ; 60. DETERMINING INITIAL POINT (8 bytes code):
            "53" & _                                                   ; push ebx ;<- this is float[3] with start coordinates (x, y, z)
            "B8" & SwapEndian($pglVertex3fv) & _                       ; mov eax, $pglVertex3fv ;<- 'preparing' to call
            "FFD0" & _                                                 ; call eax ;<- calling glVertex3fv function
            "" & _ ; 70. DETERMINING END COLOR (12 bytes code):
            "68" & SwapEndian($pEndColor) & _                          ; push $pEndColor ;<- this is float[3] with ending color (r, g, b)
            "B8" & SwapEndian($pglColor3fv) & _                        ; mov eax, $pglColor3fv
            "FFD0" & _                                                 ; call eax ;<- calling glColor3fv function
            "" & _ ; 80. DETERMINING END POINT (dislocate z coordinate by value of $tZoffset) (20 bytes code):
            "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
            "D825" & SwapEndian($pZoffset) & _                         ; fsub [$pZoffset] ; <- substract value stored in $tZoffset
            "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<- save changes and pop
            "53" & _                                                   ; push ebx ;<- this is float[3] with ending coordinates (x, y, z)
            "B8" & SwapEndian($pglVertex3fv) & _                       ; mov eax, $pglVertex3fv ;<- 'preparing' to call
            "FFD0" & _                                                 ; call eax ;<- calling glVertex3fv function
            "" & _ ; 90. RESTORE z COORDINATE (12 bytes code):
            "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
            "D805" & SwapEndian($pZoffset) & _                         ; fadd [$pZoffset] ;<- add value of $tZoffset
            "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<- save changes and pop
            "" & _ ; 100. ADD SIZE OF float[3] TO ebx (3 bytes code):
            "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
            "" & _ ; 110. COMPARE IT (6 bytes code):
            "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
            "" & _ ; 120. MAKE A CONDITION (2 bytes code):
            "73" & Hex(2, 2) & _                                       ; jnb 2d ;<- jump forward 2 bytes on not below; to <135>
            "" & _ ; 130. GO BACK (2 bytes code):
            "EB" & Hex(-77, 2) & _                                     ; jump -77d ;<- jump 77 bytes back otherwise; to <50>
            "" & _ ; >>>>>>>>>>>>>>>>>>>> GENERAL JOB <<<<<<<<<<<<<<<<<<<<<<<
            "" & _ ; 135. CALL glEnd FUNCTION (7 bytes code):
            "B8" & SwapEndian($pglEnd) & _                             ; mov eax, glEnd
            "FFD0" & _                                                 ; call eax ;<- calling glEnd
            "" & _ ; >>>>>>>>>>>>>>>>>>>> SECOND LOOP <<<<<<<<<<<<<<<<<<<<<<<
            "" & _ ; 140. INITIALIZING NEW LOOP (6 bytes code):
            "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, [$pInt] ;<- assigning ebx to address of $pStars (stored in $tInt)
            "" & _ ; 150. CHECK  THRESHOLD (12 bytes code):
            "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
            "D81D" & SwapEndian($pThreshold) & _                       ; fcomp [$pThreshold] ;<- compare st(0) to float at $tThreshold and pop
            "DFE0" & _                                                 ; fnstsw ax ; update ax register (this is essential for conditional jumps with floats)
            "9E" & _                                                   ; sahf ; copy ah register (same remark as above)
            "" & _ ; 160. MAKE A CONDITION (2 bytes code):
            "73" & Hex(25, 2) & _                                      ; jnb 25d ;<- jump 25 bytes forward on not below; to <220>
            "" & _ ; 170. 'MOVE' IT (12 bytes code):
            "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
            "D805" & SwapEndian($pZincrement) & _                      ; fadd [$pZincrement] ;<-  add (increment by) value of $tZincrement
            "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<-  save changes
            "" & _ ; 180. ADD SIZE OF float[3] TO ebx (3 bytes code):
            "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
            "" & _ ; 190. COMPARE IT (6 bytes code):
            "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
            "" & _ ; 200. MAKE A CONDITION (2 bytes code):
            "73" & Hex(103, 2) & _                                     ; jnb  103d ;<- jump forward 103 bytes on not below; to <290>
            "" & _ ; 210. GO BACK (2 bytes code):
            "EB" & Hex(-39, 2) & _                                     ; jump -39d ;<- jump 39 bytes back otherwise; to <150>
            "" & _ ; 220. GENERATE RANDOM INTEGER IN RANGE OF -25, 25 AND SAVE IT TO x COORDINATE FLOAT (37 bytes code):
            "68" & SwapEndian($pRandom) & _                            ; push $pRandom
            "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx ;<- 'preparing' to call
            "FFD0" & _                                                 ; call eax ;<- calling RtlRandomEx function
            "99" & _                                                   ; cdq
            "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
            "F7F1" & _                                                 ; div ecx
            "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
            "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
            "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
            "D95B" & Hex(0, 2) & _                                     ; fstp 32real[ebx+0d]
            "" & _ ; 230. GENERATE RANDOM INTEGER IN RANGE OF -25, 25 AND SAVE IT TO y COORDINATE FLOAT (37 bytes code):
            "68" & SwapEndian($pRandom) & _                            ; push $pRandom ;<-
            "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx ;<- 'preparing' to call
            "FFD0" & _                                                 ; call eax ;<- calling RtlRandomEx
            "99" & _                                                   ; cdq
            "B9" & SwapEndian(42949673) & _                            ; mov ecx, 4294967d
            "F7F1" & _                                                 ; div ecx
            "83E8" & Hex(25, 2) & _                                    ; sub eax, 250d
            "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
            "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
            "D95B" & Hex(4, 2) & _                                     ; fstp 32real[ebx+4d]
            "" & _ ; 240. SET z COORDINATE to -150 FLOAT VALUE (11 bytes code):
            "DB05" & SwapEndian($pInt2) & _                            ; fild $pInt2
            "D9E0" & _                                                 ; fchs  ;<-  change sign of st(0)
            "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<-  save it to proper location
            "" & _ ; 250. ADD SIZE OF float[3] TO ebx (3 bytes code):
            "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
            "" & _ ; 260. COMPARE IT (6 bytes code):
            "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
            "" & _ ; 270. MAKE A CONDITION (2 bytes code):
            "73" & Hex(5, 2) & _                                       ; jnb  5d ;<- jump forward 5 bytes on not below; to <290>
            "" & _ ; 280. GO BACK (5 bytes code):
            "E9" & SwapEndian(-140) & _                                ; jump -140d ;<- jump 140 bytes back otherwise; to <150>
            "" & _ ; 290. CALL SwapBuffers function (12 bytes code):
            "68" & SwapEndian($hDC) & _                                ; push $hDC
            "B8" & SwapEndian($pSwapBuffers) & _                       ; mov eax, SwapBuffers
            "FFD0" & _                                                 ; call eax ;<- calling SwapBuffers
            "" & _ ; 300. RETURN (1 byte code):
            "C3" _                                                    ; ret
            )


    ; associate contexts with the current thread
    DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDC, "hwnd", $hRC)

    ;Initializing gl environment
    _glClearColor(0, 0, 0, 1) ; we said black
    _glFogi($GL_FOG_MODE, $GL_LINEAR)
    _glFogfv($GL_FOG_COLOR, $pFogColor)
    _glFogf($GL_FOG_DENSITY, 0.1)
    _glHint($GL_FOG_HINT, $GL_DONT_CARE)
    _glFogf($GL_FOG_START, 70)
    _glFogf($GL_FOG_END, 150)
    _glEnable($GL_FOG)
    _glBlendFunc($GL_SRC_COLOR, $GL_DST_COLOR)
    _glEnable($GL_BLEND)

    ; Initially put things in place (literally)
    _glLoadIdentity()
    _glViewport(0, 0, $iWidthGUI, $iHeightGUI)
    _glMatrixMode($GL_PROJECTION)
    _glLoadIdentity()
    Global $nRatio = $iWidthGUI / $iHeightGUI
    _glFrustum(-$nRatio * 0.75, $nRatio * 0.75, -0.75, 0.75, 6, 150)
    _glMatrixMode($GL_MODELVIEW)


    ; Installing function to do the refreshment
    GUIRegisterMsg(133, "_Preserve") ; WM_NCPAINT

    ; Installing function to do handle resizing
    GUIRegisterMsg(5, "_ResizeGL") ; WM_SIZE

    ; Handling things on Exit
    ;GUISetOnEvent(-3, "_Quit") ; $GUI_EVENT_CLOSE



    ; Loop till the end
    While 1

        _GLDraw()
        Sleep(20)
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                ;_BlockInputEx(0)
;~              TrayBoxCreate("", "HAZIRLAYAN:" & @CRLF & "@mesale0077" & @CRLF & "Bilgi:" & @CRLF & "Ýlginiz için teþekkürler")
                Exit
            Case $Button1
                GUISetState(@SW_HIDE, $Form1)

                r1()
        EndSwitch
    WEnd


EndFunc   ;==>_Fofff

Func Close_skin()

    ToolTip("")



    ; Make a GUI
    ; Make a GUI
    Global $iWidthGUI = @DesktopWidth
    Global $iHeightGUI = @DesktopHeight

    Global $hGUI = GUICreate("OpenGL Space", $iWidthGUI, $iHeightGUI, 0, 0, $WS_POPUP, $WS_EX_TOPMOST)
    $Label1121 = GUICtrlCreateLabel("SÜRE BÝTTÝ !", (@DesktopWidth / 2) - 100, (@DesktopHeight / 2) - 100, 207, 41, $SS_CENTER)
    GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFFFFFF)

    Sleep(500)
    $Button2123 = GUICtrlCreateLabel("ÇIKIÞ", (@DesktopWidth / 2) - 50, (@DesktopHeight / 2) - 30, 92, 25, BitOR($SS_CENTER, $WS_BORDER), $WS_EX_CLIENTEDGE)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetBkColor(-1, 0x000000)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label3 = GUICtrlCreateLabel("Hazýrlayan: @mesale0077", (@DesktopWidth / 2) - 75, (@DesktopHeight / 2), 144, 17, $SS_CENTER)

    GUICtrlSetColor(-1, 0xFFFFFF)
    ; Black? Yes black.
    GUISetBkColor(0)

    ; Device context and rendering context
    Global $hDC, $hRC ; this two goes in _EnableOpenGL() ByRef

    ; Enabling OpenGL
    If Not _EnableOpenGL($hGUI, $hDC, $hRC) Then
        MsgBox(48, "Error", "Error initializing usage of OpenGL functions" & @CRLF & "Error code: " & @error) ; this is bad
        Exit
    EndIf

    ; Initially cleaning buffers - this is almost redundant. wglMakeCurrent is to associate rendering context with the current thread
    DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDC, "hwnd", $hRC)
    _glClear(BitOR($GL_COLOR_BUFFER_BIT, $GL_DEPTH_BUFFER_BIT)) ; initially cleaning buffers in case something is left there


    Global $tRandom = DllStructCreate("dword") ; this will hold generated random walues by RtlRandomEx function
    Global $pRandom = DllStructGetPtr($tRandom)

    Global $tFogColor = DllStructCreate("float[4]") ; fog color structure. Needed for _glFogfv function
    DllStructSetData($tFogColor, 1, 1, 4) ; other two values are 0
    Global $pFogColor = DllStructGetPtr($tFogColor)

    Global $tStars = DllStructCreate("float[" & 3 * $iNumStars & "]") ; this structure holds coordinates for every star
    Global $pStars = DllStructGetPtr($tStars)

    Global $tInt = DllStructCreate("dword") ; this will dynamically hold the address of $tStars
    DllStructSetData($tInt, 1, $pStars)
    Global $pInt = DllStructGetPtr($tInt)

    Global $tInt1 = DllStructCreate("int") ; this is placeholder for the integer used in assembly code in different places
    Global $pInt1 = DllStructGetPtr($tInt1)

    Global $tInt2 = DllStructCreate("int") ; this is placeholder for the float value of the same value. It's the main 'frequency'
    DllStructSetData($tInt2, 1, 150)
    Global $pInt2 = DllStructGetPtr($tInt2)

    Global $tEndColor = DllStructCreate("float[3]") ; this structure holds ending color of each star (same value for all of them)
    DllStructSetData($tEndColor, 1, 0.2, 3) ; other two values are 0
    Global $pEndColor = DllStructGetPtr($tEndColor)

    Global $tStartColor = DllStructCreate("float[3]") ; this structure holds start color for each star
    DllStructSetData($tStartColor, 1, 0.5, 1) ; color crap=============================================================
    DllStructSetData($tStartColor, 1, 0.9, 2) ; color crap=============================================================
    DllStructSetData($tStartColor, 1, 0.9, 3) ; color crap=============================================================
    Global $pStartColor = DllStructGetPtr($tStartColor)

    Global $tZoffset = DllStructCreate("float") ; this is determining the tail of passing stars
    DllStructSetData($tZoffset, 1, $tail) ; length of tail=============================================================
    Global $pZoffset = DllStructGetPtr($tZoffset)

    Global $tZincrement = DllStructCreate("float") ; I call this 'repetitive density value' ...or spead if you like
    DllStructSetData($tZincrement, 1, $speed) ; 0.28
    Global $pZincrement = DllStructGetPtr($tZincrement)

    Global $tThreshold = DllStructCreate("float") ; this structure will hold a threshold value
    DllStructSetData($tThreshold, 1, 5) ; value is 5 (star will be out of scope when 5 is reached)
    Global $pThreshold = DllStructGetPtr($tThreshold)


    ; SwapBuffers to fully use double-buffering
    Global $aSwapBuffers = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("gdi32.dll"), "str", "SwapBuffers")
    Global $pSwapBuffers = $aSwapBuffers[0]

    ; glClear to clean buffers
    Global $aglClear = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glClear")
    Global $pglClear = $aglClear[0]

    ; glBegin to initialize drawing procedure
    Global $aglBegin = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glBegin")
    Global $pglBegin = $aglBegin[0]

    ; glEnd to end drawing procedure
    Global $aglEnd = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glEnd")
    Global $pglEnd = $aglEnd[0]

    ; $pwglMakeCurrent for rendering context
    Global $awglMakeCurrent = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "wglMakeCurrent")
    Global $pwglMakeCurrent = $awglMakeCurrent[0]

    ; RtlRandomEx for generating random integers
    Global $aRtlRandomEx = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("ntdll.dll"), "str", "RtlRandomEx")
    Global $pRtlRandomEx = $aRtlRandomEx[0]

    ; glVertex3fv for drawing
    Global $aglVertex3fv = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glVertex3fv")
    Global $pglVertex3fv = $aglVertex3fv[0]

    ; glColor3fv for color of lines
    Global $aglColor3fv = DllCall("kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("opengl32.dll"), "str", "glColor3fv")
    Global $pglColor3fv = $aglColor3fv[0]


    ; Allocating enough memory (512 bytes) with $PAGE_EXECUTE_READWRITE
    Global $pRemoteCode = _MemVirtualAlloc(0, 512, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE)

    ; Standard allocation in reserved address (512 bytes again)
    Global $tCodeBuffer = DllStructCreate("byte[512]", $pRemoteCode)


    ; Writing to it (this is setting initial values - coordinates for aech and every star)
    DllStructSetData($tCodeBuffer, 1, _
            "0x" & _
            "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, $pInt
            "" & _
            "68" & SwapEndian($pRandom) & _                            ; push $pRandom
            "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
            "FFD0" & _                                                 ; call eax
            "99" & _                                                   ; cdq
            "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
            "F7F1" & _                                                 ; div ecx
            "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
            "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
            "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
            "D95B" & Hex(0, 2) & _                                     ; fstp 32real[ebx+0d]
            "" & _
            "68" & SwapEndian($pRandom) & _                            ; push $pRandom
            "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
            "FFD0" & _                                                 ; call eax
            "99" & _                                                   ; cdq
            "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
            "F7F1" & _                                                 ; div ecx
            "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
            "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
            "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
            "D95B" & Hex(4, 2) & _                                     ; fstp 32real[ebx+4d]
            "" & _
            "68" & SwapEndian($pRandom) & _                            ; push $pRandom
            "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx
            "FFD0" & _                                                 ; call eax
            "99" & _                                                   ; cdq
            "B9" & SwapEndian(14316558) & _                            ; mov ecx, 14316558d
            "F7F1" & _                                                 ; div ecx
            "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
            "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
            "D9E0" & _                                                 ; fchs  ;<-  change sign of st(0)
            "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d]
            "" & _
            "81C3" & SwapEndian(12) & _                                ; add ebx, 12
            "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
            "75" & Hex(-124, 2) & _                                    ; jne -124 bytes ;<- go back 124 bytes if not equal
            "C3" _                                                     ; ret
            )

    ; Executing code
    DllCall("user32.dll", "int", "CallWindowProcW", _
            "ptr", $pRemoteCode, _
            "int", 0, _
            "int", 0, _
            "int", 0, _
            "int", 0)


    ; Writing new code (will use the same buffer since the code from it is already executed)
    DllStructSetData($tCodeBuffer, 1, _
            "0x" & _
            "" & _ ; >>>>>>>>>>>>>>>>>>>> GENERAL JOB <<<<<<<<<<<<<<<<<<<<<<<
            "" & _ ; 10. $hRC TO THIS THREAD (17 bytes code):
            "68" & SwapEndian($hRC) & _                                ; push $hRC
            "68" & SwapEndian($hDC) & _                                ; push $hDC
            "B8" & SwapEndian($pwglMakeCurrent) & _                    ; mov eax, wglMakeCurrent
            "FFD0" & _                                                 ; call eax ;<- calling function
            "" & _ ; 20. CLEAR BUFFERS (12 bytes code):
            "68" & SwapEndian(16640) & _                               ; push $GL_COLOR_BUFFER_BIT|$GL_DEPTH_BUFFER_BIT
            "B8" & SwapEndian($pglClear) & _                           ; mov eax, glClear
            "FFD0" & _                                                 ; call eax ;<- calling function
            "" & _ ; 30. WILL DRAW LINES - INITIALIZE LINES (12 bytes code):
            "68" & SwapEndian(1) & _                                   ; push $GL_LINES
            "B8" & SwapEndian($pglBegin) & _                           ; mov eax, glBegin
            "FFD0" & _                                                 ; call eax ;<- calling function
            "" & _ ; >>>>>>>>>>>>>>>>>>>> FIRST LOOP <<<<<<<<<<<<<<<<<<<<<<<
            "" & _ ; 40. INITIALIZE LOOP BY ASSIGNING INITIAL VALUE TO ebx (6 bytes code):
            "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, [$pInt] ;<- assigning ebx to address of $pStars (stored in $tInt)
            "" & _ ; 50. DETERMINING INITIAL COLOR (12 bytes code):
            "68" & SwapEndian($pStartColor) & _                        ; push $pStartColor ;<- this is float[3] with start color (r, g, b)
            "B8" & SwapEndian($pglColor3fv) & _                        ; mov eax, $pglColor3fv ;<- 'preparing' to call
            "FFD0" & _                                                 ; call eax ;<- calling glColor3fv function
            "" & _ ; 60. DETERMINING INITIAL POINT (8 bytes code):
            "53" & _                                                   ; push ebx ;<- this is float[3] with start coordinates (x, y, z)
            "B8" & SwapEndian($pglVertex3fv) & _                       ; mov eax, $pglVertex3fv ;<- 'preparing' to call
            "FFD0" & _                                                 ; call eax ;<- calling glVertex3fv function
            "" & _ ; 70. DETERMINING END COLOR (12 bytes code):
            "68" & SwapEndian($pEndColor) & _                          ; push $pEndColor ;<- this is float[3] with ending color (r, g, b)
            "B8" & SwapEndian($pglColor3fv) & _                        ; mov eax, $pglColor3fv
            "FFD0" & _                                                 ; call eax ;<- calling glColor3fv function
            "" & _ ; 80. DETERMINING END POINT (dislocate z coordinate by value of $tZoffset) (20 bytes code):
            "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
            "D825" & SwapEndian($pZoffset) & _                         ; fsub [$pZoffset] ; <- substract value stored in $tZoffset
            "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<- save changes and pop
            "53" & _                                                   ; push ebx ;<- this is float[3] with ending coordinates (x, y, z)
            "B8" & SwapEndian($pglVertex3fv) & _                       ; mov eax, $pglVertex3fv ;<- 'preparing' to call
            "FFD0" & _                                                 ; call eax ;<- calling glVertex3fv function
            "" & _ ; 90. RESTORE z COORDINATE (12 bytes code):
            "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
            "D805" & SwapEndian($pZoffset) & _                         ; fadd [$pZoffset] ;<- add value of $tZoffset
            "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<- save changes and pop
            "" & _ ; 100. ADD SIZE OF float[3] TO ebx (3 bytes code):
            "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
            "" & _ ; 110. COMPARE IT (6 bytes code):
            "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
            "" & _ ; 120. MAKE A CONDITION (2 bytes code):
            "73" & Hex(2, 2) & _                                       ; jnb 2d ;<- jump forward 2 bytes on not below; to <135>
            "" & _ ; 130. GO BACK (2 bytes code):
            "EB" & Hex(-77, 2) & _                                     ; jump -77d ;<- jump 77 bytes back otherwise; to <50>
            "" & _ ; >>>>>>>>>>>>>>>>>>>> GENERAL JOB <<<<<<<<<<<<<<<<<<<<<<<
            "" & _ ; 135. CALL glEnd FUNCTION (7 bytes code):
            "B8" & SwapEndian($pglEnd) & _                             ; mov eax, glEnd
            "FFD0" & _                                                 ; call eax ;<- calling glEnd
            "" & _ ; >>>>>>>>>>>>>>>>>>>> SECOND LOOP <<<<<<<<<<<<<<<<<<<<<<<
            "" & _ ; 140. INITIALIZING NEW LOOP (6 bytes code):
            "8B1D" & SwapEndian($pInt) & _                             ; mov ebx, [$pInt] ;<- assigning ebx to address of $pStars (stored in $tInt)
            "" & _ ; 150. CHECK  THRESHOLD (12 bytes code):
            "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
            "D81D" & SwapEndian($pThreshold) & _                       ; fcomp [$pThreshold] ;<- compare st(0) to float at $tThreshold and pop
            "DFE0" & _                                                 ; fnstsw ax ; update ax register (this is essential for conditional jumps with floats)
            "9E" & _                                                   ; sahf ; copy ah register (same remark as above)
            "" & _ ; 160. MAKE A CONDITION (2 bytes code):
            "73" & Hex(25, 2) & _                                      ; jnb 25d ;<- jump 25 bytes forward on not below; to <220>
            "" & _ ; 170. 'MOVE' IT (12 bytes code):
            "D943" & Hex(8, 2) & _                                     ; fld 32real[ebx+8d] ;<-  load float (z coordinate)
            "D805" & SwapEndian($pZincrement) & _                      ; fadd [$pZincrement] ;<-  add (increment by) value of $tZincrement
            "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<-  save changes
            "" & _ ; 180. ADD SIZE OF float[3] TO ebx (3 bytes code):
            "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
            "" & _ ; 190. COMPARE IT (6 bytes code):
            "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
            "" & _ ; 200. MAKE A CONDITION (2 bytes code):
            "73" & Hex(103, 2) & _                                     ; jnb  103d ;<- jump forward 103 bytes on not below; to <290>
            "" & _ ; 210. GO BACK (2 bytes code):
            "EB" & Hex(-39, 2) & _                                     ; jump -39d ;<- jump 39 bytes back otherwise; to <150>
            "" & _ ; 220. GENERATE RANDOM INTEGER IN RANGE OF -25, 25 AND SAVE IT TO x COORDINATE FLOAT (37 bytes code):
            "68" & SwapEndian($pRandom) & _                            ; push $pRandom
            "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx ;<- 'preparing' to call
            "FFD0" & _                                                 ; call eax ;<- calling RtlRandomEx function
            "99" & _                                                   ; cdq
            "B9" & SwapEndian(42949673) & _                            ; mov ecx, 42949673d
            "F7F1" & _                                                 ; div ecx
            "83E8" & Hex(25, 2) & _                                    ; sub eax, 25d
            "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
            "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
            "D95B" & Hex(0, 2) & _                                     ; fstp 32real[ebx+0d]
            "" & _ ; 230. GENERATE RANDOM INTEGER IN RANGE OF -25, 25 AND SAVE IT TO y COORDINATE FLOAT (37 bytes code):
            "68" & SwapEndian($pRandom) & _                            ; push $pRandom ;<-
            "B8" & SwapEndian($pRtlRandomEx) & _                       ; mov eax, RtlRandomEx ;<- 'preparing' to call
            "FFD0" & _                                                 ; call eax ;<- calling RtlRandomEx
            "99" & _                                                   ; cdq
            "B9" & SwapEndian(42949673) & _                            ; mov ecx, 4294967d
            "F7F1" & _                                                 ; div ecx
            "83E8" & Hex(25, 2) & _                                    ; sub eax, 250d
            "A3" & SwapEndian($pInt1) & _                              ; mov $pInt1, eax
            "DB05" & SwapEndian($pInt1) & _                            ; fild $pInt1
            "D95B" & Hex(4, 2) & _                                     ; fstp 32real[ebx+4d]
            "" & _ ; 240. SET z COORDINATE to -150 FLOAT VALUE (11 bytes code):
            "DB05" & SwapEndian($pInt2) & _                            ; fild $pInt2
            "D9E0" & _                                                 ; fchs  ;<-  change sign of st(0)
            "D95B" & Hex(8, 2) & _                                     ; fstp 32real[ebx+8d] ;<-  save it to proper location
            "" & _ ; 250. ADD SIZE OF float[3] TO ebx (3 bytes code):
            "83C3" & Hex(12, 2) & _                                    ; add ebx, 12 ;<- add 12 to ebx. That is the size of float[3]
            "" & _ ; 260. COMPARE IT (6 bytes code):
            "81FB" & SwapEndian($pStars + $iNumStars * 12) & _         ; cmp ebx, $pStars+$iNumStars*12 ; <- compare ebx with $pStars+$iNumStars*size of float[3]
            "" & _ ; 270. MAKE A CONDITION (2 bytes code):
            "73" & Hex(5, 2) & _                                       ; jnb  5d ;<- jump forward 5 bytes on not below; to <290>
            "" & _ ; 280. GO BACK (5 bytes code):
            "E9" & SwapEndian(-140) & _                                ; jump -140d ;<- jump 140 bytes back otherwise; to <150>
            "" & _ ; 290. CALL SwapBuffers function (12 bytes code):
            "68" & SwapEndian($hDC) & _                                ; push $hDC
            "B8" & SwapEndian($pSwapBuffers) & _                       ; mov eax, SwapBuffers
            "FFD0" & _                                                 ; call eax ;<- calling SwapBuffers
            "" & _ ; 300. RETURN (1 byte code):
            "C3" _                                                    ; ret
            )


    ; associate contexts with the current thread
    DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDC, "hwnd", $hRC)

    ;Initializing gl environment
    _glClearColor(0, 0, 0, 1) ; we said black
    _glFogi($GL_FOG_MODE, $GL_LINEAR)
    _glFogfv($GL_FOG_COLOR, $pFogColor)
    _glFogf($GL_FOG_DENSITY, 0.1)
    _glHint($GL_FOG_HINT, $GL_DONT_CARE)
    _glFogf($GL_FOG_START, 70)
    _glFogf($GL_FOG_END, 150)
    _glEnable($GL_FOG)
    _glBlendFunc($GL_SRC_COLOR, $GL_DST_COLOR)
    _glEnable($GL_BLEND)

    ; Initially put things in place (literally)
    _glLoadIdentity()
    _glViewport(0, 0, $iWidthGUI, $iHeightGUI)
    _glMatrixMode($GL_PROJECTION)
    _glLoadIdentity()
    Global $nRatio = $iWidthGUI / $iHeightGUI
    _glFrustum(-$nRatio * 0.75, $nRatio * 0.75, -0.75, 0.75, 6, 150)
    _glMatrixMode($GL_MODELVIEW)


    ; Installing function to do the refreshment
    GUIRegisterMsg(133, "_Preserve") ; WM_NCPAINT

    ; Installing function to do handle resizing
    GUIRegisterMsg(5, "_ResizeGL") ; WM_SIZE

    ; Handling things on Exit
    ;GUISetOnEvent(-3, "_Quit") ; $GUI_EVENT_CLOSE
    MouseMove((@DesktopWidth / 2) - 35, (@DesktopHeight / 2) - 20)
    ; Show GUI
    GUISetState(@SW_SHOW, $hGUI)


    ; Loop till the end
    ;While 1

    ;_GLDraw()
    ;Sleep(20)

    ;WEnd

    While 1

        If ProcessExists('Taskmgr.exe') Then
            ProcessClose('Taskmgr.exe')
            ;GUISetState()
        EndIf
        _GLDraw()
        Sleep(20)
        $nMsg = GUIGetMsg()
        Switch $nMsg
            ;Case $GUI_EVENT_CLOSE
            ;_Quit()
            Case $Button2123
                GUICtrlSetData($Button2123, "çýkýþ")
                Sleep(200)

                GUICtrlSetData($Button2123, "ÇIKIÞ")
                ;_BlockInputEx(0)


                _Quit()
        EndSwitch
    WEnd


EndFunc   ;==>Close_skin
Func r1()
    Local $eieie = GUICtrlRead($Input1)
    $start_1 = @HOUR & ":" & @MIN + $eieie
    If @MIN + GUICtrlRead($Input1) < 10 Then
        $start_1 = @HOUR & ":0" & @MIN + $eieie
    EndIf
    While 1
        $start2 = @HOUR & ":" & @MIN
        ToolTip(" ", @DesktopWidth - 220, @DesktopHeight - 120, "Bilgi: " & GUICtrlRead($Input1) & " dakika sonra baþlayacak", 1)
        If $start_1 = $start2 Then
            Beep(300, 500)
            rr1()



        EndIf
    WEnd
EndFunc   ;==>r1
Func rr1()
    Beep(300, 500)
    r2()


EndFunc   ;==>rr1



Func r2()

    Global $start = @HOUR & ":" & @MIN
    Global $Minutes = GUICtrlRead($Input2) ; will wait 90 minutes

    Global $60Count = 0, $begin = TimerInit()
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                TrayBoxCreate("", "HAZIRLAYAN:" & @CRLF & "@mesale0077" & @CRLF & "Bilgi:" & @CRLF & "Ýlginiz için teþekkürler")
                Exit


        EndSwitch


        If $Minutes > $60Count Then

            $dif = TimerDiff($begin)
            $dif2 = StringLeft($dif, StringInStr($dif, ".") - 1)
            $Count = Int($dif / 1000)
            $60Count = Int($Count / 60)

            ;ToolTip("Minutes Required = " & $Minutes & @CRLF & "Minutes Past = " & $60Count & @CRLF & "Seconds Count = " & $Count & @CRLF & "Mili-Seconds Count = " & $dif2, 20, 20, "Time Machine #1", 1)
            ; TrayTip("Bilgi: 2.Reklamý gösterecek", "Baþlama dakikasý = " & $Minutes & @CRLF & "Geçen dakika = " & $60Count & @CRLF & "Geçen saniye = " & $Count ,"",1)

            ToolTip("Baþlama saati = " & $start & @CRLF & "Þimdiki saat = " & @HOUR & ":" & @MIN & @CRLF & "Geçen dakika = " & $60Count, @DesktopWidth - 220, @DesktopHeight - 120, "Bilgi: " & GUICtrlRead($Input2) & " dakika sonra bitecek", 1)

        Else

            rr2()
        EndIf
    WEnd
EndFunc   ;==>r2
Func rr2()

    Beep(300, 500)
    ;_DisableOpenGL($Form1, $hDC, $hRC)

    ToolTip("")

    Close_skin()


EndFunc   ;==>rr2

Func Close()

    Select

        Case @TRAY_ID = $exititem_2

            TrayBoxCreate("", "HAZIRLAYAN:" & @CRLF & "@mesale0077" & @CRLF & "Bilgi:" & @CRLF & "Ýlginiz için teþekkürler")
        Case @TRAY_ID = $exititem_1
            ;ScriptRestart()
            _DisableOpenGL($Form1, $hDC, $hRC)
            _Self_Restart(1)
        Case @TRAY_ID = $exititem
            ToolTip("")
            #cs                     #NoTrayIcon
                Opt("TrayIconHide", 1)

                TrayBoxCreate("", "HAZIRLAYAN:"&@CRLF&"@mesale0077"&@CRLF&"Bilgi:"&@CRLF&"Ýlginiz için teþekkürler")
            #ce
            TrayBoxCreate("", "HAZIRLAYAN:" & @CRLF & "@mesale0077" & @CRLF & "Bilgi:" & @CRLF & "Ýlginiz için teþekkürler")

            Exit


    EndSelect

EndFunc   ;==>Close
Func TrayBoxCreate($TBTitle, $TBText, $display_Time = 2500)
    $TBgui = GUICreate($TBTitle, 250, 100, @DesktopWidth - 300, @DesktopHeight - 150, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
    _GuiRoundCorners($TBgui, 0, 0, 100, 100)
    GUISetBkColor(0x0000FF)
    $Status = GUICtrlCreateLabel($TBText, 40, 20, 210, 100)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0xFFFFFF)

    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00040008);slide-in from bottom

    GUISetState()
    Sleep($display_Time)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1500, "long", 0x00040008);slide-in from bottom
    GUISetState(@SW_SHOW, $TBgui)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00050010);implode
    GUISetState(@SW_HIDE, $TBgui)

EndFunc   ;==>TrayBoxCreate


Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
    Dim $pos, $ret, $ret2
    $pos = WinGetPos($h_win)
    $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3)
    If $ret[0] Then
        $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
        If $ret2[0] Then
            Return 1
        Else
            Return 0
        EndIf
    Else
        Return 0
    EndIf
EndFunc   ;==>_GuiRoundCorners
#cs
    Func ScriptRestart()
    ;BySpenger120
    Switch @Compiled
    Case True
    Run(@ScriptFullPath)
    Case False
    ShellExecute(@AutoItExe,@ScriptFullPath)
    EndSwitch
    Exit
    EndFunc   ;==>ScriptRestart
#ce

Func _Self_Restart($iTime)
    Run(@ComSpec & ' /c Ping -n ' & $iTime & ' localhost > nul & "' & @ScriptFullPath & '" /CmdLineRun', @ScriptDir, @SW_HIDE)
    Exit
EndFunc   ;==>_Self_Restart


; USED FUNCTIONS:

Func _GLDraw()

    DllCall("user32.dll", "int", "CallWindowProcW", _
            "ptr", $pRemoteCode, _
            "int", 0, _
            "int", 0, _
            "int", 0, _
            "int", 0)

EndFunc   ;==>_GLDraw


Func SwapEndian($iValue)
    Return Hex(BinaryMid($iValue, 1, 4))
EndFunc   ;==>SwapEndian


Func _EnableOpenGL($hWnd, ByRef $hDeviceContext, ByRef $hOpenGLRenderingContext)

    Local $tPIXELFORMATDESCRIPTOR = DllStructCreate("ushort Size;" & _
            "ushort Version;" & _
            "dword Flags;" & _
            "ubyte PixelType;" & _
            "ubyte ColorBits;" & _
            "ubyte RedBits;" & _
            "ubyte RedShift;" & _
            "ubyte GreenBits;" & _
            "ubyte GreenShift;" & _
            "ubyte BlueBits;" & _
            "ubyte BlueShift;" & _
            "ubyte AlphaBits;" & _
            "ubyte AlphaShift;" & _
            "ubyte AccumBits;" & _
            "ubyte AccumRedBits;" & _
            "ubyte AccumGreenBits;" & _
            "ubyte AccumBlueBits;" & _
            "ubyte AccumAlphaBits;" & _
            "ubyte DepthBits;" & _
            "ubyte StencilBits;" & _
            "ubyte AuxBuffers;" & _
            "ubyte LayerType;" & _
            "ubyte Reserved;" & _
            "dword LayerMask;" & _
            "dword VisibleMask;" & _
            "dword DamageMask")

    DllStructSetData($tPIXELFORMATDESCRIPTOR, "Size", DllStructGetSize($tPIXELFORMATDESCRIPTOR))
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "Version", $GL_VERSION_1_1)
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "Flags", BitOR($PFD_DRAW_TO_WINDOW, $PFD_SUPPORT_OPENGL, $PFD_DOUBLEBUFFER))
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "PixelType", $PFD_TYPE_RGBA)
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "ColorBits", 24)
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "DepthBits", 32)
    DllStructSetData($tPIXELFORMATDESCRIPTOR, "LayerType", $PFD_MAIN_PLANE)

    Local $a_hCall = DllCall("kernel32.dll", "hwnd", "GetModuleHandleW", "wstr", "opengl32.dll")
    If @error Then
        Return SetError(1, 0, 0) ; what???
    EndIf

    If Not $a_hCall[0] Then
        If DllOpen("opengl32.dll") = -1 Then
            Return SetError(2, 0, 0) ; could not open opengl32.dll
        EndIf
    EndIf

    $a_hCall = DllCall("user32.dll", "hwnd", "GetDC", "hwnd", $hWnd)

    If @error Or Not $a_hCall[0] Then
        Return SetError(3, 0, 0) ; could not retrieve a handle to a device context
    EndIf

    $hDeviceContext = $a_hCall[0]

    Local $a_iCall = DllCall("gdi32.dll", "int", "ChoosePixelFormat", "hwnd", $hDeviceContext, "ptr", DllStructGetPtr($tPIXELFORMATDESCRIPTOR))
    If @error Or Not $a_iCall[0] Then
        Return SetError(4, 0, 0) ; could not match an appropriate pixel format
    EndIf
    Local $iFormat = $a_iCall[0]

    $a_iCall = DllCall("gdi32.dll", "int", "SetPixelFormat", "hwnd", $hDeviceContext, "int", $iFormat, "ptr", DllStructGetPtr($tPIXELFORMATDESCRIPTOR))
    If @error Or Not $a_iCall[0] Then
        Return SetError(5, 0, 0) ; could not set the pixel format of the specified device context to the specified format
    EndIf

    $a_hCall = DllCall("opengl32.dll", "hwnd", "wglCreateContext", "hwnd", $hDeviceContext)
    If @error Or Not $a_hCall[0] Then
        Return SetError(6, 0, 0) ; could not create a rendering context
    EndIf

    $hOpenGLRenderingContext = $a_hCall[0]

    Return SetError(0, 0, 1) ; all OK!

EndFunc   ;==>_EnableOpenGL


Func _DisableOpenGL($hWnd, $hDeviceContext, $hOpenGLRenderingContext)

    ; No point in doing error checking if this is done on exit. Will just call the cleaning functions.

    DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", 0, "hwnd", 0)
    DllCall("opengl32.dll", "int", "wglDeleteContext", "hwnd", $hOpenGLRenderingContext)
    DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hWnd, "hwnd", $hDeviceContext)

EndFunc   ;==>_DisableOpenGL


Func _ResizeGL($hWnd, $iMsg, $wParam, $lParam)

    ; dealing with AU3Check.exe
    #forceref $hWnd, $iMsg, $wParam

    ; associate contexts with the current thread
    DllCall("opengl32.dll", "int", "wglMakeCurrent", "hwnd", $hDC, "hwnd", $hRC)

    ; determine the size of our window
    Local $aClientSize[2] = [BitAND($lParam, 65535), BitShift($lParam, 16)] ; window dimension

    ; process changes... adopt to them
    _glLoadIdentity()
    _glViewport(0, 0, $aClientSize[0], $aClientSize[1])
    _glMatrixMode($GL_PROJECTION)
    _glLoadIdentity()
    Local $nRatio = $aClientSize[0] / $aClientSize[1]
    _glFrustum(-$nRatio * .75, $nRatio * .75, -.75, .75, 6.0, 150.0)
    _glMatrixMode($GL_MODELVIEW)

EndFunc   ;==>_ResizeGL


Func _glBegin($iMode)
    DllCall("opengl32.dll", "none", "glBegin", "dword", $iMode)
EndFunc   ;==>_glBegin


Func _glBlendFunc($iSfactor, $iDfactor)
    DllCall("opengl32.dll", "none", "glBlendFunc", "dword", $iSfactor, "dword", $iDfactor)
EndFunc   ;==>_glBlendFunc


Func _glColor3fv($pColorFloat)
    DllCall("opengl32.dll", "none", "glColor3fv", "ptr", $pColorFloat)
EndFunc   ;==>_glColor3fv


Func _glClear($iMask)
    DllCall("opengl32.dll", "none", "glClear", "dword", $iMask)
EndFunc   ;==>_glClear


Func _glClearColor($nRed, $nGreen, $nBlue, $nAlpha)
    DllCall("opengl32.dll", "none", "glClearColor", "float", $nRed, "float", $nGreen, "float", $nBlue, "float", $nAlpha)
EndFunc   ;==>_glClearColor


Func _glEnable($iCap)
    DllCall("opengl32.dll", "none", "glEnable", "dword", $iCap)
EndFunc   ;==>_glEnable


Func _glEnd()
    DllCall("opengl32.dll", "none", "glEnd")
EndFunc   ;==>_glEnd


Func _glFrustum($nLeft, $nRight, $nBottom, $nTop, $nZNear, $nZFar)
    DllCall("opengl32.dll", "none", "glFrustum", "double", $nLeft, "double", $nRight, "double", $nBottom, "double", $nTop, "double", $nZNear, "double", $nZFar)
EndFunc   ;==>_glFrustum


Func _glFogf($iName, $nParam)
    DllCall("opengl32.dll", "none", "glFogf", "dword", $iName, "float", $nParam)
EndFunc   ;==>_glFogf


Func _glFogi($iName, $iParam)
    DllCall("opengl32.dll", "none", "glFogi", "dword", $iName, "dword", $iParam)
EndFunc   ;==>_glFogi


Func _glFogfv($iName, $pParams)
    DllCall("opengl32.dll", "none", "glFogfv", "dword", $iName, "ptr", $pParams)
EndFunc   ;==>_glFogfv


Func _glHint($iTarget, $iMode)
    DllCall("opengl32.dll", "none", "glHint", "dword", $iTarget, "dword", $iMode)
EndFunc   ;==>_glHint


Func _glLoadIdentity()
    DllCall("opengl32.dll", "none", "glLoadIdentity")
EndFunc   ;==>_glLoadIdentity


Func _glMatrixMode($iMode)
    DllCall("opengl32.dll", "none", "glMatrixMode", "dword", $iMode)
EndFunc   ;==>_glMatrixMode


Func _glViewport($iX, $iY, $iWidth, $iHeight)
    DllCall("opengl32.dll", "none", "glViewport", "int", $iX, "int", $iY, "dword", $iWidth, "dword", $iHeight)
EndFunc   ;==>_glViewport


Func _glVertex3fv($pPointer)
    DllCall("opengl32.dll", "none", "glVertex3fv", "ptr", $pPointer)
EndFunc   ;==>_glVertex3fv


Func _SwapBuffers($hDC)
    DllCall("gdi32.dll", "int", "SwapBuffers", "hwnd", $hDC)
EndFunc   ;==>_SwapBuffers



Func _Preserve()
    _SwapBuffers($hDC)
EndFunc   ;==>_Preserve


Func _Quit()
    _DisableOpenGL($hGUI, $hDC, $hRC)
    _Self_Restart(1)
    ;Exit
EndFunc   ;==>_Quit

Br,

UEZ

Edited by UEZ
  • Like 1

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this