News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Recent posts

#21
The Campus / Re: Re: TransparentBlt Example...
Last post by zedd151 - Today at 04:51:38 AM
You cannot view this attachment.

Now the upper left corner of the client area is at 0,0 on the screen not the window, which its upper left corner is off screen.  :biggrin:

I am going to center it with SystemParametersInfoA, SPI_GETWORKAREA, and see where the window gets placed.
#22
The Campus / Re: Re: TransparentBlt Example...
Last post by zedd151 - Today at 04:21:38 AM
He he. I'll tinker with it some more. brb
#23
The Campus / Re: Re: TransparentBlt Example...
Last post by sinsi - Today at 04:15:46 AM
What happens if you change the code to this
invoke MoveWindow, hWin, rct.left, rct.top, eax, edx, TRUEIt should be slightly off the top and left of the screen edges.

Here is my attempt
        .if uMsg == WM_INITDIALOG
          ;; fill RECT with desired client area dimensions
          mov rct.left, 0
          mov rct.top, 0
          mov rct.right, cwidth     ; 240
          mov rct.bottom, cheight   ; 240

          ; rct has your desired size
          invoke AdjustWindowRect, addr rct, WS_VISIBLE or WS_OVERLAPPEDWINDOW, 0
          invoke  SystemParametersInfoA, SPI_GETWORKAREA, 0, addr rctD, 0

        ;window_width = (rct.right - rct.left)
        ;window_heighth = (rct.bottom - rct.top)
            mov ecx,rct.right
            mov edx,rct.bottom
            sub ecx,rct.left    ;window width
            sub edx,rct.top     ;window height

        ;desktop_width = rctD.right
        ;desktop_height = rctD.bottom
            mov esi,rctD.right
            mov edi,rctD.bottom
            ;desktop left/top should always be 0
            ;sub esi,rctD.left    ;desktop width
            ;sub edi,rctD.top     ;desktop height
           
        ;window_x = desktop_width - window_width / 2
        ;window_y = desktop_height - window_height / 2
            sub esi,ecx
            sub edi,edx
            shr esi,1           ;window x
            shr edi,1           ;window y

            invoke MoveWindow,hWin,esi,edi,ecx,edx,TRUE
#24
The Campus / Re: Re: TransparentBlt Example...
Last post by zedd151 - Today at 04:02:17 AM
Okay, this better demonstrates the issue that I see:
          ;; fill RECT with desired client area dimensions
          mov rct.left, 0
          mov rct.top, 0
          mov rct.right, cwidth    ; 240
          mov rct.bottom, cheight  ; 240

          ; rct has your desired size
          invoke AdjustWindowRect, addr rct, WS_VISIBLE or WS_OVERLAPPEDWINDOW, 0
          lea ecx, rct
          mov eax, [ecx].RECT.right
          mov edx, [ecx].RECT.bottom
          sub eax, [ecx].RECT.left  ; new window width
          sub edx, [ecx].RECT.top  ; new window height

          invoke MoveWindow, hWin, 0, 0, eax, edx, TRUE
          invoke GetWindowRect, hWin, addr rct

          fn lstrcpy,    addr buffer, "rct.left = "
          invoke lstrcat, addr buffer, str$(rct.left)
          invoke lstrcat, addr buffer, addr crlf
         
          fn lstrcat,    addr buffer, "rct.top = "
          invoke lstrcat, addr buffer, str$(rct.top)
          invoke lstrcat, addr buffer, addr crlf
         
          fn lstrcat,    addr buffer, "rct.right = "
          invoke lstrcat, addr buffer, str$(rct.right)
          invoke lstrcat, addr buffer, addr crlf
         
          fn lstrcat,    addr buffer, "rct.bottom = "
          invoke lstrcat, addr buffer, str$(rct.bottom)
         
          invoke MessageBox, 0, addr buffer, 0, 0
After moving the window I called GetWindowRect to obtain the window RECT which is where the window is supposed to be. But when the window is shown, x is 0+7 (rct.left). I do not know how to reconcile this apparent discrepancy.
Am I missing something here?
You cannot view this attachment.

Here is what I actually see on screen (screenshot of upper left corner of screen):
You cannot view this attachment.
#25
The Campus / How windows handle data to be ...
Last post by guga - Today at 02:47:00 AM
Not sure if here is the proper subforum to ask this, but....I´m giving a try on newer functions using SSE2 to gain performance, but while i was working on one of them i faced a small issue regarding how the data pass to a xmm register on windows.  I know, i know..it´s a dumb question, but i´m trying to avoid faultive errors or messages like that on windows.

Let´s say that i have a string to be passed on a xmm register. The string is let´s say, 20 bytes long stored in esi.

[MyString: B$ "123456789abcdefghijk", 0]

mov esi MyString
movups xmm0 X$esi

Ok, so far, xmm0 will hold "123456789abcdefg".

But then i want to pass the rest of it...so the remainder 4 bytes to xmm0, xmm1 or whatever other register "hijk"

Say i´ll do this do load the remainder bytes:
movups xmm1 X$esi+16

Since the string is only 20 bytes long....in theory windows should generate an error trying to load the remainder bytes, right ?

But, i have several functions that works like this, such as string lenght calculation etc - If i recall, JJ, Siekmanski etc also has this, and no error happens whatsoever.

My question is why ?

The opposite i know that is guaranteed to have an error, i mean, if i try to load the string before it´s start. Ex:

mov esi MyString
sub esi 10
movups xmm0 X$esi 

It will generate an error here right ?

But why windows successfully loads the string even if it is smaller than 16 bytes and is located after it´s start ?

Suppose the string is not loaded with virtual memory...suppose the string is located phisically inside the own app (At the very end of the .data section, for example). Shouldn´t it crash ?

Or i´m totally confused, and loading a sting like that - (Which will be truncated) is also safe since windows manage this somehow ?
#26
The Orphanage / Re: Ambition
Last post by zedd151 - Today at 02:45:32 AM
Today I found out that my 'ambition' only goes so far.
I had a choice between finishing up some code, or yard work.  :biggrin:
I procrastinated on the yard work, in favor of working on code.  :eusa_dance:

My excuse reasoning:  :cool:
There's always tomorrow, and the yard work ain't goin' anywhere. But I might forget by tomorrow, what I wanted to do with the code that I have in my mind right now.  :greensml:

Seems like a logical tradeoff.  :eusa_dance:

A little while later:
I'm off the hook for the yard work for at least today and tomorrow. A thunderstorm is moving through our area. It'll take a couple of days for the ground to be dry enough to drive the tractor on.  :biggrin: it gets stuck easily in wet clay.
#27
The Campus / Re: Re: TransparentBlt Example...
Last post by zedd151 - Today at 02:23:06 AM
Quote from: sinsi on Today at 02:18:19 AMActually, the adjusted rectangle is -8, -31, 248, 248.
This is because your client x,y is 0,0 so converting it to a window will take into account things like the border and title bar.
You still have to have code to centre it though.
I did not look at the RECT structure values after the adjustment, just the changes in dialog box Window location and size after the AdjustWindowRect call.  :rolleyes:
I know that I still have to center it, I was just testing the result of these changes.
In the end, it might not be much less code than my original resizing and centering code.
I'll work on centering it now...  :biggrin:
#28
The Campus / Re: Re: TransparentBlt Example...
Last post by sinsi - Today at 02:18:19 AM
Actually, the adjusted rectangle is -8, -31, 248, 248.
This is because your client x,y is 0,0 so converting it to a window will take into account things like the border and title bar.
You still have to have code to centre it though.
#29
The Campus / Re: Re: TransparentBlt Example...
Last post by zedd151 - Today at 01:42:30 AM
I can do yard work later.  :eusa_dance:  I am a world renowned procrastinator with such things.  :biggrin:

Okay if I am correct, with this code the window should be the correct size but at x=0 and y=0 and need only centering now.

        .if uMsg == WM_INITDIALOG
          ;; fill RECT with desired client area dimensions
          mov rct.left, 0
          mov rct.top, 0
          mov rct.right, cwidth    ; 240
          mov rct.bottom, cheight  ; 240

          ; rct has your desired size
          invoke AdjustWindowRect, addr rct, WS_VISIBLE or WS_OVERLAPPEDWINDOW, 0
          lea ecx, rct
          mov eax, [ecx].RECT.right
          mov edx, [ecx].RECT.bottom
          sub eax, [ecx].RECT.left  ; new window width in eax
          sub edx, [ecx].RECT.top  ; new window height in edx

          invoke MoveWindow, hWin, 0, 0, eax, edx, TRUE
Prior to centering the window, I tested this code first.
However Window x is not zero, but is 7. Window y position is at zero, as it should be.  :rolleyes:
The client area is properly sized to the specified dimensions as it should be.
I am having a N00B moment. (Or senior moment?)

I could center it like this (starting with x=7 instead of x=0), but I'm kinda OCD for some things.
#30
The Orphanage / Re: Ambition
Last post by daydreamer - Today at 01:21:14 AM
Making poem,3d art or 2d sketch on paper  or even coding,sometimes others inspire me
When hutch published his 64 bit random pad,inspired me improve my previous prng to 128 bit prng