|
I would expect undefined behaviour if you have a Unicode build.
The lfFaceName member is of type TCHAR[LF_FACESIZE] (see LOGFONT structure (Windows)[^]). So it must be
_tcscpy(lf.lfFaceName, _T("Arial"));
|
|
|
|
|
I have for "Character set" a value of "NOT SET" in that case I don't think I need the _T macro
I have re-built a test application just display this dialog box as every test took me a long time
to set up each test
I going to try lf.Height either 0 or neg and see if it formats it better
thanks for all your help
|
|
|
|
|
There is another error in your code. You have to initialise all members of your LOGFONT structure; usually by clearing them all before setting specific members:
memset(&lf, 0, sizeof(lf));
|
|
|
|
|
thanks
lfHeight
Value
Meaning
> 0 The font mapper transforms this value into device units and matches it against the cell height of the available fonts.
0 The font mapper uses a default height value when it searches for a match.
< 0 The font mapper transforms this value into device units and matches its absolute value against the character height of the available fonts.
Not quite sure what the above means but my question is the units sepcfied on the Crect parm of CStatic:Create the same as the units for lfHeight and lfWidth so if the width of my static control
is 20 and I specify 3 for lfWidth and I have 5 characters the would = 15 units
Thanks
|
|
|
|
|
I'm writing a quick options dialog app, but am a little rusty with my MFC. In short, I have a list box to the left and a property sheet containing pages corresponding to the items in the list box. However, I want to hide the tab control of the property sheet and move the pages up to match the top of the list box.
Hiding the tab control is easy: CPropertySheet::GetTabControl()->ShowWindow(FALSE)
I then went down the path of grabbing the rects of things and subtracting, but I can't help but think I'm making this more complicated than it needs to be. (I did this once back in 2005, but don't have that code and can't remember what I did.)
|
|
|
|
|
The MSDN article has apparently been removed, but someone here has posted most of the code from it.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
|
Ah, that's what I needed. Thank you very much.
|
|
|
|
|
You are welcome!
|
|
|
|
|
I have pointer to myderived CStatic object call mylabel
Since Everything is derived from CObject
I thought I could code the following
dc << "Dumping my object << mylabel;
dc is a type CDumpContext and I have afxTracEnabled = TRUE and yet I don't see the contents
of mylabel in the output window
|
|
|
|
|
Can other objects be dumped? What is the value of _DEBUG ? Does the following do anything different:
mylabel->Dump(afxDump);
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I get text for example m_hWnd = f:\vstools the directory in VS which has some of the MFC source code like wincore.cpp Is there any tool which would dump all the contents of an object
for example m_hWnd = 0X0000456;
I am sure you or the other developer must of done this would have you maybe have an example you can point me to
thanks
|
|
|
|
|
As you know I only play with MFC limited but the windows api GetWindowText will return the text from a static window to a buffer.
It will be in unicode or ansi depending on app and you deal with it as required.
In vino veritas
|
|
|
|
|
this is verry interesting :
Quote: https://quantumexperience.ng.bluemix.net/qx/experience
i tryed to get it in c++
its a start
i been programming clasical computers for +-30 year's
i not even shure i wil understad this [ if ever ]
#include <iostream>
#include <string>
#include <math.h>
void rot( double & k , double & l , double r)
{
double s , c , hk , hl ;
s = sin( r ) ;
c = cos( r ) ;
hk = k * c - l * s ;
hl = k * s + l * c ;
k = hk ;
l = hl ;
}
const double PI = atn( 1.0 ) * 4.0 ;
class Qbit
{
public :
double x , y , z ;
Qbit()
{
x = 0.0 ;
y = 0.0 ;
z = 1.0 ;
}
Qbit( double a , double b , double c )
{
x = a ;
y = b ;
z = c ;
}
void X()
{
rot( y , z , PI ) ;
}
void Y()
{
rot( x , z , PI ) ;
}
void Z()
{
rot( x , y , PI ) ;
}
void H()
{
;
}
void S()
{
rot( x , y , PI / 2 ) ;
}
void S1()
{
rot( x , y , -PI / 2 ) ;
}
void T()
{
rot( x , y , PI / 4 ) ;
}
void T1()
{
rot( x , y , -PI / 4 ) ;
}
double get_state()
{
return z < 0.0 ? 1.0 : 0.0 ;
}
} ;
void cnot( Qbit & control , Qbit & target )
{
if ( control.get_state() == 1.0 )
target.z = 1.0 - target.z ;
}
using namespace std ;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
|
|
|
|
|
Well it is a bunch of strange and unused stuff and then the classical C++ greeting to the world.
|
|
|
|
|
Okay, and?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
this is what i understand of
does it look right / match what the site gives ?
if error's : where / what else
i have NO experiance whit a QC
how to use my c++ stuf whit a example from the ibm site ?
|
|
|
|
|
Message Closed
modified 7-Nov-17 6:30am.
|
|
|
|
|
I have:
unsigned foo = ~0;
and the debugger shows:
foo = 0xffffffff
So, in answer to your question, "no, I haven't".
|
|
|
|
|
You beat me on that.
|
|
|
|
|
Looks like MM posted that while drunk.
|
|
|
|
|
(in order to reproduce his test)
|
|
|
|
|
I try to find out what the best strategy is to create a MFC based application that is dpi-aware. Windows is based on 96 dpi for years. Today there are pc's like the Microsoft Surface that have lot more dots per inch.
In windows you can set the screen scaling factor to 100%, 125%, 150%, etc.
If you build the application with a manifest that set DPI Awareness with High DPI Aware, then the resource templates like dialogs scale automatically. Only the custom drawings must be scaled with extra code
like:
int DpiScale(int val)
{
const HDC hDC = ::GetDC(NULL);
const UINT dpix = ::GetDeviceCaps(hDC, LOGPIXELSX);
::ReleaseDC(NULL, hDC);
return ::MulDiv(val, dpix, 96);
}
int DpiPerc()
{
return DpiScale(100);
}
DpiScale you can for coordinates or font points. DpiPerc you can use to select the a icon or picturewith the right resolution from resource.
My question is, must I develop the application for 1024 x 768?
|
|
|
|
|
Theo Buys wrote: must I develop the application for 1024 x 768? No, your application should work on any screen if it allows Window to scale it correctly. If the screen size is important then you can get the current values from GetSystemMetrics function (Windows)[^].
|
|
|
|
|
Yes I can use GetSytemMetrics for the custom drawings. But not the dialogs templates in resource which are sized by the system.
|
|
|
|