AutoHotkey Community

It is currently May 27th, 2012, 4:20 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 59 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
 Post subject:
PostPosted: April 6th, 2009, 2:37 am 
Offline

Joined: November 27th, 2008, 9:44 am
Posts: 62
I've been looking for ways to create interactive GUI's with GDI+ and found the TTG example that tic refers to a few posts above.

I wrote the following script as research/preparation for another script I'm working on, but I think it's a reasonable example of one way to create interactive GDI+ gui's (I mean, it kinda has to be - it's largely based off of tic's TTG stuff :) ).

Right now, it will just display screenshots of the first 4 windows in the AltTab cycle (i limited it to 4 for anybody on smaller resolution screens - right now it's not smart about detecting screen sizes and adjusting, etc.). Also, it has a close button that works.

Image

I had fun playing around with this and I hope it can help somebody.

Code:
#SingleInstance, Force
#NoEnv
CoordMode, Mouse, Screen
SetBatchLines, -1

; Start gdi+
If !pToken := Gdip_Startup()
{
   MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
   ExitApp
}
OnExit, Exit

; Create the window we'll be redrawing on and save its handle
Gui, 1: -Caption +E0x80000 +LastFound +OwnDialogs
Gui, 1: Show, NA, This is my script
hgui1 := WinExist()

; Get open window list
alist := AltTabList(hgui1)

; Get bitmaps of windows in the list
Loop, parse, alist, `,
{
   if (A_Index > 4)
      break
   
   pBitmap%A_Index% := Gdip_BitmapFromHWND(A_LoopField)
   WinGetPos, , , w%A_Index%, h%A_Index%, ahk_id %A_LoopField%
   if (w%A_Index% > h%A_Index%)
   {
      ww%A_Index% := 200
      wh%A_Index% := 200 * (h%A_Index%/w%A_Index%)
      wx%A_Index% := 50 + ((A_Index-1) * 230)
      wy%A_Index% := 50 + floor((200 - wh%A_Index%)/2)
   }
   else
   {
      ww%A_Index% := 200 * (w%A_Index%/h%A_Index%)
      wh%A_Index% := 200
      wx%A_Index% := 50 + ((A_Index-1) * 230) + floor((200 - ww%A_Index%)/2)
      wy%A_Index% := 50
   }
   ; set up region information for hovering stuff
   %A_Index%_x := 35 + ((A_Index-1) * 230)
   %A_Index%_y := 35
   %A_Index%_w := 230
   %A_Index%_h := 230
   regions .= "," A_Index

   ; get window title
   WinGetTitle, %A_Index%_title, ahk_id %A_LoopField%

   ; remember how many windows there are
   windowcount := A_Index      
}

; Set the width and height of the main window
gw := (windowcount * 230) + 30 + 40
gh := 350

; 1. Create a gdi bitmap of the appropriate width and height
; 2. Get a compatiable device context
; 3. Select the bitmap into the device context
; 4. Get a pointer to the graphics of the bitmap
hbm := CreateDIBSection(gw, gh)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc)

; Set the smoothing mode to antialias = 4
Gdip_SetSmoothingMode(G, 4)
Gdip_SetInterpolationMode(G, 7)

; Draw the main gui rectangle
pBrush := Gdip_BrushCreateSolid(0xaa000000)
Gdip_FillRectangle(G, pBrush, 0, 0, gw, gh)
Gdip_DeleteBrush(pBrush)

; ; Draw the "close" x and the "minimize" line
cb_x := gw - 25
cb_y := 0
cb_w := 25
cb_h := 25
pPen := Gdip_CreatePen(0xffffffff, 2)
Gdip_DrawLine(G, pPen, cb_x+6, cb_y+6, cb_x+cb_w-6, cb_y+cb_h-6)
Gdip_DrawLine(G, pPen, cb_x+cb_w-6, cb_y+6, cb_x+6, cb_y+cb_h-6)
Gdip_DeletePen(pPen)
regions .= ",cb"

; Draw the screenshots onto the main gui rectangle
Loop, % windowcount
   Gdip_DrawImage(G, pBitmap%A_Index%, wx%A_Index%, wy%A_Index%, ww%A_Index%, wh%A_Index%, 0, 0, w%A_Index%, h%A_Index%)


; Update the window
UpdateLayeredWindow(hgui1, hdc, (A_ScreenWidth-gw)//2, (A_ScreenHeight-gh)//2, gw, gh)

; Catch left-buttonclick messages
OnMessage(0x201, "WM_LBUTTONDOWN")

; Set the timer to check if the mouse is over the close button
SetTimer, CheckPos, 10

return

test:
return

AltTabList(exclusions)
{
    static WS_EX_CONTROLPARENT = 0x10000, WS_EX_APPWINDOW = 0x40000, WS_EX_TOOLWINDOW = 0x80, WS_DISABLED = 0x8000000, WS_POPUP = 0x80000000

   WinGet, wlist, List
   Loop, %wlist%
   {
      hWnd := wlist%A_Index%
      if hwnd in %exclusions%
         continue
      WinGetTitle, wtitle, ahk_id %hWnd%
       WinGet, wstyle, Style, ahk_id %hWnd%
       WinGet, wexstyle, ExStyle, ahk_id %hWnd%
       WinGetClass, wclass, ahk_id %wid%
       hParent := DllCall( "GetParent", uint, hWnd )      
       WinGet, parentstyle, Style, ahk_id %hParent%
       
       If (wstyle & WS_DISABLED)                     ; ignore disabled windows
          or (!wtitle)                           ; and titleless windows
          or (wexstyle & WS_EX_TOOLWINDOW)            ; and toolwindows
          or ( (wexstyle & WS_EX_CONTROLPARENT)          ; and PSPad child windows
             and !(wstyle & WS_POPUP)                ; (presumably other MDI children
             and !(wclass = "#32770")                ;  as well)
             and ! (wexstyle & WS_EX_APPWINDOW) )      ;
          or ( (wstyle & WS_POPUP)                   ; and Notepad find window
             and (hParent)
             and (parentstyle & WS_DISABLED) = 0 )
            continue
         alttablist .= hWnd ","                        ; Add the hWnd to the list
    }
    StringTrimRight, alttablist, alttablist, 1
    return alttablist 
}


WM_LBUTTONDOWN(wParam, lParam, msg, hWnd)
{
   global   
   if (oldrgn="cb")
      exitapp
   if (oldrgn+0)
   {
      msgbox % "you clicked:`n" %oldrgn%_title
   }
}


CheckPos:
   ; Get mouse location
   MouseGetPos, x, y, hwnd
   if (hwnd != hgui1)
      return
   WinGetPos, wx, wy, , , ahk_id %hgui1%
   x -= wx, y -= wy
   
   ; Is the mouse over a predefined region?
   rgn := 0
   loop, parse, regions, `,
      if (x >= %A_LoopField%_x) and (x <= %A_LoopField%_x + %A_LoopField%_w) and (y >= %A_LoopField%_y) and (y <= %A_LoopField%_y + %A_LoopField%_h)
         rgn := A_LoopField
      
   ; If the region hasn't changed, don't do anything
   if (rgn = oldrgn)
      return      

   if (rgn = "cb") or (oldrgn = "cb") ; the close button
   {
      Gdip_SetCompositingMode(G, 1)
      Gdip_SetClipRect(G, cb_x, cb_y,cb_w, cb_h)
            
      ; Draw the new close rectangle
      pBrush := Gdip_BrushCreateSolid( (rgn = "cb") ? 0xaa222222 : 0xaa000000)
      Gdip_FillRectangle(G, pBrush, 0, 0, gw, gh)
      Gdip_DeleteBrush(pBrush)
      
      Gdip_SetCompositingMode(G, 0)
      
      ; Draw the "close" x
      pPen := Gdip_CreatePen((rgn = "cb") ? 0xffff6600 : 0xffffffff, 2)
      Gdip_DrawLine(G, pPen, cb_x+6, cb_y+6, cb_x+cb_w-6, cb_y+cb_h-6)
      Gdip_DrawLine(G, pPen, cb_x+cb_w-6, cb_y+6, cb_x+6, cb_y+cb_h-6)
      Gdip_DeletePen(pPen)      
   }
   if (oldrgn+0) ; the region we changed from is a screenshot slot
   {
      Gdip_SetCompositingMode(G, 1)
      pBrush := Gdip_BrushCreateSolid(0xaa000000)
   
      ; redraw the window title display area
      Gdip_SetClipRect(G, 0, 250, gw, 100)
      Gdip_FillRectangle(G, pBrush, 0, 0, gw, gh)
      
      ; redraw the background for this slot
      Gdip_SetClipRect(G, %oldrgn%_x, %oldrgn%_y, %oldrgn%_w, %oldrgn%_h)      
      Gdip_FillRectangle(G, pBrush, 0, 0, gw, gh)
      Gdip_DeleteBrush(pBrush)
      
      Gdip_SetCompositingMode(G, 0)
         
      ; redraw the screenshot
      Gdip_DrawImage(G, pBitmap%oldrgn%, wx%oldrgn%, wy%oldrgn%, ww%oldrgn%, wh%oldrgn%, 0, 0, w%oldrgn%, h%oldrgn%)
      
      
   }
   if (rgn+0) ; the region we changed to is a screenshot slot
   {
      Gdip_SetCompositingMode(G, 1)

      ; redraw slot background to the hover state
      Gdip_SetClipRect(G, %rgn%_x, %rgn%_y, %rgn%_w, %rgn%_h)
      pBrush := Gdip_BrushCreateSolid(0xaa222222)
      Gdip_FillRectangle(G, pBrush, 0, 0, gw, gh)
      Gdip_DeleteBrush(pBrush)

      Gdip_SetCompositingMode(G, 0)
      
      ; redraw the screenshot
      Gdip_DrawImage(G, pBitmap%rgn%, wx%rgn%, wy%rgn%, ww%rgn%, wh%rgn%, 0, 0, w%rgn%, h%rgn%)
      
      ; write the window title to the gui
      Gdip_SetClipRect(G, 0, 250, gw, 100)
      Options = x10p y290 w80p Centre caaff6600 r4 s25 Bold
      Gdip_TextToGraphics(G, %rgn%_title, Options, "Calibri", gw, gh)
   }

   ; Update the window, unset the clipping region, and remember the last region visited
   UpdateLayeredWindow(hgui1, hdc)
   Gdip_ResetClip(G)   
   oldrgn := rgn
return


Exit:
   ; Clean everything up
   Loop, % windowcount
      Gdip_DisposeImage(pBitmap%A_Index%)
   SelectObject(hdc, obm)
   DeleteObject(hbm)
   DeleteDC(hdc)
   Gdip_DeleteGraphics(G)
   Gdip_Shutdown(pToken)
ExitApp


Last edited by rulfzid on April 6th, 2009, 9:57 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2009, 9:24 am 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1833
looks interesting rulfzid. link? :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2009, 9:58 am 
Offline

Joined: November 27th, 2008, 9:44 am
Posts: 62
tic wrote:
looks interesting rulfzid. link? :)


Good point. I always forget to attach files to my emails as well. :oops:

Code added to post above.

Disclaimer: the code hasn't really been cleaned up: everything is still hardcoded and not "functionized" the way I'd like, but the basic idea is there.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2009, 9:34 am 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1833
Really good demonstration rulfzid. Very good example of how a nicer alt-tab replacement could be made


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 11:01 am 
Offline

Joined: January 15th, 2008, 12:20 pm
Posts: 14
For AltTab replacement: it shows me four black screeens, is it right? Why could this be?
Win2000


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 14th, 2010, 12:43 am 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
Updated TOC with a few outThisThreadSamples :)

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 14th, 2010, 1:47 pm 
Offline

Joined: December 13th, 2006, 7:10 am
Posts: 118
Hi all GDI+ lovers,

I've just discovered an easy way to add blur (glass effect) behind a layered window (Vista/Win7):
Code:
VarSetCapacity(struct, 3, 0)
NumPut(1,struct,0,"UInt")
NumPut(0x1,struct,1,"UInt")
DllCall("dwmapi.dll\DwmEnableBlurBehindWindow", "UInt", hwnd,"UInt",&struct)


Unfortunately, it doesn't work - in my case, at least - for the first created window. So, you have to create a dummy GUI with blur enabled and, then, the following GUI will have blur...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 14th, 2010, 2:40 pm 
Offline
User avatar

Joined: May 10th, 2007, 10:54 am
Posts: 649
Location: .switzerland
Some time ago, I've started the development of a Game Engine. First I used only GDI+, later I used mostly Open GL functions.
Current Release: http://de.autohotkey.com/forum/viewtopic.php?t=6067

More interesting for you GDI+ guys will be this one:

GDI+ Engine:
I publish here the latest Version of the Engine wich was using only GDI+;
BLOCKENGINEv0.761.zip GDI+ only
Start the Engine with "Game.ahk"
Note: Please note that this engine is replaced with the OpenGL Version.

GDI+ Animations:
Also, for using Animations, I tried a bit with GDI+ and sprite animations:
SpriteAnimation.zip


screenshot of current release:
Image

_________________
http://securityvision.ch
AHK 2D GAME ENGINE


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 14th, 2010, 3:18 pm 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
Thx, IsNull

TOC updated

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 21st, 2010, 11:40 pm 
Offline

Joined: February 6th, 2010, 5:17 pm
Posts: 57
NEXRAD Radar Viewer
Screenshot

Requires:PhiLho's BinReadWrite.ahk and tic's Gdip.ahk
Includes:Laszlo's Bin2Hex function

This will download, decode, and draw images from the US NEXRAD network of weather radars. It currently only works with standard 124nmi reflectivity images, but It could be made to support more products if anyone has a need for them.
You can use this page to help you find a radar near you or one with precipitation in the area. Click on the map to zoom in on a radar. The 3 letters at the top of the picture are the radar's ID. The IDs are usually preceded by a 'K' (BMX = KBMX).
I couldn't figure out how to get negative numbers to convert from binary to decimal, but the negative numbers aren't necessary for just drawing an image.

Download: nexrad.ahk
Code:
#NoEnv
#SingleInstance, Force
SetBatchLines, -1
SetWorkingDir, %A_ScriptDir%

;#Include, Gdip.ahk ;by tic http://www.autohotkey.com/forum/viewtopic.php?t=32238
#Include, BinReadWrite.ahk ;by PhiLho http://www.autohotkey.com/forum/viewtopic.php?t=7549

ids := "kmxx||kbmx|kgwx|kabr|kabx|kakq|kama|kamx|kapx|karx|katx|kbbx|kbgm|kbhx|kbis|kblx|kbmx|kbox|kbro|kbuf|"
     . "kbyx|kcae|kcbw|kcbx|kccx|kcle|kclx|kcrp|kcxx|kcys|kdax|kddc|kdfx|kdgx|kdix|kdlh|kdmx|kdox|kdtx|kdvn|"
     . "kdyx|keax|kemx|kenx|keox|kepz|kesx|kevx|kewx|keyx|kfcx|kfdr|kfdx|kffc|kfsd|kfsx|kftg|kfws|kggw|kgjx|"
     . "kgld|kgrb|kgrk|kgrr|kgsp|kgwx|kgyx|khdx|khgx|khnx|khpx|khtx|kict|kicx|kiln|kilx|kind|kinx|kiwa|kiwx|"
     . "kjax|kjgx|kjkl|klbb|klch|klix|klnx|klot|klrx|klsx|kltx|klvx|klwx|klzk|kmaf|kmax|kmbx|kmhx|kmkx|kmlb|"
     . "kmob|kmpx|kmqt|kmrx|kmsx|kmtx|kmux|kmvx|kmxx|knkx|knqa|koax|kohx|kokx|kotx|kpah|kpbz|kpdt|kpoe|kpux|"
     . "krax|krgx|kriw|krlx|krtx|ksfx|ksgf|kshv|ksjt|ksox|ksrx|ktbw|ktfx|ktlh|ktlx|ktws|ktyx|kudx|kuex|kvax|"
     . "kvbx|kvnx|kvtx|kvwx|kyux|pabc|pacg|paec|pahg|paih|pakc|papd|pgua|phki|phkm|phmo|phwa|tjua"
Gui, Add, Button, x12 y12 w150 h30 vuse_existing_file guse_existing_file, Use last downloaded file.
Gui, Add, Text, x12 y52 w150 h20 +Center, OR
Gui, Add, Button, x12 y82 w150 h30 gdownload_new_file, Download a new file from...
Gui, Add, ListBox, x12 y122 w150 h220 vradar_id, %ids%
Gui, Add, DropDownList, x12 y342 w150 h10 vproduct, Reflectivity 0||Reflectivity 1|Reflectivity 2|Reflectivity 3
; Generated using SmartGUI Creator 4.0
IfNotExist, sn.last
   GuiControl, Disable, use_existing_file
Gui, Show, w179 h386
Return

download_new_file:
Gui, Submit
dir := (product = "Reflectivity 0") ? ("p19r0") : ((product = "Reflectivity 1") ? ("p19r1") : ((product = "Reflectivity 2") ? ("p19r2") : ("p19r3")))
URLDownloadToFile, http://weather.noaa.gov/pub/SL.us008001/DF.of/DC.radar/DS.%dir%/SI.%radar_id%/sn.last, sn.last

use_existing_file:
Gui, Destroy
handle := OpenFileForRead("sn.last")
;~ message header block
header1 := read(21)
header2 := read(9)
message_code := half()
time_of_message := time(half(), whole())
length_of_message := whole()
source_id := half()
destination_id := half()
number_of_blocks := half()

;~ product description block
half() ;block divider
latitude_of_radar := whole() / 1000
longitude_of_radar := whole() / 1000
height_of_radar := half()
product_code := half()
operational_mode := half()
volume_coverage_pattern := half()
sequence_number := half()
volume_scan_number := half()
volume_scan_time := time(half(), whole())
product_generation_time := time(half(), whole())
p1 := half()
p2 := half()
elevation_number := half()
p3 := half()
threshold1 := half()
threshold2 := half()
threshold3 := half()
threshold4 := half()
threshold5 := half()
threshold6 := half()
threshold7 := half()
threshold8 := half()
threshold9 := half()
threshold10 := half()
threshold11 := half()
threshold12 := half()
threshold13 := half()
threshold14 := half()
threshold15 := half()
threshold16 := half()
p4 := half()
p5 := half()
p6 := half()
p7 := half()
p8 := half()
p9 := half()
p10 := half()
number_of_maps := half()
offset_to_symbology_block := whole()
offset_to_graphic_block := whole()
offset_to_tabular_block := whole()

;~ product symbology block
MoveInFile(handle, FILE_BEGIN, (offset_to_symbology_block * 2) + 30) ;+30 to account for the headers
half()
half()
length_of_block := whole()
number_of_layers := half()
half() ;layer divider
symbology_length := whole()
type := half() ;44831 = radial
index_of_first_range_bin := half()
number_of_range_bins := half()
i_center_of_sweep := half()
j_center_of_sweep := half()
scale_factor := half() / 1000
number_of_radials := half()

If !pToken := Gdip_Startup()
{
  MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
  ExitApp
}
OnExit, Exit

width = 800
height = 800
zoom = 1.7
Gui, 1: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
Gui, 1: Show, NA
hwnd1 := WinExist()
hbm := CreateDIBSection(Width, Height)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc)
Gdip_SetSmoothingMode(G, 3)

brushes := "0x20000000|0xff00ecec|0xff01a0f6|0xff0000f6|0xff00ff00|0xff00c800|0xff009000|0xffffff00|"
         . "0xffe7c000|0xffff9000|0xffff0000|0xffd60000|0xffc00000|0xffff00ff|0xff9955c9|0xffffffff"
Loop, Parse, brushes, |
{
   n := A_Index - 1
   pBrush%n% := Gdip_BrushCreateSolid(A_LoopField)
}

Loop, %number_of_radials%
{
   number_of_rle_halfwords := half()
   start_angle := (half() / 10) - 90
   angle_delta := half() / 10
   rle := rle(number_of_rle_halfwords)
   Loop, Parse, rle, |
   {
      x1 := (Cos(rad(start_angle)) * (A_Index - 1) * zoom) + (width / 2)
      y1 := (Sin(rad(start_angle)) * (A_Index - 1) * zoom) + (height / 2)
      x2 := (Cos(rad(start_angle + angle_delta)) * (A_Index - 1) * zoom) + (width / 2)
      y2 := (Sin(rad(start_angle + angle_delta)) * (A_Index - 1) * zoom) + (height / 2)
      x4 := (Cos(rad(start_angle)) * A_Index * zoom) + (width / 2)
      y4 := (Sin(rad(start_angle)) * A_Index * zoom) + (height / 2)
      x3 := (Cos(rad(start_angle + angle_delta)) * A_Index * zoom) + (width / 2)
      y3 := (Sin(rad(start_angle + angle_delta)) * A_Index * zoom) + (height / 2)
      Gdip_FillPolygon(G, pBrush%A_LoopField%, x1 . "," . y1 . "|" . x2 . "," . y2 . "|" . x3 . "," . y3 . "|" . x4 . "," . y4)
   }
   UpdateLayeredWindow(hwnd1, hdc, 0, 0, Width, Height)
}

CloseFile(handle)

Loop, 16
{
  n := A_Index - 1
  Gdip_DeleteBrush(pBrush%n%)
}

SelectObject(hdc, obm)
DeleteObject(hbm)
DeleteDC(hdc)
Gdip_DeleteGraphics(G)
;~ ListVars
Return

Esc::
Exit:
Gdip_Shutdown(pToken)
ExitApp
Return

rad(n) {
  Return, n * 0.01745329252
}

read(n) {
   global handle
   Loop, %n%
   {
      ReadFromFile(handle, bin, 1)
      str .= Chr("0x" . Bin2Hex(&bin, 1))
   }
   Return, str
}

half() {
   global handle
   ReadFromFile(handle, bin, 2)
   hex := "0x" . Bin2Hex(&bin, 2)
   Return, hex + 0
}

whole() {
   global handle
   ReadFromFile(handle, bin, 4)
   hex := "0x" . Bin2Hex(&bin, 4)
   Return, hex + 0
}

rle(number_of_rle_halfwords) {
   global handle
   Loop, % number_of_rle_halfwords * 2
   {
      ReadFromFile(handle, bin, 1)
      hex := Bin2Hex(&bin, 1)
      length := "0x" . SubStr(hex, 1, 1)
      value :=  "0x" . SubStr(hex, 2, 1)
      length += 0
      value += 0
      Loop, %length%
         rle .= value . "|"
   }
   Return, SubStr(rle, 1, (StrLen(rle) - 1))
}

time(days, seconds) {
   time = 19691231
   time += %days%, Days
   time += %seconds%, Seconds
   FormatTime, ftime, %time%, M/d/yyyy HH:mm:ss
   Return, ftime . " UTC"
}

;~ by Laszlo http://www.autohotkey.com/forum/viewtopic.php?p=135402#135402
Bin2Hex(addr,len) {
  Static fun
  If (fun = "") {
    h=8B54240C85D2568B7424087E3A53578B7C24148A07478AC8C0E90480F9090F97C3F6DB80E30702D980C330240F881E463C090F97C1F6D980E10702C880C130880E464A75CE5F5BC606005EC3
    VarSetCapacity(fun,StrLen(h)//2)
    Loop % StrLen(h)//2
    NumPut("0x" . SubStr(h,2*A_Index-1,2), fun, A_Index-1, "Char")
  }
  VarSetCapacity(hex,2*len+1)
  dllcall(&fun, "int",&hex, "uint",addr, "uint",len, "cdecl")
  VarSetCapacity(hex,-1) ; update StrLen
  Return hex
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2010, 8:46 am 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
Toc updated, thx, ih57452

btw, is there a possibility to make this work with a radar outside the us, such as europe?

8)
dR

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2010, 9:47 am 
Offline

Joined: February 6th, 2010, 5:17 pm
Posts: 57
DerRaphael wrote:
btw, is there a possibility to make this work with a radar outside the us, such as europe?

I doubt that the data format would be the same. As far as I know, there is no world-wide standard format. The format the US radars use was developed in the 1980's and has a 212-page manual to decode it. Also, from the info I found, it looks like you have to pay to access the raw data from Germany's radars.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 17th, 2010, 11:39 am 
Offline

Joined: March 20th, 2010, 9:49 am
Posts: 224
thx so much for analog clock, dr!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 6th, 2011, 6:43 pm 
Offline
User avatar

Joined: May 10th, 2007, 10:54 am
Posts: 649
Location: .switzerland
GDI Controls
Image

_________________
http://securityvision.ch
AHK 2D GAME ENGINE


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 59 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC [ DST ]


Who is online

Users browsing this forum: Stigg and 8 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group