move [modified]
-
IDONT ASK IT FRM U THEN WHY R U BEHAVE LIKE THIS Please mail me
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]
-
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
-
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
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
-
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
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
-
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
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!
-
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!
THANKS A LOT AND SORRY TO TOX Please mail me
-
THANKS A LOT AND SORRY TO TOX Please mail me
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! ]
-
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
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
-
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
yogendra kaushik wrote:
CString m_t2=SetTimer(4, 2000, 0); m_t2= KillTimer(5000);
What is this?
SetTimer()
does not return aCString
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