Announcement

Collapse
No announcement yet.

Need help starting PowerGen

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

  • Need help starting PowerGen

    I'm getting the hang of PowerBasic (thanks for everyone's help!), so I loaded PowerGen on my system. And, once again, I am struggling.

    I read through the entire help file and did the example they show. I've made the adjustments listed in the FAQ here, but I still can't get it to compile from an RC file to an RES file. I get an error message that says "file not found: 100". The "100", of course, is referring to the statement:
    100 DIALOG PRELOAD 6, 18, 297, 195
    that was placed in the DLG file by the dialog editor.

    What do I do now?

    Am I correct in understanding that PowerGen runs only from a DOS command line?

    Thanks,
    Dale

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

  • #2
    You must use text identifiers rather than numeric, and "hex mode" in DLGEDIT must be switched off. For example:
    Code:
    MAINDLG1 DIALOG PRELOAD 6, 18, 160, 100
    In DLGEDIT, you can assign a numeric value to the text identifier, and it appears like this in the .H file when you save the project:
    Code:
    #define MAINDLG1  100
    Here is the quick rundown on a complete .DLG to .RC conversion.
    First the original .DLG file as saved by DLGEDIT as ABOUT.DLG:
    Code:
    DLGINCLUDE RCDATA DISCARDABLE
    BEGIN
        "ABOUT.H\0"
    END
     
    MAINDLG1 DIALOG PRELOAD 6, 18, 160, 100
    STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
    CAPTION "PowerGEN Demo"
    FONT 8, "MS Sans Serif"
    CLASS "About"
    BEGIN
        ICON            102, 101, 12, 10, 16, 16
        LTEXT           "Text", 103, 49, 14, 102, 52
        PUSHBUTTON      "&Ok", IDOK, 59, 73, 40, 14
    END
    Next, the edited version which I saved as MYAPP.RC. The name change is important or you'll lose the original .RES file when you compile the new .RC file and you'll not be able to edit the dialog with DLGEDIT again.
    Code:
    #include "resource.h"
    #include "MYAPP.H"
     
    MAINDLG1 DIALOG PRELOAD 6, 18, 160, 100
    STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
    CAPTION "PowerGEN Demo"
    FONT 8, "MS Sans Serif"
    CLASS "About"
    BEGIN
        ICON            102, 101, 12, 10, 16, 16
        LTEXT           "Text", 103, 49, 14, 102, 52
        PUSHBUTTON      "&Ok", IDOK, 59, 73, 40, 14
    END
    Finally, the .H file, copied to use the same base name as the .RC file (MYAPP.H):
    Code:
    #define MAINDLG1 100
    Now, you should be able to launch PowerGEN and choose NEW|Application Shell, select MYAPP.RC. Check the BN_CLICKED checkbox for the IDO control. Select FILE|Generate, and you are done.

    If you are still having problems with RC.EXE, then post your .RC file (your modified .DLG file) and we'll see what we can suggest. Otherwise, email me at Tech Support and I'll send you a working DLG, RC, RES and PBR file that you can work with to get started.

    Finally, PowerGEN.EXE is a 16-bit Windows application, so you can launch it from the command-line or by double-clicking in Explorer, etc. However, RC.EXE is a command-line tool and must be launched from either the command-line or from a BATch file.

    One last thing... Have you edited your BUILD32.BAT file?


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

    Comment


    • #3
      Thanks for the help, Lance.

      Wow! This is not an intuitive process! Is there anything that guides a person into how to do this process and why each step is taken? For example, why did you have me check the BN_CLICKED box? I have no idea what that means and I would like to find these things out. Can you give me any suggestions for further study and enlightenment?

      So, I did what you suggested and got much farther. It made it all the way to compile and then I ran into errors. It makes one pass (I presume) through the compiler and gives me an error:
      "Resource file error
      Line 126"
      126 is the end of the file. Any ideas?

      A couple of other questions:
      1. When I finish running the generate function in PowerGen it asks me:
      "Build and Execute Template?"
      What is this saying?
      2. When I close PowerGen it says:
      "Loaded project was changed -- save CGN file?"
      What is this saying?

      Thanks,
      Dale

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

      Comment


      • #4
        Wow! This is not an intuitive process! Is there anything that guides a person into how to do this process and why each step is taken? For example, why did you have me check the BN_CLICKED box? I have no idea what that means and I would like to find these things out. Can you give me any suggestions for further study and enlightenment?
        It's not as bad as it seems once you understand if you have a fundamental understanding of GUI programming concepts.
        My best (and regular!) advice to gain this understanding is to read a good book on WIn32 programming. You'll find a list of recommended titles in the FAQ forum... If you have no Windows programming experience, start off with the Petzold book since the C code is easier to follow. Additionally, most of the examples in the book have been converted to PB/DLL and can be downloaded from our FILES section at http://www.powerbasic.com/files/pub/pbwin

        In summary, %BN_CLICKED is numeric identifier (equate) that represents a specific EVENT (or message) that is sent to the dialog Callback procedure when someone clicks on a button on the dialog. In the callback, the code would check for a %WM_COMMAND | %BN_CLICKED message (wMsg = %WM_COMMAND, etc).

        When that particular message is received, you code "knows" a button was clicked, and can react to that click. How your app "reacts" depends on the code ("meat") you add to the template - in general, a button would trigger some action like saving a file, exiting the dialog, etc.

        By selecting the required events for each type of control on your dialog from within PowerGEN, PowerGEN will automatically generate the appropriate message testing code. Some controls may have a dozen or more events but your app may only need to use one or two, so by selecting the events you require, PowerGEN will not generate a lot of unnecessary code in the application template it creates. A 'standard' Button generally only sends %BN_CLICKED messages.

        So, I did what you suggested and got much farther. It made it all the way to compile and then I ran into errors. It makes one pass (I presume) through the compiler and gives me an error:
        "Resource file error
        Line 126"
        126 is the end of the file. Any ideas?
        It sounds like the PBR file was not created and therefore PB/DLL could not link it into the EXE. If you edited your BUILD32.BAT file correctly, the PBR file should have been compiled ahead of PB/DLL. Therefore I'd suggest you recheck that file so that it points to the correct RC.EXE, PBRES.EXE and PBDLL.EXE locations (directory paths, etc).

        A couple of other questions:
        1. When I finish running the generate function in PowerGen it asks me:
        "Build and Execute Template?"
        What is this saying?
        It asks if you want to compile the newly generated source code into an EXE and run it. When you are doing your initial dialog design, this is a very helpful way to testing the final result of your work.

        2. When I close PowerGen it says:
        "Loaded project was changed -- save CGN file?"
        What is this saying?
        A CGN file saves the events that you selected for the controls in the dialog. Thsi way, you can reload the CGN file and your Event selection for the project will be reloaded. If you did not do this, you'd have to go through the process of selecting all of the events for each control, each time you wanted to ue PowerGEN to generate code.

        I hope this helps!

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

        Comment


        • #5
          I sent several questions to Lance via email. However, since the core issue seems to be centering around my bat file, and since it is a weekend, I'm posting this here in case others can help me.

          Here is my BUILD32.BAT file. I don't see any problem with it, but others might:

          rem @echo OFF
          IF exist %1.exe del %1.exe
          C:\Program Files\Programming\PBDLL60\Bin\RC /i C:\Program Files\Programming\PBDLL60\Winapi %2
          C:\Program Files\Programming\PBDLL60\Bin\PBRES %2
          C:\Program Files\Programming\PBDLL60\Bin\PBDLL %1 /IC:\Program Files\Programming\PBDLL60\Winapi
          REM The original code follows:
          REM C:\PBDLL60\BIN\RC /i C:\PBDLL60\WINAPI %2
          REM C:\PBDLL60\BIN\PBRES %2
          REM C:\PBDLL60\BIN\PBDLL %1 /IC:\PBDLL60\WINAPI
          IF exist %1.exe %1.exe

          questions:
          1. Is WINAPI referring to the directory, or to WINAPI.INC? I assume it is the directory.

          2. When is this executed? I presume that PowerGen runs it. Is that correct? Or, do I need to do it manually?

          Thanks,
          Dale

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

          Comment


          • #6
            Long file names are an issue here... Neither RC.EXE nor PBDLL.EXE does not support them, so any command-line parameters will need to be changed..

            You'll either have to reinstall into a short file name path, or edit the paths to use the short filename paths instead:

            ie,
            Code:
            rem @echo OFF
            IF exist %1.exe del %1.exe
            C:\Program Files\Programming\PBDLL60\Bin\RC /i C:\Progra~1\Progra~1\PBDLL60\Winapi %2
            C:\Program Files\Programming\PBDLL60\Bin\PBRES %2
            C:\Program Files\Programming\PBDLL60\Bin\PBDLL %1 /IC:\Progra~1\Progra~1\PBDLL60\Winapi
            IF exist %1.exe %1.exe
            PowerGEN runs this file when you accept the "Build and Execute" dialog.

            WINAPI indicates the name of the folder that the #INCLUDE files can be found in.



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

            Comment

            Working...
            X