|
And how can i create a new thread?
Vis
|
|
|
|
|
Use AfxBeginThread. Pass a thread function and create a meessage loop inside of it. Then use PostThreadMessage to communicate with the thread.
rechi
|
|
|
|
|
You should give the UI chance to process the mesgs.
Put the foll. function in your app and call it
in the loop.
void CMyApp::ProcesssQueuedMsgs()
{
MSG msg ;
// User tries to close the application during a lengthy process causes a crash,
// (The window object are destroyed when this mesg is processed) so exclude WM_CLOSE.
while( PeekMessage(&msg, NULL,0,0,PM_NOREMOVE) && msg.message != WM_CLOSE )
{
AfxGetApp ()->PumpMessage () ;
}
LONG lIdle = 0;
while (AfxGetApp ()->OnIdle (lIdle++));
}
In OnCancel()
set the 'running' to false and the code will work.
|
|
|
|
|
This should be the best way rather than spwning a new thread.
|
|
|
|
|
Thx for the comment, that is more than what I can say for the
fellows who r actually using this code and dont bother with
a reply.
|
|
|
|
|
Sorry but i use internet in school and we had a holiday from Saturday to Wednesday so i could not send any messages to you (or even to read them).
But now i can so thanks for all!
Vis
|
|
|
|
|
|
Sorry, but i could not even read your messages because i was on holiday for a few days and i hadn't got any computer or else to use the net.
But now i have so i say thanks for you all: Thanx!
Vis
|
|
|
|
|
I have SDI, when I resize it or non Active.. all will be clear as new document. Help me,how to save it???
|
|
|
|
|
What do u mean all will be clear ?
Do u mean that ur view is getting erased ?
|
|
|
|
|
Draw dot, and type text... more
|
|
|
|
|
Hi,
I´m running Ms Word Automated, when I run my program I show that word document inside my framework, the problem comes when the user wants to load a document, I would like that the user could be able to load the doc in the same window that is open ( not what Ms Word makes open a new Word Window, for the new opened file ).
How can I do that ?, Thanks in advance, Greetings
Braulio
|
|
|
|
|
Where is the user selecting the new document from ?
Is it from your own File->Open
or from the Explorer ?
If it is from the explorer it is using file association and you cannot change
that behaviour only for that session.
Try to provide the user an option to open a document from
you own file menu,.
|
|
|
|
|
Is from my own menu, but If I try to show the standard open dialog it fails ( and If I try to open the document, then it creates a new window for the new Word instance).
Can you help me a bit more ?, Thanks a lot, greetings
Braulio
|
|
|
|
|
Look at this example, it shows what u want.
http://www.codeproject.com/com/xoffice.asp
|
|
|
|
|
The problem with that sample is that it load the template when it creates the new doc, but what I need is to let the user load in the same window, later another document
m_ctrl = new CXOfficeCntrItem(this,path);
|
|
|
|
|
I am writing an application that the user will have to log into using their network password. I woudl like to be able to send their username and password to a server and validate it. If anyone could help me with this, I would appreciate it. Thanks
T
|
|
|
|
|
Well you could try to validate the user
by logging into the server.
BOOL LogonUser(
LPTSTR lpszUsername, // user name
LPTSTR lpszDomain, // domain or server
LPTSTR lpszPassword, // password
DWORD dwLogonType, // type of logon operation
DWORD dwLogonProvider, // logon provider
PHANDLE phToken // receive tokens handle
);
|
|
|
|
|
I think that function LogonUser() could help you.
|
|
|
|
|
The problem with LogonUser() is, it requires WinNT/2000. What happens if this app is intended to use from 95/98??
Some time back I did 'change password' thing. In that I loaded 'NetApi32.DLL' and got the func ptr for 'NetUserChangePassword' and used it to change the password for user under any domain. There are some more 'NetUser*' functions available in the dll. I am sure inthat, there will be a 'login' kind of function in 'NetApi32.Dll'.
The advantage of this way is the app can be run on any Windows machine.
|
|
|
|
|
NetUserChangePassword
is not for Win 9X Systems
the foll. is from the MSDN.
Requirements
Windows NT/2000 or later: Requires Windows NT 3.1 or later.
Windows 95/98/Me: Unsupported.
Header: Declared in Lmaccess.h; include Lm.h.
Library: Use Netapi32.lib.
|
|
|
|
|
OOPS!! I am sorry. You are right.
I recollect it now (I just opened the my old project code in soursafe
).
While changing the passwords, what I did was: For Win 9x I loaded Mpr.Dll and used some functions like PwdSetPasswordStatus, PwdChangePassword to change the network password. For other OSs I loaded NetApi32.Dll.
bye bye.
|
|
|
|
|
Srini Kella wrote:
I woudl like to be able to send their username and password to a server and validate it.
I understood you would like to validate user at the server
I guess your server is not running Win9x, so that scenario could work.
|
|
|
|
|
I'm learning MFC trough internet so I don't have a book. But I haven't found any tutorial on how to make a simple "open file" dialog. Where can I find one? Thanks
|
|
|
|
|
Just take a look here:
http://msdn.microsoft.com/library/en-us/vcmfc98/html/_mfc_cfiledialog.3a3a.cfiledialog.asp
http://msdn.microsoft.com/library/en-us/vcmfc98/html/_mfc_cfiledialog.3a3a.domodal.asp
Best regards,
Vladimir
|
|
|
|