I want to make flat header(as i sad before) so i found some dos about it... on VisualBasic
And i got some questions
There are using subclassing. The main idea is to plase our code before th original WM_PAINT instruction
i cannot translate it on assembler
that's code:


Sub AttachMessage(iwp As ISubclass, ByVal hwnd As Long, _
ByVal iMsg As Long)
Dim procOld As Long, f As Long, c As Long
Dim iC As Long, bFail As Boolean

' Validate window
If IsWindow(hwnd) = False Then ErrRaise eeInvalidWindow
If IsWindowLocal(hwnd) = False Then ErrRaise eeNoExternalWindow

' Get the message count
c = GetProp(hwnd, "C" & hwnd)
If c = 0 Then
' Subclass window by installing window procecure
procOld = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf WindowProc)
If procOld = 0 Then ErrRaise eeCantSubclass
' Associate old procedure with handle
f = SetProp(hwnd, hwnd, procOld)
Debug.Assert f <> 0
' Count this message
c = 1
f = SetProp(hwnd, "C" & hwnd, c)
Else
' Count this message
c = c + 1
f = SetProp(hwnd, "C" & hwnd, c)
End If
Debug.Assert f <> 0

' SPM - in this version I am allowing more than one class to
' make a subclass to the same hWnd and Msg. Why am I doing
' this? Well say the class in question is a control, and it
' wants to subclass its container. In this case, we want
' all instances of the control on the form to receive the
' form notification message.
c = GetProp(hwnd, hwnd & "#" & iMsg & "C")
If (c > 0) Then
For iC = 1 To c
If (GetProp(hwnd, hwnd & "#" & iMsg & "#" & iC) = ObjPtr(iwp)) Then
ErrRaise eeAlreadyAttached
bFail = True
Exit For
End If
Next iC
End If

If Not (bFail) Then
c = c + 1
' Increase count for hWnd/Msg:
f = SetProp(hwnd, hwnd & "#" & iMsg & "C", c)
Debug.Assert f <> 0

' Associate object with message at the count:
f = SetProp(hwnd, hwnd & "#" & iMsg & "#" & c, ObjPtr(iwp))
Debug.Assert f <> 0
End If
End Sub

Please some one help me...


Posted on 2003-02-15 14:34:54 by Hurtado
What is this Win2k style you keep talking about, AFAIK Win2k looks the same as every other version of windows except for windows xp themes. People have asked you to clarify what you want and you never answer.

http://www.asmcommunity.net/board/index.php?topic=10861

http://www.asmcommunity.net/board/index.php?topic=10691

Maybe you could post a screenshot of what you are wanting to accomplish ?
Posted on 2003-02-15 16:18:56 by BubbaFate
Ok that's flat header(dev studio) :
Posted on 2003-02-16 00:06:46 by Hurtado
So you want to subclass in assembly.. easy, much easier than VB IMHO.

1st, read the tutorials on subclassing and superclassing at

They are tutorials 20 and 22, while you are there, real em all :)

Basically, for example if you wanted to subclass an edit control, you create your edit control "text box" then you "hook" it with your own window procedure:



; #######################################
; ###### Catagory Textbox
push 0
push hInstance
push 0
push hWnd
push 20
push 235
push 25
push 242
push WS_CHILD\
or WS_VISIBLE
push 0
push offset WndClsEdit
push WS_EX_CLIENTEDGE
call CreateWindowEx ; Create edit control
mov hTxtCatagory, eax ; save edit control handle

push offset ProcEdit ; address of our edit window proc
push GWL_WNDPROC
push hTxtCatagory
call SetWindowLong
mov OldWndProc,eax ; save handle to original edit window proc

Now for the window proc where we will process the messages we want and pass the ones we don't back to the original proc, in this example This is my proc for my subclassed edit control


ProcEdit PROC hEdit:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
.if uMsg == WM_CHAR
.if wParam == VK_RETURN
call AddCatagory ; We only want return do we don't get that damn ding and do our stuff
.else
push lParam
push wParam
push uMsg
push hEdit
push OldWndProc
call CallWindowProc ; pass all other character messages on
ret
.endif
.else
push lParam
push wParam
push uMsg
push hEdit
push OldWndProc
call CallWindowProc ; pass all other message back to original proc
ret
.endif
ret
ProcEdit endp


Read the tutorials at the link above, they will help a lot, and so will the people at this board!
:alright:

Also, where is the rest of the VB code? In the code you posted above, they/you are only setting the subclass, where is the code for the subclass procedure to process the messages?
Posted on 2003-02-16 01:06:56 by Gunner
The problem is in that i need to subclass the window and place my code after original WM_PAINT control code.
If i will make it with SetWindowLong function it will change the original WM_PAINT procedure - that's the problem...
Posted on 2003-02-16 01:21:34 by Hurtado
There is no such thing as a WM_PAINT procedure. Every single control has a window procedure that receives messages so the window knows what to do. You subclass controls so instead of the control getting the messages first (WM_PAINT) (windows --> messages --> control --> you see control) you get all the messages for the control first and do what you want (windows --> messages --> you draw flat headers --> control --> you see control) If you are supposed to draw flat headers while the control is "painting" then you have to intercept the WM_PAINT message and do your thing then pass control back to the control... Read the tuts... VB made everything harder than it supposed to be. If you have the MASM32 package, look throught the example code there is subclassing code there, and read the tutorials I gave you a link to....
Posted on 2003-02-16 01:36:05 by Gunner
If you wanna understand that i mean there is a link :

http://vbaccelerator.nuwebhost.com/codelib/flatcbo/flathdr.htm

there are the flat header on vb.
I can't explain all idea here (is too long) so read this tutorial.
Posted on 2003-02-16 01:44:09 by Hurtado
WOW VB-Accelerator is back on the net? That is cool, I was upset when that site wasn't updated in a looong time, everyone in the NG's thought it was dead, glad to see it back....

Now, almost every control from VBA needs that special SSubtimer.dll control. That is what is catching all the messages. If you look at the code in the FlatHeader.cls, the Private Function ISubClass_WindowProc IS the new window proc for the listview. It is processing the WM_PAINT message. Look at my code here, search this board and read the subclassing tutorials I gave you a link for, That code is not that hard to convert to an assembly proc. If you don't know what the code in VB is doing, you will get lost in Assembly... read the tutorials first.

Subclass your listview with SetWindowLong and in the window proc, catch WM_PAINT, paint the header and that's it....
Posted on 2003-02-16 02:04:36 by Gunner
I know that VB code is doing i got a problems with translation to assembler...
i read up too much tutorial on subclassing but i stiil can't translate...
As i sad before i'am creating asm flat controls library (now there are button, combobox, edit, check box)
so the flat header is very needed.
can you convert it on assembly proc ?
i can understand that is doing on VB but with realisation on assembler are problems....
Posted on 2003-02-16 02:15:15 by Hurtado

What is this Win2k style you keep talking about, AFAIK Win2k looks the same as every other version of windows except for windows xp themes. People have asked you to clarify what you want and you never answer.

http://www.asmcommunity.net/board/index.php?topic=10861

http://www.asmcommunity.net/board/index.php?topic=10691

Maybe you could post a screenshot of what you are wanting to accomplish ?


Thanks for pointing that out, BubbaFate! I closed these 2 threads.

Hurtado,
please dont open multiple threads for the same problem. If you didnt get a clear answer, just ask again in the same thread.

Thanks,
bazik
Posted on 2003-02-16 02:50:45 by bazik
I'l undertood almost all
now i need only WM_PAINT proc translation on aasembler
can anyone translate it(i got some problems with realisation)?
thnk's for help...
Posted on 2003-02-16 03:07:38 by Hurtado

The problem is in that i need to subclass the window and place my code after original WM_PAINT control code.
If i will make it with SetWindowLong function it will change the original WM_PAINT procedure - that's the problem...


.if uMsg == WM_PAINT

[color=green]; code that I put here get executed before the original WM_PAINT[/color]
CallWindowProc, lpPrevWndFunc, hwnd, uMsg, wParam, lParam
[color=green]; code that I put here get executed after the original WM_PAINT[/color]
Posted on 2003-02-16 05:39:58 by BubbaFate
thank's that exactly what i needed!!!!
Posted on 2003-02-16 05:57:07 by Hurtado