My computer will meet the asphalt on the street soon if i don't figure this out.
.DATA
buffer byte 50 dup(0)

.DATA?
buffersize DWORD ?
__________________________
.ELSEIF uMsg==WM_PAINT

invoke BeginPaint,hWnd,addr ps
mov hdc,eax
invoke GetClientRect,hWnd,addr rect


mov buffersize,50
lea eax,
mov ebx ,
invoke GetComputerName,eax,ebx

lea eax,
lea edx,

invoke DrawText, hdc, eax, -1, edx, DT_SINGLELINE
invoke EndPaint,hWnd,addr ps

Is hould get computer name in client area but i get nothing.
Any hlp appreciated.
Posted on 2003-01-03 12:09:57 by IwasTitan


.DATA
buffer byte 50 dup(0)

.DATA?
buffersize DWORD ?
__________________________

invoke BeginPaint,hWnd,addr ps
mov hdc,eax
invoke GetClientRect,hWnd,addr rect


; mov buffersize,50 ;[b] WTF are you doing here?[/b]
;lea eax,[buffer]
;mov ebx ,[buffersize]
;invoke GetComputerName,eax,ebx
invoke GetComputerName, addr buffer, 50 ; or "sizeof buffer" should work too.

;lea eax, [buffer]
;lea edx, [rect]

;invoke DrawText, hdc, eax, -1, edx, DT_SINGLELINE
invoke DrawText, hdc, addr buffer, -1, addr rect, DT_SINGLELINE
invoke EndPaint,hWnd,addr ps
Posted on 2003-01-03 12:12:30 by bazik
ok i corrected that with:

mov eax,50
mov buffersize,eax


still no text in client are

:confused:
Posted on 2003-01-03 12:15:57 by IwasTitan

ok i corrected that with:

mov eax,50
mov buffersize,eax


still no text in client are

:confused:


Did you try my code above?

And why dont you pass the value directly to the api call as I posted above?
Posted on 2003-01-03 12:26:51 by bazik
I'll give that a try. I didn't notice you had written new code.
Posted on 2003-01-03 12:30:58 by IwasTitan
I tried your code Bazik and i still get no output. I assume your code is just what you had not bleeped out in my original plus your addition.

This is pissing me off. Its a simple api call.



:confused:

EDIT; got it fixed .....here was the problem

invoke GetComputerName, addr buffer, addr buffersize; has to be long pointer to variable
Posted on 2003-01-03 12:44:30 by IwasTitan
.data?
szComputerName db 80h dup(?) ;128 is normal size.

.code
LOCAL dwLength:DWORD

;Computer Name, This is foolproof, tested on all Windows Platforms.
mov dwLength,sizeof szComputerName
invoke RtlZeroMemory,OFFSET szComputerName,SIZEOF szComputerName
invoke GetComputerName, ADDR szComputerName, ADDR dwLength ;Note: Pointer to length variable.
.if eax == TRUE
.else
;Program your own error handler.
;invoke GetLastError
;invoke dwtoa, eax, addr Number
;invoke lstrcat, addr szComputerName, addr szErrorComputer
;invoke lstrcat, addr szComputerName, addr Number
.endif
invoke lstrcat, addr szErrorMessage, addr szComputerName


Enjoy your work, P1
Posted on 2003-01-03 13:00:42 by Pone

invoke GetComputerName, addr buffer, addr buffersize; has to be long pointer to variable


D'oh!

Well, didnt touch windows programming for the last 2 months :P
Posted on 2003-01-03 13:02:58 by bazik
Pone: Thanx..thats exactly what i am looking for...cross platform code.

Bazik: Hey don't worry about it. I havn't done anything in programming in months also and you forget quickly.

Thanx for pointing out my "asshole of the century award for stupiest programming mistake" ......move buffersize,50

:alright:
Posted on 2003-01-03 13:52:17 by IwasTitan
d'oh... too late. i was gonna ask where you lived, so i could hang outside your window, waiting to catch your computer and run away with it :grin:
Posted on 2003-01-03 15:27:20 by jademtech