|
How about
CBrush* pBrush = CDC::GetHalftoneBrush();
CBrush* pBrushOld = pDC->SelectObject(pBrush);
CRect rc;
GetClientRect(&rc);
pDC->PatBlt(rc.left, rc.top, rc.Width(), rc.Height(), PATCOPY);
pDC->SelectObject(pBrushOld); in your view's OnEraseBkGnd()?
|
|
|
|
|
Hi,
Thanks for the Reply,
Actually how it should be is ,
The user has to be restricted to part of CView, he cannot type
anything in the margin.
Example MSWord, or Print Preview
Thanks
Sansky
God is Good, all the Time.
All the Time, God is Good.
|
|
|
|
|
The easisest way to make this work would be to overide your frame class and position the view X pixels to the left of the frame left. Then, in your frame class (OnPaint), paint the left area the color your want.
In its simplest form it would look something like:
BOOL CMyFrame::OnCreateClient(bla.bla.bla)
{
if (!CBaseFrameClass::OnCreateClient(bla.bla.bla))
return FALSE;
PostMessage(WM_SIZE);
}
BOOL CMyFrame::OnSize(bla.bla.bla)
{
if (m_pViewActive)
{
CRect ClientRect;
GetClientRect(ClientRect);
m_pViewActive->SetWindowPos(NULL,
[margin-width],
0, ClientRect.Widht()-[margin-width],
ClientRect.Height(),
0);
}
}
void CMyFrame::OnPaint()
{
CPaintDC dc(this);
CRect ClientRect;
GetClientRect(ClientRect);
dc.FillSolidRect(0,
0, [margin-width],
ClientRect.Height(),
[some-color]);
}
I did this code from memory so there are probably some errors, but basically should work.
|
|
|
|
|
Hi,
Thanks for the answer, I tried
the code, which runs fine , but
one problem remains is , How do
I find the Height of the View,
because if there are multiple
Toolbars, ( esp. which can be
dynamically aligned ), how do I calculate the height, also I have to consider the StatusBar.
Because when I do
GetClientRect(...),
then it gives me the top, left as 0 (Zero ).
Please can you help me here
Thanks,
Sanksy
God is Good, all the Time.
All the Time, God is Good.
|
|
|
|
|
So you have a toolbar and status bar on your view's frame? Or just on your main frame window?
If you are using traditional MDI you probably just have it on your main frame window and the GetClientRect call in your child's frame window will return
the correct values.
If you are using MTI, FDI or have toolbars on your child frame you will need to look at the RepositionBars function (CWnd? member I think?). I don't have access to my development PC at the moment, but I think this is right.
|
|
|
|
|
Thanks,
I will check and let you know.
Regards,
Sansky
God is Good, all the Time.
All the Time, God is Good.
|
|
|
|
|
check RecalcLayout and use the range 0 to 0xFFFF for the control bars... and check the flags in MSDN to calculate the total client rect and not actually do the GUI
- Roman -
|
|
|
|
|
Thanks for the reply, but please
can you give more details .
Regards,
Sansky
God is Good, all the Time.
All the Time, God is Good.
|
|
|
|
|
i want to use WTL::CString ,but once i add #include <atlmisc.h> to the stdafx.h,the compiler will notify me with the following:
error C2664: '_LoadString' : cannot convert parameter 2 from 'class WTL::CString' to 'char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.
who can help me?
i am coming quietly just as i am leaving quietly.
i am coming quietly just as i am leaving quietly.
|
|
|
|
|
Try explicitly casting the CString variable (Parameter 2 of the LoadString function that is failing) to a LPCTSTR. This should for the compiler to use the cast operator that is declared for the WTL::CString.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi,
I want to create a Balloon tooptip in my
status bar (i mean.. the application is in the
system tray)..
How can i do it.. and my application may run
on Win98 or Win2000 coz i read somewhere that
balloon tips work for only win2000 so how can
i check and set the tooltip accordingly..
Please help
Sameer
|
|
|
|
|
You might try handling the "need tooltip text" message and displaying the balloon tip described in this article. If you're successful, please consider posting your implementation at CP. Thanks!
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
For Win2K and up, this article should give you all the info you need.
<self-promotion>
For Win9x, this article should do nicely.
</self-promotion>
--------
Well actually they are sort of interesting Nish, on Nudes
|
|
|
|
|
hi,everyone
I am design a tree control that make of some directoris and some files.How can I save these infomation into a file, I need your help, thanks a lot!
Maybe it is not a dream!
|
|
|
|
|
See this article.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
It is so good!
Maybe it is not a dream!
|
|
|
|
|
Hi folks, I'm writing a software package that runs on NT/2K/XP.
It consists of a service that always runs, plus a UI app that runs while a user is logged on. The service needs to send notifications to the UI app.
So far I have been using BroadcastSystemMessage() to do this and it works, EXCEPT when I have multiple users logged onto XP via fast user switching.
In that case, it seems as if the service only broadcasts to the first logged on user's session; the sessions that logged on later don't seem to get the broadcast.
My service's call to BroadcastSystemMessage() looks like this:
DWORD dwRecipients = BSM_ALLDESKTOPS|BSM_APPLICATIONS;
BroadcastSystemMessage(BSF_POSTMESSAGE|BSF_IGNORECURRENTTASK|BSF_NOHANG, &dwRecipients, MSG_TO_MONITOR, msgtype, 0 );
As I said, the above code works in NT/2K and even XP when only one user is logged on, but when more than one user is logged on XP, it only seems to broadcast to the current user.
I have a feeling that I should be using some other API to get my message through to all user sessions. I've looked at the WTS... API stuff for terminal services, but there doesn't seem to be anything that sends messages (there is a badly-named routine WTSSendMessage, but it shows a messagebox, it doesn't actually send a message).
So, any IPC/XP geeks out there have any advice? At this point I'm thinking of using global objects as semaphores and having a thread in the UI app wait for them and then send messages to it's main window, but I hope there is something simpler...
Thanks,
Alex Benenson
Alex Benenson
alex@sashazur.com
|
|
|
|
|
What if the app running in each client session made a uniquely named named-pipe. You could base it upon user name, or perhaps the client session ID and some other data (like you program name or company name, as advocated by Microsoft). Then your service opens the pipe as well, and the two send data back and forth?
|
|
|
|
|
All i get is the windows directory without he UniHP added
i tried many different configurations...
CString winDIR = GetWindowsDirectory();
CString addSTR = "UniHP";
//CString fDIR = winDIR + "\\UniHP";
CString fDIR = winDIR + "\\" + addSTR;
MessageBox(fDIR,"Caption",0);
shotgun
|
|
|
|
|
It could be because you are using a CString object when you need a plain char*.
Fortunately CString has an operator converting your string to LPCSTR, so afaik you only need to add an explicit (LPCSTR) before "fDir" in the call to MessageBox.
You made a beginners mistake and now you won't do it again. Right?!
If any one question was to be contributed to Microsofts infinite stupidity re. MFC, this would be the one!
|
|
|
|
|
Dear All
I have this basic doubt - if I have a number of textboxes with in a static Group, is it possible for me to cerate an array to refer to them instead of creating memebr variables for each & every box.
example : assuem there are 3 text boxes , tehn
can i jsut say m_Textboxes[3] isntead of saying m_textboxes1, m_textboxes2, m_textboxes3.
Pl. suggest
Thanks
regards
Sankar
|
|
|
|
|
Tah urgah &foo mutt
bar 47 -> 42
enth mpi jag not gilla
[7%
Fatta?!
I think I have to spell it out. If you can't get a question understandable (and I do appreciate language barriers as I'm no English speaker myself) you will get no response.
Did you use a machine translation engine that tried to engage in some eastern to english translation?
Please check your question for spelling mistakes like "then" becomes "tehn", to begin with. Sorry for being a complete bastard, but without even displaying this amount of interest in your question (to spell these word correctly, which I don't dubt you can do), how much interest do you think people possibly answering it would pay to your question?
/Mike
|
|
|
|
|
Thanks for ur suggestion.
|
|
|
|
|
Thanks for ur suggestion.
I think "ur" was to be "your".
But to get back to your problem: Yes, you can put edit controls as a group inside "something", so long as you yourself make that "something" a collections class, providing your own operator[] and such.
++luck;
|
|
|
|
|
If you want to refer to them as a collection in order to easily enable/disable them, check out this article.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|