|
I'm not exactly sure I understand you correcly ...
GetWindowRect : Gets the window ( your dialog ) size in window coordinate, from the parents point of vue, top left relative to the parent.
GetClientRect : Gets the client window ( your dialog ) size in local coordinate, usually the inside of the dialog; the top left is (? ) 0,0.
They get the size of the current object's scope.
void MyDialog::DoSomething()
{
CRect Rect;
GetClientRect( Rect );
this->GetClientRect( Rect );
GetWindowRect( Rect );
this->GetWindowRect (Rect );
}
or from the dialog caller :
...
myDialog.GetWindowRect( Rect );
myDialog.GetClientRect( Rect );
GetClientRect and GetWindowRect work for any CWnd classes.
Max.
|
|
|
|
|
Ah! MAny thanks. SO I guess I shouldnt be trying to use the GetCliuentREct in mSDN that has two parameteers.....
Thanks
Appreciate your help,
ns
|
|
|
|
|
GetWindowRect returns the location of the whole window on the screen. GetClientRect just returns the client area inside of the window. For most windows, the client area rect will look like (0,0)-(w,h) where w and h is the width and height. To be 100% correct, to get the width and height of a rectangle from a rect in the form of (l,t)-(r,b) would be width = r-l and height = b-t.
But since dialog boxes usually contain border, the size of the rect returned by GetWindowRect will be larger than GetClientRect.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I'm slowly building an interpreter using flex and bison, but it's starting to look like the only input method bison supports is through C-style FILEs (either opened explicitly or stdin).
Does anyone know if it's possible or reasonable to have bison parse input from an arbitrary string in memory? If so, can you point me at a resource that might describe the technique?
PS I have yet to read the manual thoroughly since I'm not to the point where I need to reroute input yet... If it's plainly in the manual, just call me an idiot and I'll figure it out myself.
J
May the bear never have cause to eat you.
|
|
|
|
|
As usual, I figured it out myself. Turns out there's a whole section on it in the book I have.
We need an "I feel stupid" emoticon...
J
May the bear never have cause to eat you.
|
|
|
|
|
Jamie Hale wrote:
We need an "I feel stupid" emoticon...
Please, no more gfx.
What's more important is that we do need to teach people (even if by LARTing) to read the documentation before going public with their ignorance.
|
|
|
|
|
Mike Nordell wrote:
Please, no more gfx.
It was a joke.
Mike Nordell wrote:
What's more important is that we do need to teach people (even if by LARTing) to read the documentation before going public with their ignorance.
Your blunt replies have finally fallen on accepting ears.
I notice you have striven, throughout most of your recent posts, to point out other peoples' ignorance. Not suprisingly, they haven't been very appreciative.
I, on the other hand, pointed out my ignorance before you. I even warned you of it in my initial post. Thank you for reinforcing my claims. I know now that I am truly on the right path.
Now that that's out of the way, might I suggest you reconsider your trolling attempts? Going out of your way to be more condescending than helpful is only going to piss people off, and likely contribute to angst and stress-related illnesses for you.
It's amazing the new world that opens up to you when you stop thinking of others as mere pedestrians, and instead look at them as fellow humans.
I wish you luck in your journey.
J
So much hatred - Such a short life
|
|
|
|
|
Jamie Hale wrote:
Your blunt replies have finally fallen on accepting ears.
Yeah, ain't I an a**hole?
At least I try to help the ones asking to help themselves instead of serving the answers on silver plates, which teach them nothing but "if I ever have a question, I won't bother to even look it up in the documentation since I can always bug it out of someone else".
I notice you have striven, throughout most of your recent posts, to point out other peoples' ignorance.
Then you have seen something that's never been my intention. My intention has been, however blunt (depending on the level of percieved stupidity, obviousness, or even time of day) to make those people first search for answers that are (as I have sometimes pointed out) available in either MSDN or on Google.
It is expected (by me, and many others) that someone asking a question that has an answer (i.e. not to spur a discussion) on a message board, in a newsgroup or any other publicly available "board", has first done its own research.
I'm sorry this matter has affected you in such a negative way, but I stand firm in my opinion that people should first search publicly available sources of information.
I wish you luck in your journey.
I wish thee the same, oh seeker of the goodness in humanity.
|
|
|
|
|
Mike Nordell wrote:
Yeah, ain't I an a**hole?
Nah, just blunt.
Upon re-reading my reply, I'm forced to admit I was in an odd place that day.
I have worked with people from both ends of the spectrum. Some who simply cannot think for themselves (take the guy in the next cubicle - please - "How do I print from Visual Studio?"), and others who just refuse to take advantage of someone else's experience. And while I resent (and I resent the resentment...) helping the doofuses (doofae?) out, I'm not sure that flat-out beligerance is the solution. At least it isn't for me.
I guess it comes down to giving the querent the benefit of the doubt. In the situation with the printing question, given that this wanker insists he's been programming for 10 years, it's clear he's a bit of an idiot and deserves no sympathy. I quietly explained, "Same as every other Windows app." and let it go. But in other situations, it's not always cut and dry.
Take my question, for instance. I had been tweaking my yacc grammar for a few days, periodically going to my reference manual and the online tutorials. All such reference material (save the one small section I later found) assumes input comes from files. And since the tool is really for building compilers and makes it easy to build command line applications, I was curious as to the number of hoops I would have to jump through to route something other than a file through the parser. I had looked through a fair amount of reference material, and just hadn't come across an answer.
Sure, I didn't explain this in my question, and sure I didn't read ALL reference material, and so I can see how ignorance might be assumed. But I like to think I know what I'm doing. I've written a few articles here. I've helped out from time to time in the forums. I'm quite willing to toot my own horn...
Now that I think about it, I guess I made an incorrect assumption as well. I assumed that the person replying would recognize my name and assume I wasn't being a complete slack-bag.
I guess I just got a little incensed that you assumed ignorance. No worries. As I might have mentioned, I tend to do the same. Trying to break myself of the habit though...
Mike Nordell wrote:
I wish thee the same, oh seeker of the goodness in humanity.
That whole "high expectations for humanity" thing was an old bio. I've moved on. Pretty much no hope now.
J
May the bear never have cause to eat you.
|
|
|
|
|
Jamie Hale wrote:
Now that I think about it, I guess I made an incorrect assumption as well. I assumed that the person replying would recognize my name and assume I wasn't being a complete slack-bag.
To (again) quote a movie: "Assumption is the mother of all fsck-ups".
Also, the fact that you posted your question, and then just five minutes later posted that you found the answer, displayed to me what the same thing probably would have displayed to you. Only this time, the error of assumption was mine.
Well, no harm done. Except, we both know we still need a better parser generator!
I've been looking at both PCCTS and ANTLR, and even that ANTLR actually looks pretty good, it seems it still only support Java as host language. Too bad, since all other of its ideas seems to be quite good.
|
|
|
|
|
Mike Nordell wrote:
I've been looking at both PCCTS and ANTLR, and even that ANTLR actually looks pretty good, it seems it still only support Java as host language. Too bad, since all other of its ideas seems to be quite good.
Actually, I'm starting to lean towards reusing an existing language. I've scaled my project back to the point where I'm just doing some minor scripting and automation for a tiny little utility. I get the feeling that if I follow through with my own language, my parser and interpreter VM will be 80% of my code...
Ever seen Lua[^]? I'm in love...
J
May the bear never have cause to eat you.
|
|
|
|
|
Jamie Hale wrote:
Ever seen Lua?
I've actually, and this surprises even me since I've at least tested many other scripters, including cint (the C/C++ intepreter), never even tried it. The last project needing a scripter ended up using csl (not my decision, even that I put no value in the decision) which allowed C-like code calling back into native both C and C++ code.
I did however read about LUA in an old CUJ (I think) a bunch of years ago. Maby now is the time to actually test it...
|
|
|
|
|
I am beginning to use visual c++.net standard and was wondering how to make a menu button open a different program. Plus does anyone know of a good beginner's resource for visual c++? I'm trying to learn but don't know where to start. Thanks.
|
|
|
|
|
Under the code that handles the event (i believe it does it if you double click or choose CLICK from the drop-down menu (i have VC++6, little experence with vs.net ):
(32>= (int)ShellExecute(NULL,"open", "Program To Open.exe",NULL, NULL, SW_SHOWNORMAL));
-Steven
CP Addict
By reading this message you are held fully responsible for any of the mispelln's or grammer, issues, found on, codeproject.com.
For those who were wondering, actual (Linux) Penguins were harmed in creating this message.
|
|
|
|
|
I'm working on an MDI application with multiple toolbars and I want to load and save the toolbar states to the registry. However, when I check the registry, I can see that it does store some toolbar state info to the registry, not all of it is being written correctly. Each toolbar's position and docking and so on are saved but most of the entries all use the same value for BarID#. While I can find the position and docking data for each toolbar in the registry, the unexplained use of the same BarID# means that only my first toolbar is affected by LoadBarState().
How do I get SaveBarState() to use different values for each BarID#?
|
|
|
|
|
I know this forum is for *Visual* C++, but I don't see a forum here for C++ questions with regards to other platforms. So I apologize for offending anyone.
Anyway, one of my company's customers wants us to port some software to Linux. The only real problem I see is that the software requires inter-process mutexes or semaphores. Linux does not natively support named mutexes or semaphores.
I am looking for suggestions about how to solve this problem. Is there a way to create inter-processor mutexes or semaphores (preferably named) with Linux without having to modify the kernel?
Thanks!
- Kevin
|
|
|
|
|
Yep, it does, Linux supports the standard SysV IPC functions which allow inter-process semaphores, shared memory, etc (IPC = Inter-Process Communications). Likewise, pthreads allow you to define system-wide semaphores and mutexes. Either of these should do the trick. Take a look here for IPC info, and here for pthreads info.
|
|
|
|
|
FYI: the pthread library for Linux (LinuxThreads) does not support system-wide semaphores and mutexes -- please refer to: http://pauillac.inria.fr/~xleroy/linuxthreads/faq.html#E (check out section E.7). I'm going to have to look into the SysV IPC functions to see how well that is supported by Linux. Thanks for the help!
- Kevin
|
|
|
|
|
i have a full screen dialog , and i need it to not be escaped.
i need to programmatically disable ctrl alt delete, altf4, ctrl-tab, ESC , and all other escape keys.
id think it would be best to throw away all keyboard input during my app except for Alpha Numeric Input.
I need to know the best way to do this... all suggestions are greatly appreciated.
thanks.
josh
todo....
:: insert inpirational text here ::
|
|
|
|
|
use the PreTranslateMessage and check if the message is type MS_SYSKEYDOWN, MS_KEYDOWN, etc
Carlos Antollini.
Pi Five[^]Creator
Sonork ID 100.10529 cantollini
|
|
|
|
|
Thank You, could you possibly give me idea where to do that at / how the PreTranslateMesssage function works, It looks like it only take a MSG *msg parameter, im not sure how to use it.....
i guess i should try overriding the pretranslatemessage from the app class eh... hehe, sorry im slow sometimes
todo....
:: insert inpirational text here ::
|
|
|
|
|
BOOL CMySampleWnd::PreTranslateAppMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN ||
pMsg->message == WM_SYSKEYDOWN ||
pMsg->message == WM_LBUTTONDOWN ||
pMsg->message == WM_RBUTTONDOWN ||
pMsg->message == WM_MBUTTONDOWN ||
pMsg->message == WM_NCLBUTTONDOWN ||
pMsg->message == WM_NCRBUTTONDOWN ||
pMsg->message == WM_NCMBUTTONDOWN)
{
return FALSE;
}
return TRUE;
}
Enjoy it and good programing.
Carlos Antollini.
Pi Five[^]Creator
Sonork ID 100.10529 cantollini
|
|
|
|
|
1. If you want to control Ctrl+Alt+Del you should create a GINA.DLL or try to find out one.
2. If you want to avoid all the strange keystrokes like Windows keys and so on... you must create a "keyboard system wide hook". This can handle all the keys you want to having your app. the focus or not.
3. If you want to handle normal keys you can do it as the other answer says, but it will control only the keys selected in your application when your application have the focus.
4. if you want to get the keyboard controlled since the beggining you should call the hook from a windows service in order to get it loaded before the user have logged on...
My advice:
1. system service
2. System wide hook (note that it must be placed in a DLL)
3. manipulate (start,stop...) the service from your app.
hope this helps...
|
|
|
|
|
cool, i should keep focus, because i made the dialog full screen, and stays on top, so i think i can use the pretranslate message thing... just gotta figure out now that i got an override for that function from my app class, how to code it to only allow my alphanumerics...
thanks for all the help tho , glad to learn so much at once
todo....
:: insert inpirational text here ::
|
|
|
|
|
you are right joan murt, this wont work for me.
BOOL CMatrixApp::PreTranslateMessage(MSG* pMsg)
{
return 0;
//return CWinApp::PreTranslateMessage(pMsg);
}
this kills the ESC, but does not stop system keyboard escapes like ctrl-alt-delete , and alt-f4. is there a way to filter them out too in pretranslate message, or must i make as you said, a system wide hook to do that?
todo....
:: insert inpirational text here ::
|
|
|
|
|