Click here to Skip to main content
16,020,343 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: to find the width and height of an rectangular object Image Pin
Rage21-Aug-06 2:48
professionalRage21-Aug-06 2:48 
GeneralRe: to find the width and height of an rectangular object Image Pin
dinesh_IP21-Aug-06 4:33
dinesh_IP21-Aug-06 4:33 
AnswerRe: to find the width and height of an rectangular object Image Pin
G_S21-Aug-06 4:33
G_S21-Aug-06 4:33 
GeneralRe: to find the width and height of an rectangular object Image Pin
Rage21-Aug-06 4:48
professionalRage21-Aug-06 4:48 
GeneralRe: to find the width and height of an rectangular object Image Pin
G_S21-Aug-06 5:03
G_S21-Aug-06 5:03 
QuestionMouse Acceleration Pin
Daniel Kanev21-Aug-06 1:56
Daniel Kanev21-Aug-06 1:56 
AnswerRe: Mouse Acceleration Pin
Waldermort21-Aug-06 2:27
Waldermort21-Aug-06 2:27 
QuestionHow do I update my main window from a dialog? [modified] Pin
Jarley D.G.21-Aug-06 1:37
Jarley D.G.21-Aug-06 1:37 
Hi, I´m new here and im self learning vc++ and mfc programming, add to this that I´m spanish speaking native, so please excuse my english, I will do my best so you all can understand me.

Well, what I´m doing in resume is this :
I have a CDialog logon screen in my program, where the user enter his password and username.
So I need to save the user and update the Main window with who just logged in. By the way, I´m working in a Dialog Based App.

So in my class RegisterApp : public CWinApp I do this :
class RegisterApp : public CWinApp
{
public:
	RegisterApp();
	CString sActiveUser;//A member var to save the active user.
.
.


I Initialize it :

RegisterApp::RegisterApp()
{
sActiveUser = "No user logged";
}


Then at my RegisterAppView::OnPaint() I show before the login that there´s no user:
I can see it well at the Main window that is at the background, and at front "OnTop" I got the little logon window.

RegisterApp* pApp;		
pApp = (RegisterApp*)AfxGetApp();
dc.TextOut(105,60,"Usuario activo : " + pApp->sActiveUser);


I don´t know if this is the best way, but it works and shows what I want at this moment "No user logged" .

Now, when the user logs in I do this :

bool CDlgLogon::FiltraDatos()
{
	RegisterApp* pApp;
	pApp = (RegisterApp*)AfxGetApp();
	CString sIdUsuario;
	GetDlgItemText(IDC_EDTLOGONUSER, sIdUsuario);
.
.//some code to check the user...
.	

	    pApp->sActiveUser = sIdUsuario;
.
.
}


Ok, I´ve just updated sActiveUser, I got the user in a var out of the logon dialog function, So I think I will not loose it(I´m right?), but now I need to update the Main Window with this value, in graphical mode using dc.TextOut...
Is correct that I should call the RegisterAppView::OnPaint() method again to show the actual user?. If it is, How do I do that from my dialog?
Is this the correct way to do this?

thanks in advance Smile | :)

Jarley

"Don't panic!. All will become clear in time"
AnswerRe: How do I update my main window from a dialog? Pin
prasad_som21-Aug-06 2:12
prasad_som21-Aug-06 2:12 
GeneralRe: How do I update my main window from a dialog? Pin
Jarley D.G.21-Aug-06 2:37
Jarley D.G.21-Aug-06 2:37 
GeneralRe: How do I update my main window from a dialog? Pin
prasad_som21-Aug-06 2:52
prasad_som21-Aug-06 2:52 
GeneralRe: How do I update my main window from a dialog? Pin
Jarley D.G.21-Aug-06 3:19
Jarley D.G.21-Aug-06 3:19 
GeneralRe: How do I update my main window from a dialog? Pin
prasad_som21-Aug-06 3:26
prasad_som21-Aug-06 3:26 
GeneralRe: How do I update my main window from a dialog? Pin
Jarley D.G.21-Aug-06 8:15
Jarley D.G.21-Aug-06 8:15 
QuestionLooking for a 2D graph display tool Pin
Tnarol21-Aug-06 1:25
Tnarol21-Aug-06 1:25 
AnswerRe: Looking for a 2D graph display tool Pin
Cedric Moonen21-Aug-06 1:32
Cedric Moonen21-Aug-06 1:32 
GeneralRe: Looking for a 2D graph display tool Pin
Tnarol21-Aug-06 2:23
Tnarol21-Aug-06 2:23 
Questionto change the curaor icon when we move on button Pin
johnalek21-Aug-06 1:15
johnalek21-Aug-06 1:15 
AnswerRe: to change the curaor icon when we move on button Pin
Rage21-Aug-06 1:24
professionalRage21-Aug-06 1:24 
QuestionProvide rename functionality on pressing F2 Pin
cathy_d'souza21-Aug-06 0:58
cathy_d'souza21-Aug-06 0:58 
AnswerRe: Provide rename functionality on pressing F2 Pin
Hamid Taebi21-Aug-06 1:15
professionalHamid Taebi21-Aug-06 1:15 
GeneralRe: Provide rename functionality on pressing F2 Pin
ThatsAlok21-Aug-06 2:29
ThatsAlok21-Aug-06 2:29 
QuestionGet rid of an annoying linker warning Pin
YaronNir21-Aug-06 0:54
YaronNir21-Aug-06 0:54 
AnswerRe: Get rid of an annoying linker warning Pin
Nibu babu thomas21-Aug-06 1:07
Nibu babu thomas21-Aug-06 1:07 
GeneralRe: Get rid of an annoying linker warning Pin
YaronNir21-Aug-06 2:43
YaronNir21-Aug-06 2:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.