PDA

View Full Version : Dll-Test



peter
12-01-2011, 10:36
Hi,

I wrote a Dll with Oxygen and wanted to know whether it runs also with thinbasic.
I am satisfied ! Thank you Charles and Eros !

Don't press the close button of this window!
It won't close this application, instead take the escape key.

Peter


Uses "UI","DRAWS"
Declare Function GetDC Lib "user32.dll" Alias "GetDC" (ByVal hwnd As Long) As Long
Declare Function GetKey Lib "user32.dll" Alias "GetAsyncKeyState" (ByVal vKey As Long) As Integer
Declare Function TextOut Lib "gdi32.dll" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Declare Function TextColor Lib "gdi32.dll" Alias "SetTextColor"(ByVal hdc As Long, ByVal crColor As Long) As Long
Declare Function SetBkMode Lib "gdi32.dll" Alias "SetBkMode" (ByVal hdc As Long, ByVal nBkMode As Long) As Long

Declare Function DrawCircle Lib "Draws.dll" Alias "DrawCircle" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal r As Long, ByVal Color As Long)
Declare Function DrawBox Lib "Draws.dll" Alias "DrawBox" (ByVal hdc As Long, ByVal x1 As Long,ByVal y1 As Long,ByVal x2 As Long,ByVal y2 As Long,ByVal Color As Long)
Declare Function DrawEllipse Lib "Draws.dll" Alias "DrawEllipse" (ByVal hdc As Long, ByVal mx As Long,ByVal my As Long,ByVal r1 As Long,ByVal r2 As Long,ByVal Color As Long)
Declare Function DrawLine Lib "Draws.dll" Alias "DrawLine" (ByVal hdc As Long, ByVal x2 As Long,ByVal y2 As Long,ByVal x3 As Long,ByVal y3 As Long,ByVal Color As Long)


Dim hwnd,hdc,jx As Long
Dim Isay As String
Isay = "PRESS ESCAPE KEY!"

hwnd = Canvas_Window("Dll_Test",0,0,800,600)
hdc = GetDC(hwnd)
TextColor hdc,&H006400
SetBkMode hdc,1

DrawCircle hdc,50, 50,40,&HB00000
DrawCircle hdc,738,50,40,&HC00000
DrawBox hdc,10, 10,768,780,255*34825
DrawLine hdc,10,580,776,580,255*34825
For jx=0 To 49
DrawEllipse hdc,250,300,200+jx,150-jx,&H80FF80*jx
DrawEllipse hdc,620,300,150-jx,200+jx,&HFF80FF*jx
Next

While GetKey(27) =0
TextOut hdc,322,32,Isay,Len(Isay)
Wend

zak
12-01-2011, 18:33
very beautiful figures, it resembles the Möbius strip en.wikipedia.org/wiki/Möbius_strip
i think that it may be possible to use blit to make the draw sustained on the form, i forgot how to do that. some discussions are here:
http://www.thinbasic.com/community/showthread.php?10654-GDI&highlight=blit

Petr Schreiber
12-01-2011, 19:23
Hi Peter,

my NOD32 antivirus gives me virus warning on the download. It is probably false positive because Charles does some cutting edge optimizations again, but I thought I will let you know.


Petr

peter
12-01-2011, 20:34
Hi Petr,

That could be interesting for Charles!

thanks.

Charles Pegge
13-01-2011, 12:52
Every time I make a change to the top end of the code some antiVirus systems protest! - usually it is only 2 out of the 43 listed in VirusTotal. If you get any false positives then please submit them to your antivirus provider. I will try to do the same but some providers appear to restrict submission to users only.

Many Thanks

Charles

Petr Schreiber
13-01-2011, 16:59
Will do :)

kryton9
13-01-2011, 22:59
When I copy and paste the code it loses the crlf. How did you guys get around it?
The rar file just had the dll file and no script in my download.

peter
13-01-2011, 23:50
Hi k9,

there isn't more in the RAR file other than a DLL!

lol