Announcement

Collapse
No announcement yet.

PB/DLL Questions

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

  • PB/DLL Questions

    I have Visual BASIC 6.0 Learning Edition for Windows 95/98. I ordered Power BASIC Console Compiler, Power BASIC/DLL, and PowerGen program because I am frustrated by the limitations of Visual BASIC. From reading the forum messages, I found out that PB/CC has INKEY$ and WAITKEY$ functions but PB/DLL doesn’t have them. How can I simulate the INKEY$ and WAITKEY$ functions in PB/DLL? I downloaded sample code and programs written using Power BASIC/DLL and found out that I have to write code for Power BASIC/DLL almost the same way that I write code for Visual C++, not the way that I write code for Visual BASIC. In Quick BASIC, I can write code like this:

    Print “Stillwell Avenue”
    While Inkey$=””:Wend
    Print “86th Street”
    While Inkey$=””:Wend
    Print “Avenue U”
    While Inkey$=””:Wend
    Print “Kings Highway”
    While Inkey$=””:Wend

    In Visual BASIC, I have to write code like this:

    Private Sub Command1_Click(Index As Integer)
    stopindex = stopindex + 1
    End Sub

    Sub routetype01()
    Select Case stopindex
    Case 1
    Text1.Text = "Stillwell Avenue”
    Case 2
    Text1.Text = "86th Street”
    Case 3
    Text1.Text = "Avenue U”
    Case 4
    Text1.Text = "Kings Highway”
    End Select
    End Sub

    Jeffrey.

  • #2
    Jeffrey;

    PB DLL , PB CC , Quickbasic and VB are all different "animals" !

    Obviously Windows Basics are different than QB, so lets just discuss the differences in Windows Basics.

    PB CC is a Console mode compiler, which is Windows solution to porting DOS apps to 32 bits. This is why PB CC has features similiar to QuickBasic (DOS).

    PB DLL and VB produce real Windows GUI apps, but they are very different.

    Programming in PB DLL is more akin to programing in C, since you have to use the API (even with DDT that makes it easier), while VB is a unique programming environment. VB "shields" the programmer from the Windows API. VB uses things like "Methods", "Events" and "Properties" to control your application. This is not how Windows works under the hood. Windows programs (PB DLL or C) use a thing called "Callback" functions for each window and they process "Messages". Windows is basically a Message oriented operating system. If you want something done, send a message to a window and the Windows callback procedure will process the messages sent to it.

    The advantage to PB is its "raw power", since you are working at a lower level than with VB, but obviously this means more effort since you have to learn about the API. VB programmers "dabble" with the API, but a PB programmer needs to become experienced with the API.

    Since programming in PB DLL is real Windows programming (like C), you can't exactly emulate many of the things in Quickbasic. Windows programs respond to "messages" which are akin to "Events" in VB. It is not linear like QB.

    Since VB shields the programmer from the API, so much, VB programmers are initially "shocked" by what is involved in real Windows API programming, but that will wear off soon enough.

    If you would like to get a feel for "how" a Windows API (or SDK style) program is written, I suggest you get a good book on Windows programming. There are none for PB, but some C books are readable for a PB programmer.

    Here is the book that helped me learn programming the API from scratch (I had no previous knowledge of API programming):

    "Windows 98 Programming from the Ground Up"
    by Herbert Schildt

    It is an "excellent" book that is quite readable with very clear examples in C that were not difficult to port to PB.

    I strongly recommend it for any VB programmer trying to learn how to program using the API, with PB DLL !

    If you want "easy" in an API book, this one is for you. It also discussed many advanced subjects (like Common Dialogs, Common Controls, Screen savers, DLLs, GDI).



    ------------------
    Chris Boss
    Computer Workshop
    Developer of "EZGUI"
    http://cwsof.com
    http://twitter.com/EZGUIProGuy

    Comment


    • #3
      also be sure to check out our list of recommended titles:

      http://www.powerbasic.com/support/pb...hread.php?t=39

      btw, the 'api way' to do a "text1.text=" is to use the setwindowtext() api function.

      if you use ddt, then control set text is the easiest way.

      ------------------
      lance
      powerbasic support
      mailto:[email protected][email protected]</a>
      Lance
      mailto:[email protected]

      Comment


      • #4
        I have "Programming Windows Fifth Edition" book written by Charles Petzold. There are books for Visual BASIC but I am not sure if there are books for Power BASIC. I hope that PB/DLL has tutorials and good manuals. Jeffrey.

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

        Comment

        Working...
        X