|
You could call the method twice with DT_CALCRECT, one with the "More" and one without. If the height of the calculated rectangle changes, then you know that the "More" didn't fit on the line, so it was moved to the next line by DrawText().
Just a thought...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
Just a thought...
But it could work
(I still have problems with the different font etc., but I guess that I can compensate for)
Pandoras Gift #44: Hope. The one that keeps you on suffering. boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
CDC::DrawText have a "nFormat" parameter , use DT_CALCRECT can figure out how much rect;
e.g
CRect rt(0, 0, 0, 0);
pDC->DrawText(szText, rt, DT_CALCRECT);
|
|
|
|
|
|
I have a modal dialog box created by a class(say class A). I want to close this dialog box from another class (say class B),which is not derived from class A .I think,the way how this should be done is to get a handle to the dialog box and close it, from the class B. Can you suggest me how I can accomplish this, since I dont have access to the dialog box class's object(class A 's object, i cant even pass it as i class A is unknown in class B) at the point where i want to close it (in class B).
|
|
|
|
|
if you know the name of dialog box , you can use FindWindow to find the HANDLE of WINDOW . and send message to dialog to close it.
e.g
CWnd * pWnd = FindWindow("Dialog","NAME") ;
if( NULL != pWnd->GetSafeHwnd() )
{
pWnd->SendMessage(WM_COMMAND,IDOK,0);
}
|
|
|
|
|
im getting linker error 2005 for source files that contain functions that are apart of a header file that i included in the main source file, and other source files that needed it. how can i overcome this.
|
|
|
|
|
Have you looked up LNK2005 in MSDN? There is a fairly extensive explanation about the error there.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Hi All,
I need a full refrence about ICL ( icon library format) , if anyone help I will bw thankfull.
Best,
|
|
|
|
|
|
Dear Michael,
Thanks a lot , that realy helped me out.
|
|
|
|
|
Check http://www.wotsit.org/ for file formats.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
how to create full duplex mode network with 3 or 2 client
and one server?
please help me?
thanks.
|
|
|
|
|
Hi!
I'm making a simple mapeditor in MFC for a game and I would like to add a new window where the user can see the map renderd in openGL.
So I'm simply looking for an article on how to create a new independent window in my MFC project. I've searched the site, but i haven't found anything. Can anyone help me find it?
Thanks!
|
|
|
|
|
I'm using this project for the basis of my learning. However, I'm having trouble incorporating the class into my project. I read about device contexts and such but I couldn't find a straightforward sequence of steps to change my app to accept the new routines. I'm looking for information on what type of code to add and where, not a simple copy and paste job, but something concise. For instance, adding "CDC *pDC;" to my app class, and to add "pDC = pFrame->GetWindowDC();" is what I'm looking for. I tried to read through the project demonstration mentioned above to pick out the information but there's too much to wade through. Can anyone help me out?
|
|
|
|
|
Hey Folks,
Newbie. I have many dialogs using buttons. The text fits great on my computer, but when I load the program to other computers the text is too big. I assume that this is font management but I don't really know how to control them. Please point me in the right direction.
Thanx.
|
|
|
|
|
you are try func "SetFont" to set font .
e.g
CDialog dlg;
CFont font;
font.CreateFont(...... );
dlg.SetFont(&font);
|
|
|
|
|
note where ive placed the comments in the following code and could you explain the results im getting, thanks.
// Evaluates a given input.
#include <iostream>
#include <conio.h>
using namespace std;
char menu(void);
char command = menu(); // dosent work here
void switchn()
{
char command = menu(); // works ok here
switch ( command )
{
case 'e':
case 'A': cout << "plebs";
break;
case 'j':
case 'B': cout << "flebs";
break;
default: cout << '\a' << flush;
}
getch();
return;
}
char menu(void)
{
char a;
cin >> a;
return a;
}
|
|
|
|
|
Your first location is not in a normally executable region of your source file.
At best, it is executed once when the program starts (to assign a value to the global variable command), but not ever again.
|
|
|
|
|
In an MDI app , if the user maximizes the main frame , how should i resize the view ?
Do this idea work
CMainFrame::OnSize(...)<br />
{<br />
CMDIFrameWnd::OnSize(nType, cx, cy);<br />
<br />
CView *vw = this->GetActiveView();<br />
if(vw){<br />
<br />
}<br />
}
|
|
|
|
|
Check out MoveWindow().
Kuphryn
|
|
|
|
|
I'm trying to create a button on a property sheet (not a property page). Here's what I have for creating the button:
SetWindowPos( &wndTopMost, 200, 100, 700, 500, SWP_SHOWWINDOW );//This is the property sheet window
pWnd = GetParent();
m_btnRead.Create("Button Text Here", WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON, CRect(10, 50, 690, 490), pWnd, 1);
The button never shows up anywhere, no matter what coordinates I put in.
Am I using CRect incorrectly? Or am I just missing the obvious somewhere?
I do apologize for asking this, but I've never worked with property sheets before and I've always just dropped the buttons onto the dialog where I needed them (yes, I was being lazy).
Any help is appreciated.
|
|
|
|
|
If this code is IN the property sheet, you problem might be with the GetParent() call. You are getting the parent of the PropertySheet, which might very well be the desktop...
Try leaving out the GetParent() call and use this instead. (Keep in mind your child coordinate are relative to upper left corner of property sheet, and not entire screen...)
m_btnRead.Create("Button Text Here", WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON, CRect(10, 50, 690, 490), this, 1);
|
|
|
|
|
Thank you for responding. However...
Blake Miller wrote:
If this code is IN the property sheet, you problem might be with the GetParent() call.
It is indeed in the Property Sheet. I'm trying to create buttons when the Property Sheet is called (or launched).
I tried leaving out the GetParent() call, but still nothing.
The MSDN says that for creating buttons, the parameters should be:
Create( LPCTSTR lpszCaption, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );
I'm curious about something here: if I'm not calling GetParent, how exactly would I reference the parent window? "this" doesn't work and, as far as I can tell, there is no variable for it or really any way to reference it since it's a CPropertySheet class and I need a CWnd class for the 4th parameter.
Blake Miller wrote:
Keep in mind your child coordinate are relative to upper left corner of property sheet, and not entire screen...
The width and height of the Property Sheet are: 700 and 500. That's why I put the coordinates at 690 and 490. As far as I can tell, that should put it in the bottom right corner. Or am I misreading it?
|
|
|
|
|
My analysis would eventually lead to what PJ Arends is already telling you (in other messages). I think there is something not quite right in your system.
Anyway, the 'this' of a CPropertyShett will be cast to a CWnd, since the CPropertySheet is derived from a CWnd. That is why I asked if your code was part of a CPropertySheet member function.
|
|
|
|