Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

RegisterClassEx macro

  • Filter
  • Time
  • Show
Clear All
new posts

  • RegisterClassEx macro

    what follows is a macro for registering windows classes. the advantages are the following:
    • no need to declare a local wndclassex
    • automatic fill of the cbsize and hinstance items
    • no need to have string variables for filling the lpszmenuname and lpszclassname items - string equates passing allowed

    function pbregisterclassex( style as dword, lpfnwndproc as long, cbclsextra as long, _
                                cbwndextra as long, hicon as long, hcursor as long, _
                                hbrbackground as long, lpszmenuname as string, _
                                lpszclassname as string, hiconsm as long ) as long
    local wcex as wndclassex
      wcex.cbsize         = sizeof( wcex )          = style
      wcex.lpfnwndproc    = lpfnwndproc
      wcex.cbclsextra     = cbclsextra
      wcex.cbwndextra     = cbwndextra
      wcex.hinstance      = getmodulehandle( byval %null )
      wcex.hicon          = hicon
      wcex.hcursor        = hcursor
      wcex.hbrbackground  = hbrbackground
      if lpszmenuname = " then
        wcex.lpszmenuname = %null
        wcex.lpszmenuname = strptr( lpszmenuname )
      end if
      wcex.lpszclassname  = strptr( lpszclassname )
      wcex.hiconsm        = hiconsm
      function = registerclassex( wcex )
    end function
    please post your comments to


    Rgds, Aldo