Author Topic: Playing with regions (Win API) to make unusual shaped windows  (Read 4384 times)

0 Members and 1 Guest are viewing this topic.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Trying to make unusual shaped windows, maybe use an image as the window, so playing around with creating regions using the Windows API.   Could make an interesting splash screen at least.  This is a limited example of it, but it's working so far.  I'm a novice at these api functions.  Advice greatly welcomed.

(Sorry linux & mac friends, the code is windows only)

- Dav

Code: QB64: [Select]
  1. '================
  2. 'WindowRegion.bas
  3. '================
  4. 'Uses Windows API to create a non-standard looking window.
  5. 'Using this you could use an image as the entire window instead.
  6. 'Coded by Dav, JULY/2020
  7.  
  8. 'I used API information found on this page....
  9. 'http://allapi.mentalis.org/apilist/apilist.php
  10.  
  11.     'sets a created window region
  12.     'http://allapi.mentalis.org/apilist/SetWindowRgn.shtml
  13.     FUNCTION SetWindowRgn& (BYVAL hwnd&, BYVAL hrgn&, BYVAL bredraw%)
  14.  
  15.     'creates a rectangular region
  16.     'http://allapi.mentalis.org/apilist/CreateRectRgn.shtml
  17.     FUNCTION CreateRectRgn& (BYVAL x1&, BYVAL y1&, BYVAL x2&, BYVAL y2&)
  18.     'creates an elliptical region
  19.     'http://allapi.mentalis.org/apilist/CreateEllipticRgn.shtml
  20.     FUNCTION CreateEllipticRgn& (BYVAL x1&, BYVAL y1&, BYVAL x2&, BYVAL y2&)
  21.     'creates a rectangular region with rounded corners
  22.     'http://allapi.mentalis.org/apilist/CreateRoundRectRgn.shtml
  23.     FUNCTION CreateRoundRectRgn& (BYVAL x1&, BYVAL y1&, BYVAL x2&, BYVAL y2&, BYVAL x3&, BYVAL y3&)
  24.  
  25. controls& = BASIMAGE1& 'Make Minimize & Exit controls image
  26.  
  27. hwnd& = _WINDOWHANDLE 'need the windows handle to play with it
  28.  
  29. 'Create a rounded rectangular region...
  30. rgn& = CreateRoundRectRgn(30, 30, 650, 650, 240, 240)
  31.  
  32. 'you can try these also...
  33. 'rgn& = CreateEllipticRgn(30, 30, 650, 650)
  34. 'rgn& = CreateRectRgn(30, 30, 650, 650)
  35.  
  36. 'Set the created region...
  37. try& = SetWindowRgn(hwnd&, rgn&, 0)
  38. 'Returns zero if failed...
  39. IF try& = 0 THEN
  40.     PRINT "Failed...": END
  41.  
  42. 'Setup screen....
  43. SCREEN _NEWIMAGE(680, 680, 32)
  44. 'Draw a top highlighted bar
  45. LINE (0, 0)-(680, 80), _RGB(196, 196, 196), BF
  46. 'draw minimize and exit image
  47. _PUTIMAGE (350, 30), controls&
  48.  
  49.  
  50. 'NOTE: Currently I haven't put in a way to drag the window,
  51. 'but there is a way to do that and I will try to put it in later.
  52.  
  53.  
  54.     p = _MOUSEINPUT
  55.     mx = _MOUSEX: my = _MOUSEY
  56.  
  57.     LOCATE 12, 12: PRINT mx, my
  58.  
  59.     'see if user clicked minimized area
  60.     IF _MOUSEBUTTON(1) AND mx > 350 AND mx < 387 AND my > 29 AND my < 66 THEN
  61.         'wait until button up to continue
  62.         DO: p = _MOUSEINPUT
  63.             IF _MOUSEBUTTON(1) = 0 THEN EXIT DO
  64.         LOOP
  65.         'minimize program
  66.         _SCREENICON
  67.     END IF
  68.  
  69.     'see if user clicked exit area
  70.     IF _MOUSEBUTTON(1) AND mx > 390 AND mx < 420 AND my > 29 AND my < 66 THEN
  71.         IF _MOUSEBUTTON(1) = -1 THEN
  72.             SYSTEM
  73.         END IF
  74.     END IF
  75.  
  76.  
  77.  
  78. 'This function creates the control image.
  79. 'It was made with my BASIMAGE.BAS program .
  80. FUNCTION BASIMAGE1& 'controls.png
  81.     v& = _NEWIMAGE(80, 40, 32)
  82.     DIM m AS _MEM: m = _MEMIMAGE(v&)
  83.     A$ = ""
  84.     A$ = A$ + "haIkH_oCCM5007_l#P28JF6a`HbL3iIKY?hEO#aOHKJ04W^9ciLDX::aXbn1"
  85.     A$ = A$ + "U]iFfD7?4#4T7jLZK4#A5:<L;Z0^T]Q#L6aU\HbRVmO04PO081n]c>WcUc]g"
  86.     A$ = A$ + "KkmNJ[m2SOhfT?inXWk]GnN_]gFZ\b:1E:c_=a4C\ZbZaS9Q>6UkWde_7jhF"
  87.     A$ = A$ + ";K6]_KcJ\nkQW7=P3<Jm[S^nC#Gmn_[J8g?Y_OS?hmHmdQ^_X6Oh11oUGjY?"
  88.     A$ = A$ + "H8_6]nM^cokP6Jk5B\WcZ^Fn7<W[k5PVJML#c]lTUlH\jKL4<Qjg8>jU1lJT"
  89.     A$ = A$ + "7fW3`HoDo2Jd1hk9go^^Qki2JhNNQFoZj\o6XV6O^?[ZU9bmCjkg#Mn3l<LG"
  90.     A$ = A$ + "o8[1i0]l#G_3NN#gM2ne^_QXnSNkaYnjU5nlEo>`W_Xe__lD33nZ_mI2:_]F"
  91.     A$ = A$ + "6VVg<FgPFo9[jI<>mOc>?]aCfVR?d8RB^OBOoLdJCHmeFcH3LYFMjb]cj>Oo"
  92.     A$ = A$ + "5an5>^37olE^T7=P0Xe_SDAoPSNRa54i_MQNPFoF\F<6J\TiY=N4J]C\nMmj"
  93.     A$ = A$ + "ZQA3e2^Ame2^McWSE?GXAFT>c5Yi8>Jo2\j71fOG9di3Jm[db^9hPOjS5T5C"
  94.     A$ = A$ + "k5cC=Q<6JSS\_Tkg:Oo^fIn6\>Zn<HMMfZahfET^K\>\KeD32B\^;DkkUC_Y"
  95.     A$ = A$ + "e?Kf_9h07kADIfh79JK8mQfcI4^mNZKbmKi_OT6BjWKM4Rd#aJY_d#YZOLK8"
  96.     A$ = A$ + "]FiJg#<UUgg>ajGKOfaIenWO2`E?mGcS[GOBdI]EaX^Za`m^nJhQL];g[O9M"
  97.     A$ = A$ + "WdI?e_R?lX2ZTb7SW\Q]01eU5GLAAQ_V;cmPi;]C^O;?mcVY\LbRA#9iH2cF"
  98.     A$ = A$ + ">VaC;eZI6iV3`N^F0fgREFUo^_=?79_]QMhlg6XR]W??7]`l17K75h6Jm;^="
  99.     A$ = A$ + "o5PgBK7n4=Yad`iWONgPOO;liO3eGSQV[jLNXXC]5ZTkWdg_DEX0C=B0:0J2"
  100.     A$ = A$ + ":0FY5LPlXM=1aCJQ4<;MQ52;m:35H8l`0Y7QB<3[=LNB?Z805THlPMZ:IZmC"
  101.     A$ = A$ + "QRg3X8ZFm9a]Yg7gYiVK>gPFOLKJG`aeRh2Z1A9DoD_DkD1UbBCE]D;E50cD"
  102.     A$ = A$ + "Nc783JmEcBhfG^=6eGmAbdEjm[#PR`Jf[4C\5RQJd\c>[X#?ojOUg1SF[Tkg"
  103.     A$ = A$ + ":Co8_oUd=bba7IX2noZ`OT`jS4c0\QXgOSJXDd?Bg#VIVIl8bHme6:g?Y_OZ"
  104.     A$ = A$ + "hd>ETkS0i]OGNOi1ihf0WkahakOXllDAJgdC?]PldcQfNNkCoXOYjBoFHQ5T"
  105.     A$ = A$ + "DTnY3nIQYkEmKWRNOBdmAA#k_YVJ:g#N]8SQfh8k;5AdTLoFQk7K_LU7^?f;"
  106.     A$ = A$ + "3bO7I0kFFA6>8ce6Q7jg^015Mc2R\_VLb9M3ncJCX8<dHS?aR`X=NT0OEin]"
  107.     A$ = A$ + "Bg?]`FaU^PHT#D:UlkoJ=ihafj6S1\KE91n#=Y#]O[K3E0D^aV4DBYl1H2mj"
  108.     A$ = A$ + "PF?kHS]AWKCbkFha3G?BX`aj[m;k`F3F61706IIS:3Q_823c4lkLPH6nMOck"
  109.     A$ = A$ + "eSQWRP=1I?`^`e7[C=HOje`cWT^F#aIXSJoN]=OL#\jn>ob6Dg6?AcMN?lkM"
  110.     A$ = A$ + "mVOo[Lol_nI?3mHFP=97XmVJB<DW2HO#fdZ6[HMJhaVnd0UH#;;K`FDBVja8"
  111.     A$ = A$ + "kcBcb0?fc>MFU2]OCIB]OYJhTPD\NIOFRFJGdeWXi;b:NS]`KI?A^OBOo>XU"
  112.     A$ = A$ + "\UL70f5GGGIXYiH4k#8F=1:?GcDkGfF?5HkkoNnU2]OGNcSD`;9QjgZ9[6?V"
  113.     A$ = A$ + "4jHD^OBCoT9ko3o7Ml:S%%%0"
  114.     btemp$ = ""
  115.     FOR i& = 1 TO LEN(A$) STEP 4: B$ = MID$(A$, i&, 4)
  116.         IF INSTR(1, B$, "%") THEN
  117.             FOR C% = 1 TO LEN(B$): F$ = MID$(B$, C%, 1)
  118.                 IF F$ <> "%" THEN C$ = C$ + F$
  119.             NEXT: B$ = C$: END IF: FOR j = 1 TO LEN(B$)
  120.             IF MID$(B$, j, 1) = "#" THEN
  121.         MID$(B$, j) = "@": END IF: NEXT
  122.         FOR t% = LEN(B$) TO 1 STEP -1
  123.             B& = B& * 64 + ASC(MID$(B$, t%)) - 48
  124.             NEXT: X$ = "": FOR t% = 1 TO LEN(B$) - 1
  125.             X$ = X$ + CHR$(B& AND 255): B& = B& \ 256
  126.     NEXT: btemp$ = btemp$ + X$: NEXT
  127.     btemp$ = _INFLATE$(btemp$)
  128.     _MEMPUT m, m.OFFSET, btemp$: _MEMFREE m
  129.     BASIMAGE1& = _COPYIMAGE(v&): _FREEIMAGE v&
  130.  
  131.  

Offline loudar

  • Newbie
  • Posts: 73
  • improve it bit by bit.
    • View Profile
Re: Playing with regions (Win API) to make unusual shaped windows
« Reply #1 on: July 23, 2020, 07:43:21 pm »
Wait damn, this is actually really f****** cool!!! I will 100% use this. Thank you so much.

EDIT: I've now added it to Datanet and added my own x at the top left, though the minimizing function seems to do something odd with the resizing detection, so I left it out for now.

 
f3242c6c92b274a5c1f37efb304b17e9.jpg
« Last Edit: July 23, 2020, 08:15:39 pm by loudar »
Check out what I do besides coding: http://loudar.myportfolio.com/

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Playing with regions (Win API) to make unusual shaped windows
« Reply #2 on: July 23, 2020, 08:24:32 pm »
I seem to not be able to move the window after it is created. Is this normal?
Shuwatch!

Offline loudar

  • Newbie
  • Posts: 73
  • improve it bit by bit.
    • View Profile
Re: Playing with regions (Win API) to make unusual shaped windows
« Reply #3 on: July 23, 2020, 08:36:47 pm »
@SpriggsySpriggs Yes it is. It removes the top bar created by Windows, so you'd have to code your own. I did that (except the minimize function) just now!

3*fontheight is the size of the top bar i chose, but use your own values of course :D Because I center this program in the middle at startup, I use the difference between the start and the end mousex/mousey to calculate the new position. When I display it everytime it changes, it goes a little crazy, so that's why I only display afterwards.

Code: QB64: [Select]
  1.         mouseinput = _MOUSEINPUT
  2.         mousebutton = _MOUSEBUTTON(1)
  3.         mousex = _MOUSEX
  4.         mousey = _MOUSEY
  5.         IF mouseinput = -1 THEN
  6.             IF mousebutton = -1 THEN
  7.                 IF mousey < 3 * fontheight THEN
  8.                     DO
  9.                         mouseinput = _MOUSEINPUT
  10.                         mousebutton = _MOUSEBUTTON(1)
  11.                     LOOP UNTIL mousebutton <> -1
  12.                     _SCREENMOVE _DESKTOPWIDTH / 2 - (_WIDTH / 2) + (_MOUSEX - mousex), _DESKTOPHEIGHT / 2 - (_HEIGHT / 2) + (_MOUSEY - mousey)
  13.                 END IF
  14.             END IF
  15.         END IF
Check out what I do besides coding: http://loudar.myportfolio.com/

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: Playing with regions (Win API) to make unusual shaped windows
« Reply #4 on: July 24, 2020, 05:00:00 am »
Its amazing @Dav
Thanks for sharing the code. :-)
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: Playing with regions (Win API) to make unusual shaped windows
« Reply #5 on: July 24, 2020, 11:04:21 pm »
Here's an updated version that allows moving of the program window anywhere on the desktop.  Click in the highlighted area to move the window.  I used an API call to get mouse x/y for dragging the window - it seemed to move much smoother that way.   

- Dav

Code: QB64: [Select]
  1. '================
  2. 'WindowRegion.bas v1.1
  3. '================
  4. 'Uses Windows API to create a non-standard looking window.
  5. 'Using this you could use an image as the entire window instead.
  6. 'Coded by Dav, JULY/2020
  7.  
  8. 'I used API information found on this page....
  9. 'http://allapi.mentalis.org/apilist/apilist.php
  10.  
  11.  
  12. TYPE POINTAPI
  13.     x AS LONG
  14.     y AS LONG
  15. DIM apixy AS POINTAPI 'mouse x/y for the GetCursorPos function
  16.  
  17.     'sets a created window region
  18.     'http://allapi.mentalis.org/apilist/SetWindowRgn.shtml
  19.     FUNCTION SetWindowRgn& (BYVAL hwnd&, BYVAL hrgn&, BYVAL bredraw%)
  20.     'get current mouse x/y position
  21.     'http://allapi.mentalis.org/apilist/GetCursorPos.shtml
  22.     FUNCTION GetCursorPos% (lpPoint AS POINTAPI)
  23.  
  24.  
  25.     'creates a rectangular region
  26.     'http://allapi.mentalis.org/apilist/CreateRectRgn.shtml
  27.     FUNCTION CreateRectRgn& (BYVAL x1&, BYVAL y1&, BYVAL x2&, BYVAL y2&)
  28.     'creates an elliptical region
  29.     'http://allapi.mentalis.org/apilist/CreateEllipticRgn.shtml
  30.     FUNCTION CreateEllipticRgn& (BYVAL x1&, BYVAL y1&, BYVAL x2&, BYVAL y2&)
  31.     'creates a rectangular region with rounded corners
  32.     'http://allapi.mentalis.org/apilist/CreateRoundRectRgn.shtml
  33.     FUNCTION CreateRoundRectRgn& (BYVAL x1&, BYVAL y1&, BYVAL x2&, BYVAL y2&, BYVAL x3&, BYVAL y3&)
  34.  
  35. controls& = BASIMAGE1& 'Make Minimize & Exit controls image
  36. _ICON controls& 'might as well make it the program icon too...
  37.  
  38. hwnd& = _WINDOWHANDLE 'need the windows handle to play with it
  39.  
  40. 'Create a rounded rectangular region...
  41. rgn& = CreateRoundRectRgn(30, 30, 650, 650, 240, 240)
  42.  
  43. 'you can try these also...
  44. 'rgn& = CreateEllipticRgn(30, 30, 650, 650)
  45. 'rgn& = CreateRectRgn(30, 30, 650, 650)
  46.  
  47. 'Set the created region...
  48. try& = SetWindowRgn(hwnd&, rgn&, 0)
  49. 'Returns zero if failed...
  50. IF try& = 0 THEN
  51.     PRINT "Failed...": END
  52.  
  53. 'Setup screen....
  54. SCREEN _NEWIMAGE(680, 680, 32)
  55. FOR y = 1 TO 680
  56.     LINE (0, y)-(680, y), _RGB(c, c, 64), BF
  57.     c = c + 1: IF c > 32 THEN c = 0
  58.  
  59. 'Draw a top highlighted bar
  60. LINE (0, 0)-(680, 80), _RGB(64, 64, 196), BF
  61. 'draw minimize and exit image
  62. _PUTIMAGE (500, 30), controls&
  63.  
  64.  
  65.     p = _MOUSEINPUT
  66.     mx = _MOUSEX: my = _MOUSEY
  67.  
  68.     'LOCATE 12, 12: PRINT mx, my; _MOUSEBUTTON(1); 'testing info
  69.  
  70.     IF _MOUSEBUTTON(1) AND mx < 500 AND mx > 0 AND my < 80 AND mx > 0 THEN
  71.  
  72.         'get orig mouse x/y using api
  73.         tmp = GetCursorPos(apixy)
  74.         origx = apixy.x: origy = apixy.y
  75.  
  76.         DO
  77.             p = _MOUSEINPUT: IF _MOUSEBUTTON(1) = 0 THEN EXIT DO
  78.  
  79.             'poll mouse x/y
  80.             tmp = GetCursorPos(apixy)
  81.             mx = apixy.x: my = apixy.y
  82.  
  83.             _SCREENMOVE _SCREENX - (origx - mx), _SCREENY + (my - origy)
  84.  
  85.             origx = mx: origy = my
  86.  
  87.         LOOP
  88.  
  89.  
  90.     END IF
  91.  
  92.     'see if user clicked minimized area
  93.     IF _MOUSEBUTTON(1) AND mx > 500 AND mx < 540 AND my > 29 AND my < 66 THEN
  94.         'wait until button up to continue
  95.         DO: p = _MOUSEINPUT
  96.             IF _MOUSEBUTTON(1) = 0 THEN EXIT DO
  97.         LOOP
  98.         'minimize program
  99.         _SCREENICON
  100.     END IF
  101.  
  102.     'see if user clicked exit area
  103.     IF _MOUSEBUTTON(1) AND mx > 540 AND mx < 580 AND my > 29 AND my < 66 THEN
  104.         IF _MOUSEBUTTON(1) = -1 THEN
  105.             SYSTEM
  106.         END IF
  107.     END IF
  108.  
  109.  
  110.  
  111. 'This function creates the control image.
  112. 'It was made with my BASIMAGE.BAS program .
  113. FUNCTION BASIMAGE1& 'controls.png
  114.     v& = _NEWIMAGE(80, 40, 32)
  115.     DIM m AS _MEM: m = _MEMIMAGE(v&)
  116.     A$ = ""
  117.     A$ = A$ + "haIkH_oCCM5007_l#P28JF6a`HbL3iIKY?hEO#aOHKJ04W^9ciLDX::aXbn1"
  118.     A$ = A$ + "U]iFfD7?4#4T7jLZK4#A5:<L;Z0^T]Q#L6aU\HbRVmO04PO081n]c>WcUc]g"
  119.     A$ = A$ + "KkmNJ[m2SOhfT?inXWk]GnN_]gFZ\b:1E:c_=a4C\ZbZaS9Q>6UkWde_7jhF"
  120.     A$ = A$ + ";K6]_KcJ\nkQW7=P3<Jm[S^nC#Gmn_[J8g?Y_OS?hmHmdQ^_X6Oh11oUGjY?"
  121.     A$ = A$ + "H8_6]nM^cokP6Jk5B\WcZ^Fn7<W[k5PVJML#c]lTUlH\jKL4<Qjg8>jU1lJT"
  122.     A$ = A$ + "7fW3`HoDo2Jd1hk9go^^Qki2JhNNQFoZj\o6XV6O^?[ZU9bmCjkg#Mn3l<LG"
  123.     A$ = A$ + "o8[1i0]l#G_3NN#gM2ne^_QXnSNkaYnjU5nlEo>`W_Xe__lD33nZ_mI2:_]F"
  124.     A$ = A$ + "6VVg<FgPFo9[jI<>mOc>?]aCfVR?d8RB^OBOoLdJCHmeFcH3LYFMjb]cj>Oo"
  125.     A$ = A$ + "5an5>^37olE^T7=P0Xe_SDAoPSNRa54i_MQNPFoF\F<6J\TiY=N4J]C\nMmj"
  126.     A$ = A$ + "ZQA3e2^Ame2^McWSE?GXAFT>c5Yi8>Jo2\j71fOG9di3Jm[db^9hPOjS5T5C"
  127.     A$ = A$ + "k5cC=Q<6JSS\_Tkg:Oo^fIn6\>Zn<HMMfZahfET^K\>\KeD32B\^;DkkUC_Y"
  128.     A$ = A$ + "e?Kf_9h07kADIfh79JK8mQfcI4^mNZKbmKi_OT6BjWKM4Rd#aJY_d#YZOLK8"
  129.     A$ = A$ + "]FiJg#<UUgg>ajGKOfaIenWO2`E?mGcS[GOBdI]EaX^Za`m^nJhQL];g[O9M"
  130.     A$ = A$ + "WdI?e_R?lX2ZTb7SW\Q]01eU5GLAAQ_V;cmPi;]C^O;?mcVY\LbRA#9iH2cF"
  131.     A$ = A$ + ">VaC;eZI6iV3`N^F0fgREFUo^_=?79_]QMhlg6XR]W??7]`l17K75h6Jm;^="
  132.     A$ = A$ + "o5PgBK7n4=Yad`iWONgPOO;liO3eGSQV[jLNXXC]5ZTkWdg_DEX0C=B0:0J2"
  133.     A$ = A$ + ":0FY5LPlXM=1aCJQ4<;MQ52;m:35H8l`0Y7QB<3[=LNB?Z805THlPMZ:IZmC"
  134.     A$ = A$ + "QRg3X8ZFm9a]Yg7gYiVK>gPFOLKJG`aeRh2Z1A9DoD_DkD1UbBCE]D;E50cD"
  135.     A$ = A$ + "Nc783JmEcBhfG^=6eGmAbdEjm[#PR`Jf[4C\5RQJd\c>[X#?ojOUg1SF[Tkg"
  136.     A$ = A$ + ":Co8_oUd=bba7IX2noZ`OT`jS4c0\QXgOSJXDd?Bg#VIVIl8bHme6:g?Y_OZ"
  137.     A$ = A$ + "hd>ETkS0i]OGNOi1ihf0WkahakOXllDAJgdC?]PldcQfNNkCoXOYjBoFHQ5T"
  138.     A$ = A$ + "DTnY3nIQYkEmKWRNOBdmAA#k_YVJ:g#N]8SQfh8k;5AdTLoFQk7K_LU7^?f;"
  139.     A$ = A$ + "3bO7I0kFFA6>8ce6Q7jg^015Mc2R\_VLb9M3ncJCX8<dHS?aR`X=NT0OEin]"
  140.     A$ = A$ + "Bg?]`FaU^PHT#D:UlkoJ=ihafj6S1\KE91n#=Y#]O[K3E0D^aV4DBYl1H2mj"
  141.     A$ = A$ + "PF?kHS]AWKCbkFha3G?BX`aj[m;k`F3F61706IIS:3Q_823c4lkLPH6nMOck"
  142.     A$ = A$ + "eSQWRP=1I?`^`e7[C=HOje`cWT^F#aIXSJoN]=OL#\jn>ob6Dg6?AcMN?lkM"
  143.     A$ = A$ + "mVOo[Lol_nI?3mHFP=97XmVJB<DW2HO#fdZ6[HMJhaVnd0UH#;;K`FDBVja8"
  144.     A$ = A$ + "kcBcb0?fc>MFU2]OCIB]OYJhTPD\NIOFRFJGdeWXi;b:NS]`KI?A^OBOo>XU"
  145.     A$ = A$ + "\UL70f5GGGIXYiH4k#8F=1:?GcDkGfF?5HkkoNnU2]OGNcSD`;9QjgZ9[6?V"
  146.     A$ = A$ + "4jHD^OBCoT9ko3o7Ml:S%%%0"
  147.     btemp$ = ""
  148.     FOR i& = 1 TO LEN(A$) STEP 4: B$ = MID$(A$, i&, 4)
  149.         IF INSTR(1, B$, "%") THEN
  150.             FOR C% = 1 TO LEN(B$): F$ = MID$(B$, C%, 1)
  151.                 IF F$ <> "%" THEN C$ = C$ + F$
  152.             NEXT: B$ = C$: END IF: FOR j = 1 TO LEN(B$)
  153.             IF MID$(B$, j, 1) = "#" THEN
  154.         MID$(B$, j) = "@": END IF: NEXT
  155.         FOR t% = LEN(B$) TO 1 STEP -1
  156.             B& = B& * 64 + ASC(MID$(B$, t%)) - 48
  157.             NEXT: X$ = "": FOR t% = 1 TO LEN(B$) - 1
  158.             X$ = X$ + CHR$(B& AND 255): B& = B& \ 256
  159.     NEXT: btemp$ = btemp$ + X$: NEXT
  160.     btemp$ = _INFLATE$(btemp$)
  161.     _MEMPUT m, m.OFFSET, btemp$: _MEMFREE m
  162.     BASIMAGE1& = _COPYIMAGE(v&): _FREEIMAGE v&
  163.  

 
WindowRegion.jpg

« Last Edit: July 25, 2020, 10:20:22 pm by Dav »

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: Playing with regions (Win API) to make unusual shaped windows
« Reply #6 on: July 25, 2020, 10:24:42 pm »
Fixed code in last post, removed unnecessary computations for screen moving.

- Dav