Announcement

Collapse
No announcement yet.

Screen location

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

  • Screen location

    Why do I feel like I asked this question already..hehe...

    I'm saving to registry the location of the dialog box so that it will start there again where it was left off..

    Doing so on WM_DESTROY also.

    Code:
        Case %WM_DESTROY
            GetWindowRect hDlg, WndRect
            SaveSetting %HKEY_LOCAL_MACHINE,"Software\Computer Creations Software\" + g_szMine,"Top", Format$(WndRect.nTop)
            SaveSetting %HKEY_LOCAL_MACHINE,"Software\Computer Creations Software\" + g_szMine,"Left", Format$(WndRect.nLeft)
          Function = 0
          Exit Function

    The numbers don't seem to jive, am I going about this the wrong way?

    The SaveSetting is a registry save routine in my DLL.


    Thanks,

    Scott


    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    MCSE, MCP+Internet
    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

  • #2
    Message %WM_DESTROY is sent for every (child)Window
    You probably should compare hWnd = WindowToSave to select
    what window-pos to save to register just once...




    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Comment


    • #3
      Scott,
      Why don't you try a small UDT and a data file in the user's application directory? It's a little old fashioned compared to writing to the registry, but it works for me. Besides, when the user deltes your application and it's folder there is no orphan info in the registry.

      Sample:
      Code:
      '======================================================================
      ' Time saver:
      '          Create a small one-time user information file
      '          to store data in the application's directory.
      '======================================================================
      
      ' Declare a UDT
      TYPE dirRec
           FromDirect AS STRING * 100   'Or whatever you need
           ToDirect AS STRING * 100
           mytime AS STRING * 3
      END TYPE
      
      ' Make it Global (if necesary)                                                                             
      GLOBAL Rec AS dirRec        
      
      ' Place info into a record
        Rec.FromDirect = "c:\myDirectory"     'Just sample info
        Rec.ToDirect = "e:\myOtherDirectory"
        Rec.myTime  = TRIM$(Minutes)
      
       ' Store this record info in User.DAT file
         OPEN "User.dat" FOR RANDOM AS #1 LEN = LEN(Rec)
         PUT #1, 1, Rec
         CLOSE
       
       ' Read the User.dat file and place info into your rec
         OPEN "User.dat" FOR RANDOM AS #1 LEN = LEN(Rec)
         GET #1, 1, Rec
         CLOSE
      HTH,
      Bob

      ------------------
      "It was too lonely at the top".

      Comment


      • #4
        Thanks,
        I may use my WriteIni function and save to an ini file, but I also use Innosetup adn give it all registry entries to delete on uninstall

        It's very good at that sort of thing too!


        Scott


        ------------------
        Scott
        mailto:[email protected][email protected]</A>
        MCSE, MCP+Internet
        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
          I'm surprised no-one has suggested GetWindowPlacement() and SetWindowPlacement()... you only need to save a WINDOWPLACEMENT structuce in the registery as binary data, and you can restores more than just the window size quite efficiently.

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

          Comment


          • #6
            The size of the app is fixed, but will that store WHERE? Sounds like it, I'll research it and try it out


            Tanks,

            Scott


            ------------------
            Scott
            mailto:[email protected][email protected]</A>
            MCSE, MCP+Internet
            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


            • #7
              Seemed like a lot of work initially but if you use this it may save some time re-starting the app.


              One question: Do I have to do a GetWindowRect first? Or does it do it for me?

              This might work

              I just gotta play with my binary registry data routine now...

              Thanks

              Scott


              [This message has been edited by Scott Turchin (edited July 09, 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

              Working...
              X