ricardoaux Posted May 5, 2009 at 05:35 PM Report #261642 Posted May 5, 2009 at 05:35 PM Boas A minha dúvida é a seguinte: Tenho num botão o seguinte: void CDialog3::OnButton1() { int x, y; x=(rand()%5+1); y=(rand()%5+1); } Depois noutro botão vou precisar das variáveis x e y. Como faço para as poder usar no outro botão???? Desde já obrigado.
TheDark Posted May 5, 2009 at 08:22 PM Report #261709 Posted May 5, 2009 at 08:22 PM Em vez de declarares as variáveis como locais ao método, declara-as como campos da classe CDialog3. Desaparecido.
Metaluim Posted May 5, 2009 at 09:08 PM Report #261733 Posted May 5, 2009 at 09:08 PM passa por referência as variáveis
TheDark Posted May 5, 2009 at 09:17 PM Report #261736 Posted May 5, 2009 at 09:17 PM Passa por referência onde? Aquele método é um handler de mensagem, não tem argumentos. Desaparecido.
Metaluim Posted May 5, 2009 at 09:57 PM Report #261748 Posted May 5, 2009 at 09:57 PM Passa por referência onde? Aquele método é um handler de mensagem, não tem argumentos. yah, tens razão. Isto é Visual C++. Sorry my bad 😞
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now