Announcement

Collapse
No announcement yet.

A little newbie question about PowerGEN and PB/DLL programming.

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

  • Lance Edmonds
    replied
    Sorry George, but Colin is correct: you cannot (should not) use DDT statements for non-DDT dialogs and controls - Because Tommy used PowerGEN to create his application, he needs to stay with API functions.

    Unfortunately, Tommy did not provide enough of his code to identify the problem clearly, but from what he has posted I would suggest that his variable hEdit& is not GLOBAL - therefore it will be classed as a LOCAL by default, and hence it will contain zero instead of the window handle to an edit control.

    The easiest way to handle this is to use the GetDlgItem() API to get the handle to a control based on it's ID number - which PowerGEN will have defined already for him. For example:
    Code:
    Text$ = "some text"
    SetWindowText GetDlgItem(hDlg&, %ID_EDIT1), Text$
    Note that I used SetWindowText() instead of the encapsulation routine EmSetText() - This just removed one layer of overhead from the final application because EmSetText() is simply a wrapper for SetWindowText().



    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Colin Schmidt
    replied
    Hello,

    I don’t have any experience using PowerGEN, but by the looks of the function you show here it is producing API (as opposed to DDT: "CONTROL SET...") The PowerBASIC help files don’t teach you how to be a Windows API programmer. They do teach you how to use the PowerBASIC language, and their own custom functions and statements, but not the API. To learn the API you need to get some books. What most people recommend to start with is the book “Programming Windows” by Charles Petzold. The ISBN number is: 1-57231-995-X

    You can find a couple other recommended books under the FAQ forum.

    Colin Schmidt

    ------------------
    Colin Schmidt & James Duffy, Praxis Enterprises, Canada

    Leave a comment:


  • George Bleck
    replied
    Not sure of the surrounding code you created, but to build upon you example slightly...

    I would replace

    Code:
        EmSetText hEdit&, Text$
    with
    Code:
         CONTROL SET TEXT hDlg, %EditBoxName, Text$
    Where %EditBoxName should be replaced with the name of the edit box defined in the Dialog Editor (See also the core BAS file that accompanies you INC file).

    A good book to learn Windows programming is the Petzold book "Programming Windows 95". It is haighly rated by most users of this BBS. I myself did not find it very useful as it is mostly C language and I have some kind of problem with my DNA learning C


    [This message has been edited by George Bleck (edited March 17, 2000).]

    Leave a comment:


  • Guest's Avatar
    Guest started a topic A little newbie question about PowerGEN and PB/DLL programming.

    A little newbie question about PowerGEN and PB/DLL programming.

    Hi!

    Iv'e just bought both PB/DLL and PowerGEN. I've just made a small test program/GUI skeleton with powergen, and everything works great.

    My problem is that for example when I try to insert text into a Edit box, Combobox or any other kind of GUI box, it does not apear in the gui.

    What do I do wrong? Is there some kind of "refresh" command I got to use to get it to work?

    Here is the code I use from the generated inc file from powergen:

    FUNCTION MainWnd_buttTrykk_BnClicked(BYVAL hDlg AS DWORD, BYVAL wParam AS DWORD, BYVAL lParam AS DWORD) AS LONG

    text$ = "Test!"
    EmSetText hEdit&, text$

    END FUNCTION

    It's probably some simple thing I've forgot to do, but I can't find anything in the docs.
    ----

    I also got one more question. The docs that followed PowerGEN tell me to take a look at microsoft homepage, to get more information about programming GUI. I've looked abit there, but I have allways thought the microsoft pages are one big mess of information web that one can not find anything you look for.

    Does anyone here got any good tips for me where to get some good documentation for this? I would be very happy to get some help here.

    Have a nice day!

Working...
X