Announcement

Collapse
No announcement yet.

Looking For PowerBasic Skeleton Program

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Looking For PowerBasic Skeleton Program

    I am looking for a skeleton program that I found and used to
    begin learning PowerBasic wayyyy back in August. To the best of
    my recollection, the program created a window (top to bottom
    fading blue background) that demonstrated how to create radio
    buttons / slide bars / push buttons / textboxes / etc . . .

    It was hand written (as opposed to generated) and was very useful
    to me. If anyone knows of it or has a skeleton that they would be
    kind enough to contribute to my cause I would be very appreciative.

    Thanks in Advance For Your Help,

    Wes Brown

    ------------------

  • #2
    Not sure if this helps, but saw something like that a long time ago, and used it to create thsi setup file..
    Then I found Innosetup and gave up on this, but this has your blue background that fades...

    As for textboxes etc, see the samples directory under c:\pbdll60

    Also note this does not use DDT, it does it the old fashioned way...


    Code:
    #Compile Exe
    #Include "WIN32API.INC"
    #Include "COMMCTRL.inc"
    #Resource "SETUP.PBR"
    %PROGRAM = 1024
    
    '------------------------------------------------------------------------------
    
    Global WndRect      As RECT               'This is used for centering the edit box on window
    Global AppName      As String             'This is hte app that is getting installed, NOT this app
    Global hIcon        As Long
    
    Function WinMain (ByVal hInstance     As Long, _
                     ByVal hPrevInstance As Long, _
                      lpCmdLine           As Asciiz Ptr, _
                      ByVal iCmdShow      As Long) As Long
    
    Local Msg         As tagMsg
    Local szAppName   As Asciiz * 80
    Local hWnd        As Long
    Local nScreenWidth As Long
    Local nScreenHeight As Long
    Local wndclass    As WndClassEx
    
    InitCommonControls
    
    szAppName              = "SETUP"
    wndclass.cbSize        = SizeOf(WndClass)
    wndclass.style         = %CS_HREDRAW Or %CS_VREDRAW
    ' CODEPTR is used to pass the address of the function which will
    ' receive all messages sent to any window created with this class
    wndclass.lpfnWndProc   = CodePtr( WndProc )
    wndclass.cbClsExtra    = 0
    wndclass.cbWndExtra    = 0
    wndclass.hInstance     = hInstance
    wndclass.hIcon         = LoadIcon( hInstance, ByVal %PROGRAM )
    wndclass.hCursor       = LoadCursor( %NULL, ByVal %IDC_ARROW )
    wndclass.hbrBackground = GetStockObject( %WHITE_BRUSH )
    wndclass.lpszMenuName  = %NULL
    wndclass.lpszClassName = VarPtr( szAppName )
    wndclass.hIconSm       = LoadIcon( hInstance, ByVal %IDI_APPLICATION )
    
    RegisterClassEx wndclass
    nScreenWidth = GetSystemMetrics(%SM_CXSCREEN )
    nScreenHeight = GetSystemMetrics(%SM_CYSCREEN)
    
    
    ' Create a window using the registered class
    hWnd = CreateWindow(szAppName, _               ' window class name
                        "Winlog For Windows 98/NT Setup", _     ' window caption
                        %WS_OVERLAPPEDWINDOW, _    ' window style
                        %CW_USEDEFAULT, _          ' initial x position
                        %CW_USEDEFAULT, _          ' initial y position
                        nScreenWidth, _      ' initial x size
                        nScreenHeight,_      ' initial y size
                        %NULL, _                   ' parent window handle
                        %NULL, _                   ' window menu handle
                        hInstance, _               ' program instance handle
                        ByVal %NULL)               ' creation parameters
    
    ' Display the window on the screen
    ShowWindow hWnd, iCmdShow
    UpdateWindow hWnd
    ' Main message loop:
    ' Messages sent to HELLOWIN while it has the focus are received by
    ' GetMessage().  This loop translates each message and dispatches it
    ' to the appropriate handler.  When PostQuitMessage() is called, the
    ' loop terminates which ends the application.
    While GetMessage(Msg, %NULL, 0, 0)
        TranslateMessage Msg
        DispatchMessage Msg
    Wend
    Function = msg.wParam
    End Function
    
    ' WinMain
    '------------------------------------------------------------------------------
    Sub DrawGradient(ByVal hWnd As Long)
    Local hDC As Long
    Local rectFill As RECT
    Local rectClient As RECT
    Local fStep As Single
    Local hBrush As Long
    Local iOnBand As Integer
    hDC = GetDC(hWnd)
    GetClientRect hWnd, rectClient
    fStep = rectClient.nbottom / 200
    For iOnBand = 0 To 199
        SetRect rectFill, 0, iOnBand * fStep, rectClient.nright+1, (iOnBand+1) * fStep
        hBrush = CreateSolidBrush(Rgb(0,0,(255-iOnBand)))
        Fillrect hDC, rectFill, hBrush
        DeleteObject hBrush
    Next
    ReleaseDC hWnd, hDC
    End Sub
    '------------------------------------------------------------------------------
    Function WndProc (ByVal hWnd As Long, ByVal wMsg As Long, _
    ByVal wParam As Long, ByVal lParam As Long) Export As Long
    Local hDC       As Long
    Local LpPaint   As PaintStruct
    Local tRect     As Rect
    
    
    Select Case wMsg
        Case %WM_CREATE
        Case %WM_PAINT
            hDC = BeginPaint(hWnd, LpPaint)
            GetClientRect hWnd, tRect
            SetBkMode hDC, %TRANSPARENT
            SetTextColor hDC, %WHITE
            DrawText hDC, "WinLog For Windows 98/NT Setup", -1, tRect, %DT_SINGLELINE
            EndPaint hWnd, LpPaint
            Function = 0
            Exit Function
        Case %WM_ERASEBKGND
            DrawGradient hWnd
            Function = 1
            Exit Function
        Case %WM_DESTROY
            PostQuitMessage 0
            Function = 0
            Exit Function
    End Select
    Function = DefWindowProc(hWnd, wMsg, wParam, lParam)
    End Function
    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

    Comment


    • #3
      Thank you for your help Scott. I pasted your code and tried to run it but got an Error 478 (Resource File Error) on line 126. The way I entered the code, there is no line 126. The last line is line 125. Do you have any idea why I am getting this error?

      ------------------

      Comment


      • #4
        Remove this line:
        #Resource "SETUP.PBR"

        '
        and that problem will go away.


        Also keep in mind that that setup program uses the old createwindow and does not use DDT.
        Once you get on DDT it's hard to go back to the primitive way... (I suppose one could say that about VB to PB too, but PB is tight)...





        Scott

        ------------------
        Scott
        mailto:[email protected][email protected]</A>



        [This message has been edited by Scott Turchin (edited December 04, 2000).]
        Scott Turchin
        MCSE, MCP+I
        http://www.tngbbs.com
        ----------------------
        True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

        Comment


        • #5
          Thanks again Scott for your help . I am embarrassed by my own lack of experience and even further embarrassed to be asking such simple questions.

          For the past 13 years I have designed microprocessor boards around the Z80 and written hundreds of zillions of lines of assembler code to run them.
          I have products of my design, running my software, currently operating in more than 14 states. I do not tell you that to brag, only to try and
          convey to you that my current level of mental denseness is a recent development. One which was brought on by my decision to delve into
          Windows programming in general, and PowerBasic programming in particular.

          The skeleton program that I remember was written using DDT. I have lots of other questions . . . but they'll be the subject of new posts.
          Thanks again for your time.

          ------------------




          [This message has been edited by Wesley Brown (edited December 05, 2000).]

          Comment

          Working...
          X