Announcement

Collapse
No announcement yet.

Tip: Instead of creating whole new program

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

  • Tip: Instead of creating whole new program

    As many of us do I'm sure, I use PB to do lots of one time, or seldom used, jobs. Instead of writing a whole new .exe each time, what I do is just add a Sub to a commonly used program.

    For example I use E-Z Post (extensively modified for my own purposes) a lot (for most of my posts here Where the "Sayings" are appended). So when I have short routine, I just add it to EZ Post under a "Miscellaneous" heading.

    '
    Code:
    'at top of program
    %GHL_Lav_Comments_Update = 1239 '
     
    'In Dialog set up:
      Local h_PopUp11 As Dword
      hpp = h_PopUp11 'shorter coding
      Menu New PopUp To hpp
      Menu Add PopUp, g_hMenu, "Miscellaneous", hpp, %MF_ENABLED
       Menu Add String, hpp, "Convert Microlife File", _
                         %GHL_MicroLife, %MF_ENABLED
       Menu Add String, hpp, "Remove Extra Lines in File", _
                         %GHL_Temp_Use, %MF_ENABLED
       Menu Add String, hpp, "Operating System Version", _
                         %GHL_OP_Version, %MF_ENABLED
       Menu Add String, hpp, "MsgBox_To_Clipboard", _
                         %GHL_MsgBox_To_Clipboard, %MF_ENABLED
       Menu Add String, hpp, "Update Lavallette Comments File", _
                         %GHL_Lav_Comments_Update, %MF_ENABLED
     
    'then in the main Callback:
            '
            Case %GHL_Lav_Comments_Update 'or whatever
               Call %GHL_Update_Lav_Comments 'Sub that updates the Lavallette_Comments.shtml
    '
    No need to write a whole new .exe for a simple quick job. I know lots of guys use PBForms (or PBCC) to write quickies but this is even quicker. At least for me.

    And while I'm working on a routine I call the Sub before showing the dialog in PBMain:
    '
    Code:
    Function PBMain()
    '   Call GHL_zWorking
    '   Call GHL_Itunes_Tune_Up:Exit Function
    '    Call Word_Spelling_Search
    '    Call GHL_IntelliSense_Folder_Fix
     
       Call %GHL_Update_Lav_Comments '<== Rem after satisfied it's working
     
      ShowDIALOG1 %HWND_DESKTOP
    End Function
    ================================================================
    "Imitation is the sincerest form of television."
    Fred Allen (1894-1956)
    ================================================================
    It's a pretty day. I hope you enjoy it.

    Gösta

    JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
    LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

  • #2
    PBWin8+,PBCC4+ IDEs, Template files, File, "New File As..."

    ???

    Or did you mean you don't want another *physical* file rather than need to put (type or cut/paste) all your "generic program" stuff into this new program?
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Originally posted by Michael Mattias View Post
      Or did you mean you don't want another *physical* file rather than need to put (type or cut/paste) all your "generic program" stuff into this new program?
      Apparently my post wasn't clear. I'll try again. When I have a short easy task to do, rather than create a new Program.exe, with the associated overhead (Creating a Dialog, Callback, establishing variables, ....), I use an existing program (that already has the overhead) and merely create/add a Sub to it with a pointer to it in the Main Menu.

      Would using a boiler plate template be easier, or some other method? I don't know. I just know the method outlined above is convenient for me. And others may find it so as well (or not).


      ================================================================
      People are what you make them.
      A scornful look turns into a complete fool
      a man of average intelligence.
      A contemptuous indifference turns into an enemy
      a woman who, well treated, might have been an angel.
      André Maurois
      ================================================================
      It's a pretty day. I hope you enjoy it.

      Gösta

      JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
      LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

      Comment


      • #4
        >Would using a boiler plate template be easier, or some other method

        I've certainly found the 'template files' handy. My "skeleton" program (the template file) does not include building any dialogs but it does include a 'skeleton' window procedure with some of the more common messages to be processed. I mean how many times do I really need to type

        Code:
        FUNCTION WndProc (BYVAL hWnd AS LONG, byval uMSG AS LONG, BYVAL wParam AS LONG, BYVAL lPAram AS LONG) AS LONG
        
        (same old LOCAL vars I use all the time: i, hCtrl, szText, etc) 
        
          SELECT CASE AS LONG wMsg
             CASE %WM_CREATE
        
             CASE %WM_COMMAND
                  SELECT CASE AS LONG LOWRD(wParam) 
        
        ....
        
          FUNCTION = DefWindowProc (hWnd, uMsg, wparam, lparam) 
        
        END FUNCTION
        ????

        Works for me, should be worth a little 'tinkering time' for you.

        MCM
        Michael Mattias
        Tal Systems Inc. (retired)
        Racine WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          The Perfect World

          Originally posted by Michael Mattias;267427????

          Works for me, should be worth a little 'tinkering time' for you.

          MCM
          Why is that? Is there a "rule" (The Mathias Theorem?) somewhere that everything has to be done your way? Not that it would be a bad thing, only what has always attracted me to programming is that each can do things his own way regardless of what others may think. There really aren't any rules (other than syntax) as long as it works.

          The Perfect, albeit small, World.
          It's a pretty day. I hope you enjoy it.

          Gösta

          JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
          LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

          Comment


          • #6
            What, suggesting a little 'tinkering' to a self-professed hobbyist comes off as some kind of 'mandate' or 'command?'

            You must have voted for Nixon.

            (Just like I did).

            MCM
            Michael Mattias
            Tal Systems Inc. (retired)
            Racine WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              Three times, no less. Hey, I even liked Agnew {groan}.
              It's a pretty day. I hope you enjoy it.

              Gösta

              JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
              LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

              Comment

              Working...
              X