|
Christian Graus wrote:
What is cross posting ?
It's the second most common break of netiquette rules on CP. The first is programming questions on The Lounge.
I see dumb people
|
|
|
|
|
Hi,
can I create a button which not get focus if it is clicked? (a focusless button like a button in a toolbar)
The focus should stay with the current control and not be "stolen" by button click. Possibly it can be done by overriding WM_LBUTTONDOWN ...? It would be great if I can avoid ownerdraw (to keep XP style button, if code is running on XP). What I found on Google mentions it has to be a onwerdraw button rebuild from scratch.
At the moment I simply set the focus back after button is clicked, but that's not that great.
Thx for help, Moak
|
|
|
|
|
For example:
CButton* bt = (CButton*)GetDlgItem(IDC_BUTTON1);
void XDlg::OnButton1()
{
bt->EnableWindow(FALSE);//For Focusless
}
void XDlg::OnRbuttonDown()
{
bt->EnableWindow(TRUE);//For back to Focus;
}
Is this helpful to you.
|
|
|
|
|
yaiii... amazing that this really works. nice trick, chepuri_uk!
I changed the code a bit and use something like this now:
void CButtonFL::OnLButtonDown(UINT nFlags, CPoint point)
{
EnableWindow(FALSE);
CButton::OnLButtonDown(nFlags, point);
EnableWindow(TRUE);
}
Gratefully, Moak
PS: I own you a pizza
|
|
|
|
|
i can't undesrtand...what is it you want..in a toolbar too we have focus on the buttons..when we click them..you can just disable it..and use if you want like that..
cheers
Himanshu
|
|
|
|
|
yeah like a button on a PC... like when you click and all the focus was gone... huuu.... like a button but just like without this focus... like when you click and... it then does not take focus... like in a toolbar we have. It's kind of button.
Moak
--
"...and it was like, bleep bleep bleep bleep
bleep bleep bleep..." Ellen Feiss, Student
|
|
|
|
|
|
hi,
do it like this!!!!!!!!!!!!!!
Open the header file for your view (double-click the class name in Class View), this is CDisableToolbarView in the example.
Okay; we need to write the declarations for our three functions; these would be as so:
afx_msg void OnToolbarButtonClick();
That's all we need in our header, so we can close that and open our cpp file.
For each of the three functions declared above, we need to create a function defintition like the one below.
void CToolbarView::OnToolbarButtonClick()
{
MessageBox("Red clicked");
}
Toward the top of the cpp file you will see a block of code starting with BEGIN_MESSAGE_MAP. Within these lines we can hook the click events up to our functions. Between the BEGIN_MESSAGE_MAP and END_MESSAGE_MAP lines, add the following three lines:
ON_BN_CLICKED(ID_TBRED,OnToolbarButtonClick)
thats it..
cheers
Himanshu
|
|
|
|
|
You may also try the easy solution :
Add your button in the ressource editor.
Doubleclick on it to open properties.
Give it a name (for instance ID_OPENFILE).
Close the window, go open the class wizard.
Select your button name in the list on the right and handle the corresponding message. All the stuff given by Himanshu will be added automatically.
Oh, BTW, Himanshu, feel free to put your code into a <pre> environment, it is far more readable.
~RaGE();
|
|
|
|
|
Hi, everyone!
Please look at the following code,
--------
#if ASSERT
sprintf (s, "_Assert: %s, %d",__FILE__, __LINE__ );
#else
//...
#endif
--------
I want to know where is the precompiled directive ASSERT defined?
Is it compiler system defined variable? What is the meaning and
function of it?
Thanks in advance,
George
|
|
|
|
|
Never heard of it. There is the _ASSERT() macro.. but i guess this ASSERT must have been defined somewhere else in your code, since obviously the one who wrote the code tried to run his own Debug Tracer.
~RaGE();
|
|
|
|
|
Thanks, Rage pal!
I am not agree with you. I think I can use "ASSERT (a>0);"
directly in MFC(without #define ASSERT before), so I think the
precompiled directive ASSERT is defined somewhere in the
compiling system and not in my app. But I am not sure about it.
Maybe ASSERT is defined only in MFC and it is not C++ stardard.
I am not sure.
What is your opinion?
Cheers,
George
|
|
|
|
|
Yup, you're right. I tried
#ifdef ASSERT
g
#endif
and it raised a compilation error (in a MFC project of mine). Sorry.
George2 wrote:
Maybe ASSERT is defined only in MFC and it is not C++ stardard
For sure. Assertion are not C++ standard. check out <assert.h>
BTW, where are you from ? I mean, originally (know your current location are US, but George seems to me like a french name)
~RaGE();
|
|
|
|
|
Thanks, Rage pal!
I am from Mars. My uncle is Martin.
I have another question, where can I find the
table of all the C++ standard compiler predefined
directive and their related meaning, like __LINE__?
Thanks in advance,
George
|
|
|
|
|
George2 wrote:
I am from Mars. My uncle is Martin.
George2 wrote:
I have another question, where can I find the
table of all the C++ standard compiler predefined
directive and their related meaning, like __LINE__?
Check out the MSDN (online on www.msdn.microsoft.com[^])
i.e. make a search of __LINE__ for macros or simply #pragma or #ifdef for directives. I can't link you the right page, since i have no internet access but a few sites (like CP) . I could copy and paste it here, but that's not really interesting since my local MSDN is in german
~RaGE();
|
|
|
|
|
#ifdef _DEBUG
Then ASSERT is defined
#endif
--
There's a new game we like to play you see. A game with added reality. You treat me like a dog, get me down on my knees.
We call it master and servant.
|
|
|
|
|
Thanks, Jörgen.
Is _DEBUG a windows pre-defined precompile directive
or C/C++ standard pre-defined precompile directive?
Thanks in advance,
George
|
|
|
|
|
It's defined by the project files I believe. When you chose a debug configuration, the compiler is passed "/D_DEBUG" IIRC.
This is however not the standard way. The standard way is to define NDEBUG (not debug) in release builds. So if you want to be cross platform, you should write code like:
#ifndef NDEBUG
#endif
Also, if NDEBUG isn't defined, then the macro assert is defined (if you include assert.h that is). But I am unsure if VC++/VS.NET defines NDEBUG in release builds or not.
--
There's a new game we like to play you see. A game with added reality. You treat me like a dog, get me down on my knees.
We call it master and servant.
|
|
|
|
|
Thanks, Jörgen pal!
George
|
|
|
|
|
Hi,
Can u help in any way for following query ????????
How can I copy user I/O (eg creating,modifing,reading a file or folder)to a fixed hidden directory ?
So that all orignial file/folder are copied to the hidden directory
When the computer is rebooted,origninal files/folder redirected back to the their location and should override the modified files/folders.
Hoping for a positive response .
|
|
|
|
|
Hi all,
I'd like to write an app which enables mouse shortcuts for not only one specifical app, but for all the apps currently running under windows (i.e. Minimize a window, Switch to next window (like Alt+Tab), ...).
1. Is this really useful ?
2. How would I implement such a thing ? It would require to catch mouse events befors they are dispatchded to the top lying window. Is this possible ?
~RaGE();
|
|
|
|
|
Rage wrote:
Is this really useful
What do you mean when you say mouse shortcuts? My mouse has maximum 3 buttons, and I don't know which of them could bear being responsible for shortcuts
Rage wrote:
How would I implement such a thing ? It would require to catch mouse events befors they are dispatchded to the top lying window. Is this possible ?
Uh ... one thing that occurs to me is installing a hook (SetWindowsHookEx) of type WH_MOUSE. That could solve your problem when placed in a DLL thus having Windows-wide scope.
|
|
|
|
|
Schlaubi wrote:
What do you mean when you say mouse shortcuts
Ever run Mozilla ? If yes, you should know what I mean. Mouse shortcuts are working this way : Hold a button down and draw a simple figure (a vertical line, an horizontal line, a right angle, etc..) then release the button. What you have drawn is detected, and is associated to a command. For instance, if i push right button, then go right, then down, then release it, it would minimize the current top-level window. A drawback is, this must not interfer with the right click possibility of the app associated to the window (for instance if drag and drop is enabled).
Schlaubi wrote:
Uh ... one thing that occurs to me is installing a hook (SetWindowsHookEx) of type WH_MOUSE. That could solve your problem when placed in a DLL thus having Windows-wide scope
Cool .. I was just crawling into MSDN, and found these Hook functions also .. this must be the possibility.
~RaGE();
|
|
|
|
|
Rage wrote:
Ever run Mozilla ?
Let me think about it ..... NO! I must admit I've never in my life used Mozilla. But your information are really interesting ... did not know that anything like that exists ... thx ...
|
|
|
|
|
Hi
I have a problem in a programming project with Visual C++
It is an extension dll for IAS (Internet Authentication Service) to
accounting and authentication dial-in users, this is a program for
using in ISPs (Internet Service Providers). IAS supports the
RADIUS (Remote Authentication Dial-In User Service) protocol.
But my problem:
In the RadiusExtensionProcessEx function when I reject the user
{
*pfAction = raReject;
}
I can add some attributes to the authentication response
{
(*pOutAttrs)[0].dwAttrType = ratReplyMessage; //=18
(*pOutAttrs)[0].fDataType = rdtString;
(*pOutAttrs)[0].cbDataLength = 24;
(*pOutAttrs)[0].lpValue = "Testing Reply Message...";
(*pOutAttrs)[1].dwAttrType = ratMinimum;
}
This specifies a message to display to the user, But if the user
is dialing form windows OS, so this message don't show to he and
windows request from the user to check and type username & password
again for three times.
My question is:
How can I send a custom reply message to windows dial-in users?
or If I cann't do that, So how can I command to their windows OS for
indicate a windows failure message?
Should I send a message with specific format?
I'm waiting for your answer...
Thank you
|
|
|
|