Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. move [modified]

move [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
29 Posts 10 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y yogendra kaushik

    IDONT ASK IT FRM U THEN WHY R U BEHAVE LIKE THIS Please mail me

    E Offline
    E Offline
    Eytukan
    wrote on last edited by
    #21

    yogendra kaushik wrote:

    IDONT ASK IT FRM U THEN WHY R U BEHAVE LIKE THIS

    If you behave like this you will get answer from nobody :wtf:


    --[:jig:]-- [My Current Status]

    1 Reply Last reply
    0
    • K kakan

      Beleive me, tox has got the answer, big time...

      Y Offline
      Y Offline
      yogendra kaushik
      wrote on last edited by
      #22

      then could you tell me the answer plz but give me some example because i try the previous one which doesnot solve my problem i again repeat my problem i have dialog box on which i write "hell0" on static control now i want that when this dialog box open this text starts moving not disappear from left to right and it should be shown on dialog box even when it move Please mail me

      K T D 3 Replies Last reply
      0
      • Y yogendra kaushik

        then could you tell me the answer plz but give me some example because i try the previous one which doesnot solve my problem i again repeat my problem i have dialog box on which i write "hell0" on static control now i want that when this dialog box open this text starts moving not disappear from left to right and it should be shown on dialog box even when it move Please mail me

        K Offline
        K Offline
        kakan
        wrote on last edited by
        #23

        OK, if you are calm now, then I can give it a try: You have got the solution in the early responses of this thread (from _AnShUmAn_ and , but I will try to explain the principle further: In order to move the static window, you must use a Windows timer. A timer works this way: You set it with a call to SetTimer(). When the timer expires, your OnTimer function will be called. In your OnTimer function, call MoveWindow() or SetWindowPos() to move the static window. (Use the function KillTimer to stop the timer). And that's all. I suggest you to start with getting familiar to how Windows timers work. Then put useful code in the OnTimer function. When you start with using MoveWindow() or SetWindowPos(), then you must find out the boundries of the main window and make sure your static window remains within the main window. Kakan

        Y 1 Reply Last reply
        0
        • K kakan

          OK, if you are calm now, then I can give it a try: You have got the solution in the early responses of this thread (from _AnShUmAn_ and , but I will try to explain the principle further: In order to move the static window, you must use a Windows timer. A timer works this way: You set it with a call to SetTimer(). When the timer expires, your OnTimer function will be called. In your OnTimer function, call MoveWindow() or SetWindowPos() to move the static window. (Use the function KillTimer to stop the timer). And that's all. I suggest you to start with getting familiar to how Windows timers work. Then put useful code in the OnTimer function. When you start with using MoveWindow() or SetWindowPos(), then you must find out the boundries of the main window and make sure your static window remains within the main window. Kakan

          Y Offline
          Y Offline
          yogendra kaushik
          wrote on last edited by
          #24

          i declare this code in OnInitDialog function: CString m_t2=SetTimer(4, 2000, 0); m_t2= KillTimer(5000); and then i use void CAfter::OnTimer(UINT nIDEvent) { GetDlgItem(IDC_MOVING_TEXT)->MoveWindow(10,20,50,40,TRUE); CDialog::OnTimer(nIDEvent); } where CAfter is my class name but not work please tell me Please mail me

          D 1 Reply Last reply
          0
          • Y yogendra kaushik

            then could you tell me the answer plz but give me some example because i try the previous one which doesnot solve my problem i again repeat my problem i have dialog box on which i write "hell0" on static control now i want that when this dialog box open this text starts moving not disappear from left to right and it should be shown on dialog box even when it move Please mail me

            T Offline
            T Offline
            Tara14
            wrote on last edited by
            #25

            Try this out: Declare x and y in you dialog class .h file If your dialog class name is Cmain_dlg and the name of the .h file is main_dlg.h, then goto main_dlg.h and declare x and y.

            int x;
            int y;

            Go to your main_dlg.cpp file and call the WM_INITDIALG function from the class wizard.

            void Cmain_dlg::OnInitDialog()
            {
            CDialog::OnInitDialog();

            SetTimer(1, 100, NULL);
            x=0,y=0;
            

            }

            Call the WM_TIMER function from the class wizard and add the following:

            void Cmain_dlg::OnTimer(UINT nIDEvent)
            {
            // TODO: Add your message handler code here and/or call default
            x=x+2;
            GetDlgItem( IDC_STATIC_Title )->SetWindowPos( 0, x, y, 0,0, SWP_NOSIZE|SWP_NOZORDER);
            //IDC_STATIC_Title is the name of the static control
            if (x ==200) // set the value according to you dialog box size
            x=x-200;
            CDialog::OnTimer(nIDEvent);
            }

            If this dosent help you, then nothing will! Fortitudine Vinsinues!

            Y 1 Reply Last reply
            0
            • T Tara14

              Try this out: Declare x and y in you dialog class .h file If your dialog class name is Cmain_dlg and the name of the .h file is main_dlg.h, then goto main_dlg.h and declare x and y.

              int x;
              int y;

              Go to your main_dlg.cpp file and call the WM_INITDIALG function from the class wizard.

              void Cmain_dlg::OnInitDialog()
              {
              CDialog::OnInitDialog();

              SetTimer(1, 100, NULL);
              x=0,y=0;
              

              }

              Call the WM_TIMER function from the class wizard and add the following:

              void Cmain_dlg::OnTimer(UINT nIDEvent)
              {
              // TODO: Add your message handler code here and/or call default
              x=x+2;
              GetDlgItem( IDC_STATIC_Title )->SetWindowPos( 0, x, y, 0,0, SWP_NOSIZE|SWP_NOZORDER);
              //IDC_STATIC_Title is the name of the static control
              if (x ==200) // set the value according to you dialog box size
              x=x-200;
              CDialog::OnTimer(nIDEvent);
              }

              If this dosent help you, then nothing will! Fortitudine Vinsinues!

              Y Offline
              Y Offline
              yogendra kaushik
              wrote on last edited by
              #26

              THANKS A LOT AND SORRY TO TOX Please mail me

              T 1 Reply Last reply
              0
              • Y yogendra kaushik

                THANKS A LOT AND SORRY TO TOX Please mail me

                T Offline
                T Offline
                toxcct
                wrote on last edited by
                #27

                it's OK if you say it without caps... ;P unless you have a ear problem :cool:


                TOXCCT >>> GEII power

                [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

                1 Reply Last reply
                0
                • Y yogendra kaushik

                  then could you tell me the answer plz but give me some example because i try the previous one which doesnot solve my problem i again repeat my problem i have dialog box on which i write "hell0" on static control now i want that when this dialog box open this text starts moving not disappear from left to right and it should be shown on dialog box even when it move Please mail me

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #28

                  yogendra kaushik wrote:

                  because i try the previous one which doesnot solve my problem

                  Show the code that is not working.


                  "The largest fire starts but with the smallest spark." - David Crow

                  "Judge not by the eye but by the heart." - Native American Proverb

                  1 Reply Last reply
                  0
                  • Y yogendra kaushik

                    i declare this code in OnInitDialog function: CString m_t2=SetTimer(4, 2000, 0); m_t2= KillTimer(5000); and then i use void CAfter::OnTimer(UINT nIDEvent) { GetDlgItem(IDC_MOVING_TEXT)->MoveWindow(10,20,50,40,TRUE); CDialog::OnTimer(nIDEvent); } where CAfter is my class name but not work please tell me Please mail me

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #29

                    yogendra kaushik wrote:

                    CString m_t2=SetTimer(4, 2000, 0); m_t2= KillTimer(5000);

                    What is this? SetTimer() does not return a CString object. A timer having an id of 5000 has not been created so why try and kill it?

                    yogendra kaushik wrote:

                    GetDlgItem(IDC_MOVING_TEXT)->MoveWindow(10,20,50,40,TRUE);

                    How do you propose this to move a window when the coordinates are unchanging?


                    "The largest fire starts but with the smallest spark." - David Crow

                    "Judge not by the eye but by the heart." - Native American Proverb

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups