|
|
thank you for that info., but i am a total new to VC++ MFC,.
where do i put the code. should i just double click the button and add the code like Visual Basic do?
|
|
|
|
|
|
You should really buy a book about VC++. It is nearly impossible to help someone who has almost no knowledge of VC++ or C++ through a forum. It will take ages to explain some basic concepts. You will be much more efficient by reading a book first.
|
|
|
|
|
i think that's the best thing to do for now?.. read a book and understand the concepts and terminology used in VC++. anyway, thanks for the advice.
|
|
|
|
|
How did you end up in this situation anyway? Did you spice up your CV?
|
|
|
|
|
by the way, here is the app. that i was trying create. you can download the project and check it, it's just a design and no codes yet, i just named the controls to their ID's..
what i am tring to do is move the three buttons until they are totally out the the app window..
thanks for the help guys, appreciate it.
here is the URL to download the project.
http://h1.ripway.com/lgmanuel/VC MFC/MoveTheButton.rar
|
|
|
|
|
who the f*** voted you down here! let me even it
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
and how do i get the current coordinates of the three buttons?
|
|
|
|
|
|
..... update
by the way, here is the app. that i was trying create. you can download the project and check it, it's just a design and no codes yet, i just named the controls to their ID's..
what i am tring to do is move the three buttons until they are totally out the the app window..
thanks for the help guys, appreciate it.
here is the URL to download the project.
http://h1.ripway.com/lgmanuel/VC MFC/MoveTheButton.rar
|
|
|
|
|
Why not leave the buttons where they are and simply call ShowWindow(SW_HIDE) on each of the buttons?
Such as:
<br />
GetDlgItem(IDC_BUTTON1)->ShowWindow(SW_HIDE);<br />
GetDlgItem(IDC_BUTTON2)->ShowWindow(SW_HIDE);<br />
GetDlgItem(IDC_BUTTON3)->ShowWindow(SW_HIDE);<br />
Then somewhere else in your program if you want to show the buttons again:
<br />
GetDlgItem(IDC_BUTTON1)->ShowWindow(SW_SHOW);<br />
GetDlgItem(IDC_BUTTON2)->ShowWindow(SW_SHOW);<br />
GetDlgItem(IDC_BUTTON3)->ShowWindow(SW_SHOW);<br />
|
|
|
|
|
there is no need for hiding the controls., i got an idea that if the LEFT button is clicked, it scrolls all the way to the left until the three buttons are gone, then it shows up on the right side of the app window, likewise with the right button. then it should stop to where the three buttons are if the center button is prssed.
Like the <marquee> tag in HTML, it just scrolls to the direction, then shows up to the other side..
i think but am not sure if i need to get the coordinates?
need help guys. thanks..
|
|
|
|
|
The link does not work. Do you have a Solution ?
|
|
|
|
|
|
Yes that will do the job.
Found an easy TODO for the Timer-Part here ("Using Timers in MFC Applications")
In our Sample it would look like this:
First update your class in MoveTheButtonDlg.h
(Some work is already done by VisualStudio when clicking the Button)
enum {DIR_STOP, DIR_LEFT, DIR_RIGHT};
class CMoveTheButtonDlg : public CDialog
{
...
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedMoveright();
afx_msg void OnBnClickedStop();
afx_msg void OnBnClickedMoveleft();
afx_msg void OnTimer(UINT TimerVal);
private:
BOOL StartTimer (UINT TimerDuration);
BOOL StopTimer(void);
UINT_PTR m_nTimer;
UINT m_Direction;
DWORD m_winpos;
};
After that you have to declare Message-Map:
BEGIN_MESSAGE_MAP(CMoveTheButtonDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_MoveRight, &CMoveTheButtonDlg::OnBnClickedMoveright)
ON_BN_CLICKED(IDC_Stop, &CMoveTheButtonDlg::OnBnClickedStop)
ON_BN_CLICKED(IDC_MoveLeft, &CMoveTheButtonDlg::OnBnClickedMoveleft)
ON_WM_TIMER ( )
END_MESSAGE_MAP()
At last the new members have do be defined:
void CMoveTheButtonDlg::OnBnClickedStop()
{
m_Direction = DIR_STOP;
StopTimer();
}
void CMoveTheButtonDlg::OnBnClickedMoveright()
{
m_Direction = DIR_RIGHT;
StartTimer(1000);
}
void CMoveTheButtonDlg::OnBnClickedMoveleft()
{
m_Direction = DIR_LEFT;
StartTimer(1000);
}
BOOL CMoveTheButtonDlg::StartTimer (UINT TimerDuration)
{
m_nTimer = SetTimer (IDT_TIMER_0, TimerDuration, NULL);
if ( m_nTimer == 0) {
MessageBox (_T("Unable to obtain timer"), _T("IDT_TIMER_0"), MB_OK|MB_SYSTEMMODAL);
return FALSE;
}
return TRUE;
}
BOOL CMoveTheButtonDlg::StopTimer(void)
{
if(m_nTimer) {
if (!KillTimer (m_nTimer)) {
return FALSE;
m_nTimer = 0;
}
}
return TRUE;
}
void CMoveTheButtonDlg::OnTimer (UINT TimerVal)
{
if(TimerVal != m_nTimer)
return;
switch(m_Direction) {
case DIR_LEFT:
m_winpos-=5;
break;
case DIR_RIGHT:
m_winpos+=5;
break;
}
}
I hope you can do the rest at "TI: move to ... " at your own
|
|
|
|
|
this is a step forward.. thanks.. i just thought maybe i needed timers, then poof.. a sample code.. thanks..
just have to modify the code to fit my needs..
but am still having trouble moving the buttons., a trying to work how to move i now?
|
|
|
|
|
hi, i have another question?
am trying to connect two computers on the network whit the same App that i created, how do i connect these 2? it should prompt the user that the connection is successful?
help guys. thanks
|
|
|
|
|
how do i disable the left and right button when the window load.. and enable it back when press the center button?
|
|
|
|
|
You already have the very good hint from Niklas Lindquist 14Jul'10.
SetWindowPos()[^] or MoveWindow()[^] to move the buttons
Every Button is based on a Window and SetWindowPos() can do everything
with the button (even hide it) if you are able to get the CWnd-handle.
See Example:
void CWinApp::HideApplication()
On the MSDN Online-Page (linked also by Niklas Lindquist) you really
should start to read MFC doku (See advice of Cedric Moonen).
You can get hints from the Forum, but nobody will do the complete work
for you.
What is the complete Funktion of your Application ?
-If you want networkfunktions you will probably get Timing an Sync Problems.
You can send every Button a message to get the same result as if you
pressed it, but over Network you will not see the monitor. You have to
find a way to send the results back to every client and display it.
|
|
|
|
|
yup., one of my nerd friends is helping on the networking side of the app.. needs to read about Socket Buffer and Listening..
anyways., got a lot of hints from you guys on how to start my C++ adventure, hope it works for me.,
am trying to change my programming path from VB to C++., i wish myself good luck.
Thank you again.
|
|
|
|
|
I'm creating a new program. The ONLY thing which is important for me is the running time of the program. Should I use a regular expressions, or maybe should I write my own search code?
|
|
|
|
|
yftah1989 wrote: The ONLY thing which is important for me is the running time of the program.
Just leave your main() function empty. It can't get any faster than that.
Seriously, what are you trying to search for and in what?
|
|
|
|
|
yftah1989 wrote: Should I use a regular expressions, or maybe should I write my own search code
You should use the faster approach.
Seriously it may depend on a some factors like the complexity of your regex queries and the efficiency of your own search code (standard regex code is usually quite fast)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I am going to create a setup wizard application using property sheet.But I don't know how to use progress bar in property sheet.
My requirement is to update progress as we move from one property page to another.
Please provide some suggestions/samples.
Thanks,
Sachin
|
|
|
|