|
Take a look at WM_QUERYENDSESSION and WM_ENDSESSION .
Nibu thomas
Software Developer
|
|
|
|
|
Hold on!, i've been trying to capture these messages in the PreTranslateMessage, but i dont know what mistake i'm making. its not getting trapped. can you help me out?
<code>
BOOL CTESTMFC2Dlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_QUERYENDSESSION)
{
if(pMsg->lParam==0x80000000)
{
}
}
if(pMsg->message==WM_ENDSESSION)
{
}
return CDialog::PreTranslateMessage(pMsg);
}
</code>
Actually the 0x80000000 is to check if its a LogOff. the owner of this thread may also like to see your reply.
VuNic
|
|
|
|
|
BOOL CMainFrame::OnQueryEndSession()
{
if (!CFrameWnd::OnQueryEndSession())
return FALSE;
AfxMessageBox("I caught System ShutDown");
return TRUE;
}
also c WM_ENDSESSION
|
|
|
|
|
If its a dialog based application?
VuNic
|
|
|
|
|
afx_msg void CShutWindowDlg::OnEndSession( BOOL bEnding )
{
AfxMessageBox("Shut Down Message Caught");
}
|
|
|
|
|
Did you chage your post?? what's that afx_msg void?? it only returns a BOOL right?
Btw, still its not working.
I tried both ::OnEndSession(BOOL b) and ::OnQueryEndSession()
BOOL CTESTMFC2Dlg::OnEndSession(BOOL bEnding)
{
//Not entering here
}
BOOL CTESTMFC2Dlg::OnQueryEndSession()
{
// Not entering here
}
What'd have gone wrong?
VuNic
|
|
|
|
|
afx_msg void CShutWindowDlg::OnEndSession( BOOL bEnding )
{
AfxMessageBox("System ShutDown Message Caught");
}
Handel WM_ENDSESSION Message
|
|
|
|
|
Handle it again?? then what's the need for ::OnEndSession ??
VuNic
|
|
|
|
|
Don't try adding those functions. Instead, go to your dialog view (where you can manipulate the button/textbox fields) click on the dialog somewhere. From there, go to the Properties tab. This is the place where you would normally set the button/textbox name, readonly, etc. Instead, click on the button next to the little Lightning bolt that is labeled "Messages." From there, scroll down until you see "WM_QUERYENDSESSION", click on that, and add OnQueryEndSession. From there your function will be added and implimented, and you can change what you're testing for inside of that.
da Big_R
|
|
|
|
|
are you talking about the class wizard?
VuNic
|
|
|
|
|
Dear C++ gurus...
I would like to know how to declare a global function in VC++. I would want to call that function from any class just by calling the function. A similar comparision would be like declaring a global function in a module and calling it from anywhere, incase of VB.
Urgent help needed.
Thanks.
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
Declare it in stdafx.h and define it in stdafx.cpp .
Nibu thomas
Software Developer
|
|
|
|
|
But won't doing that affect other projects using "stdafx"? By Global, I meant global to my particular project so that calling that function from within my project would not need an instantiation of a class. Just call the function using its name alone. Can it be done ? What would happen if I used a static Function?
Thanks for replying.
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
the stdAfx.h is shared within a only project.
moreover, making a global function is a pretty bad habit in OOP. why would you need such a thing ?
can't you do a public static member function of a classe of your project which has a more common use ?
|
|
|
|
|
Hello,
How to get the recordview pointer thru which I will get the recordset pointer, if I have put on a tree view, and a list view in my MFC application with database? It's because the record view is not the default view in this application, how to get this recordview pointer? Please help.
Thanks,
Software Developer
Sanjay Khapre
-- modified at 3:09 Thursday 9th March, 2006
|
|
|
|
|
I am writing an application in C++ to monitor chat from multilingual chat rooms. I would like to be able to determine what language the chat is in, as in some rooms only certain languages are allowed. I was thinking of using the unicode ranges to determine whether the characters of the chat are in the allowed set - but this become difficult with the asian languages as the are over 200 different language sets defined. Does anyone know of an easier method of determining what language is being used?
|
|
|
|
|
Look up words in a tiny dictionary of commonly used language-specific words.
Examples for English would be: I, you, he, she, it, a, the, have, has, am, are, is.... (you won't need more than a dozen or so per language)
Making a mistake is of course possible, but if you scan input thoroughly enough chances are you'll determine the language accurately.
Of course, the issue must have been looked into by many philologists. Try searching the web.
Technically, if you wish to avoid this method all you can do is try checking character codes unless you want to mess with checking the current keyboard layout. I've never tried the latter but it looks like headache and guarantees absolutely nothing...
|
|
|
|
|
Thanks.
I had thought of your first method, but I think certain languages use similar words so the accuracy wouldn't be that good especially for chat as maybe only one of the words I am searching for would be used per chat line.
Haven't had much luck on the web either
|
|
|
|
|
Hello EB
InternetreadFile reads page in cache so i can't get updated content. How to make it to read file each time from server?
Thanks And Reagrds
Amit
|
|
|
|
|
specify INTERNET_FLAG_RELOAD flag to InternetOpenUrl function.
Forces a download of the requested file, object, or directory listing from the origin server, not from the cache.
|
|
|
|
|
Hi everyone!! I wna knw hw to create an OpenGL window in an MFC dialog. Ive got a code from Steinsoft.net but it doesnt allow me to display a terrain inside my window. It only allows for simple objects to be displayed.
PLEASE HELP!!
Aman N
|
|
|
|
|
|
I'm confused of frequently change openmode of database via ado-recordset,
the attitude of locktype also doesn't take function (m_pRecordset->LockType=..),m_pRecordset->AddNew() take a runtime error.how to solve this problem without chage the open statement in initializing(Read only when initial open)?
Lee
|
|
|
|
|
why not you use a command object _CommandPtr and try *Executing* the insert statement? instead of using m_pRecordset->Addnew()?
VuNic
|
|
|
|
|
Hi,
I use the FindFile(sCurrImgPath) and FindNextFile functions to search for files of the format file*.x (where the * is a number) in a directory. The problem is that these functions return the file names in the following order (for example):
file1.x
file10.x
file11.x
file2.x
file20.x
file3.x etc...
and I need the files in the order:
file1.x
file2.x
file3.x
file10.x
file20.x etc...
How can I do this?
-- modified at 2:21 Thursday 9th March, 2006
|
|
|
|