|
Handle the WM_ENDSESSION message, you can examine the parameters to tell if it's a shutdown or just the user logging off.
--Mike--
When 900 years old you reach, look as good you will not. Hmm.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
(hi,
I used following lines of codes::
CString strEdit;
GetWindowText(strEdit);
but it is giving an error as ATL::GetWIndowTextA() cannot convert parameter 1 from Cstring to unsigned short**. But when I type it is asking for a Cstring only.
can anyone help me out!!!!!!!Please...
Himanshu
|
|
|
|
|
The ATL function CWindow::GetWindowText() doesn't work with CString s, since CString is MFC. You need to pass a BSTR or a CComBSTR (easier to use, it handles memory management for you).
--Mike--
When 900 years old you reach, look as good you will not. Hmm.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
thanks a lot Mike. It worked.
cheers..
Himanshu
|
|
|
|
|
Hi,
I want to design a 8086 Assembler in VC++ for my college Project. Please tell me which book I should follow to design the Assembler .Please Help me.
|
|
|
|
|
I have a dll that includes a particular header file. In my main application code it too uses the same same header file. When I include the header file for my dll it tries to inclue the header file twice. How do I get the compiler to only include the file if it has not already been loaded?
Example:
DLL.h File -
#include "Myheader.h"
MainApp.h File -
#include "Myheader.h"
#include "DLL.h"
Thanks for the help,
-Eric
|
|
|
|
|
The standard way to prevent multiple inclusion of a header file is to add this in each .h file. This example depicts foo.h.
#ifndef foo_h
#define foo_h
...
#endif
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Ok.. I found it.
Needed to use #if !defined and #endif in the header file.
-Eric
|
|
|
|
|
In Myheader.h:
#ifndef MYHEADER_H_INCLUDED
#define MYHEADER_H_INCLUDED
#endif There is also the #pragma once command, however I prefer the #ifdef method so that I can test for the presence of the symbol to tell whether a header has been included.
--Mike--
When 900 years old you reach, look as good you will not. Hmm.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi all,
I was wondering...
How can you give the desktop or taskbar the keyboard focus?
I know there is an SetFocus function but that only works for a window that's your app own.
Aidman » over and out
|
|
|
|
|
In the Platform SDK for SetFocus, it includes the following sentence:
By using the AttachThreadInput function, a thread can attach its input processing to another thread. This allows a thread to call SetFocus to set the keyboard focus to a window attached to another thread's message queue.
Which should help you get around the (deliberate) limitation. You could always detach straight after.
Iain.
|
|
|
|
|
But how can I get the Thread handle of the Desktop or Taskbar wich need to attach to?
Aidman » over and out
|
|
|
|
|
GetWindowThreadProcessId should give you the information you need.
Iain.
|
|
|
|
|
I tried to that, but I don't really understand how it is supposed to be done. Must I do this in a callback function or can I do it in the winman? Could you please demonstrate this process in code please?
Aidman » over and out
|
|
|
|
|
I'm using SetTimer() and KillTimer() with the simple WM_TIMER event in my CWnd application.
Given the ID number for a timer which has been set, is there a way to find out how much time is remaining before the next call for that timer?
|
|
|
|
|
No, for two reasons. 1, the timeout you pass to SetTimer() is usually not the same as the actual timeout used by the OS. The actual timeout is always a multiple of a hardware timer (about 55 ms I think on Win 9x). 2, WM_TIMER is posted to your message queue, and it's impossible to predict how much time will elapse before that message is processed.
--Mike--
When 900 years old you reach, look as good you will not. Hmm.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
hi,
using the MFC, I just want to have a window in which u can chat, so with an edit control at the bottom and also a view to display a text.
and then my real problem will be to display a text on this window, I thing that I will have to use the OnPaint(), but I don't really know how to deal with that stuff.
thx for ur help.
--
Kas'pac'll be back.
|
|
|
|
|
Hello.
You can use the CFormView Class .The FormView have a look like Dialog.You can place a RichEdit control on the top of form view and place a Edit control on the bottom of form view.
Good luck!
|
|
|
|
|
Hi,
thanks for ur idea TLiu, I'll try that, but I still wonder how to do to display a text on the RichEdit control.
thx very much.
--
Kaspac'll be back.
|
|
|
|
|
You can reference to MSDN about CRichEidt.I remenber that there is a sample in MSDN about wordpad.Using CRichEdit in the sample.;)
|
|
|
|
|
ummmmm i hate to rain on ur parade man (as the man said) but theres just a little more to a chat program than an edit window and a few buttons
"traffic lights are for people who can't make their own decisions" biz stuff about me
|
|
|
|
|
I'm working on a MDI in which I use CScrollView for the document view. I want to use the mouse wheel strictly for a special zoom function but, if I click on the scroll bar, the mouse wheel activates both my zoom event and the natural scrolling of the window.
How do I prevent the mouse wheel from scrolling the view?
|
|
|
|
|
You just need to add a handler for WM_MOUSEWHEEL. Unless you handle it explicitly, it is translated
into WM_VSCROLLs. Just type WM_MOUSEWHEEL into MSDN help index, and there are plenty of pages which
can help you.
Good luck,
Iain.
|
|
|
|
|
Yes but I've already added a handler for WM_MOUSEWHEEL. My CScrollView now correctly zooms my view in an out with the mouse wheel but, if I click on the scroll bars, using the mouse wheel still scrolls the window as well as zooming it. It only seems to happen when a scroll bar was the last interface item clicked.
|
|
|
|
|
If you've got a
BOOL CMyView::OnMouseWheel(UINT fFlags, short zDelta, CPoint point)
{
...
}
function in your class, and a
ON_WM_MOUSEWHEEL()
in the message map, then the CScrollView::OnMouseWheel should never be called.
Unless you are calling it from your function?
I would also check the return value from the function. There are only two, so
try both. I reckon FALSE would be correct, but I can't check at the moment.
Iain.
|
|
|
|