|
This is explictly banned in the standard: local classes cannot be used as template arguments (so this time it is not VC++ the one to blame).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Ahh, OK thanks - good to know.
But now I can't make fun of VC6 for this anymore. Damn...
¡El diablo está en mis pantalones! ¡Mire, mire!
|
|
|
|
|
All members of Bar are private. Could this be the problem?
|
|
|
|
|
I am trying to print contents (as part of Print Preview ) of a TreeCtrl in my MDI application which has a CTreeCtrl member in the CFormView . I might need to print many pages(printer context). After I exceed 1 page height while printing, how do I force printing on the next page ? Also when I scroll pages all contents are lost ? why ?
What should I be doing to prevent this ?
I am basically implementing writing to the device context in my CView's OnPrint method !
Please help
|
|
|
|
|
Use CDC::EndPage() and CDC::StartPage() to the end the current page and start a new one.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Where should i be specifying these ? i tried putting StartPage in OnPrint before the function call to populate the preview and EndPage after this function ends !
|
|
|
|
|
|
I am able to print all pages of Print Preview , but I need to reset my point of printing whenever the user clicks on the Print Preview toolbars . How can I trap these events such as next page, zoom in and zoom out .
|
|
|
|
|
You don't. The CPrintInfo object passed to you should contain the page # Windows wants you to print.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello...
I'm developing under win. XP Pro, but my programs must run under win. 2k Pro, the fact is that I'm trying to resize a property sheet and under XP I've done it, I don't understand why under 2k I get the resized window not shown properly... (it gets displaced to the upper left corner...)
the code that I use is very simple:
<br />
rectPS.left = 0;<br />
rectPS.right = ::GetSystemMetrics(SM_CXSCREEN);<br />
rectPS.top = 0;<br />
rectPS.bottom = ::GetSystemMetrics(SM_CYSCREEN);<br />
<br />
this->SetWindowPos(NULL, rectPS.left, rectPS.top, rectPS.Width(), rectPS.Height(), SWP_NOZORDER | SWP_NOACTIVATE);<br />
could you explain me what is happening?
Thank you in advance
|
|
|
|
|
You are telling it to make the window as big as the screen positioned at the top/left. Why it isn't doing this on XP is the mystery. What did you expect this code to resize the window to?
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Does either system have multiple monitors (or at least multiple video cards installed and active)?
Also, if you are trying to "maximize" the Property Sheet, you should not use the values returned by SM_CXSCREEN and SM_CYSCREEN , you should use the rectangle returned by SystemParametersInfo( SPI_GETWORKAREA ) so that you do not cover things like a non-hiding taskbar, or any other desktop bars (a surprisingly common error).
Peace!
-=- James (Sonork:100.21837)
"There is nothing worse than being oblivious to the fact that you do not know what you are doing."
[Get Check Favorites 1.5 Now!]
|
|
|
|
|
yes, my system has a matrox g550 with two monitors, and I want to hide the taskbar and all the other stuff... (but in the other hand I'm testing my app in my laptop (that has only one monitor ) and that is running under Win 2k Pro.)
I've been using that way to resize windows since I need to hide those system resources... and it has worked properly for me...
What I can't understand is that when I use the same code under XP Pro. the property sheet is being resized OK; but under 2k it's also being resized OK, but is not positioned where it should be, it is positioned more to the left and to the upper corner than it should be (an undesired offset/displacement of the position)...
I've noticed that if I resize the taskbar the problem changes (then in one hand if I make the taskbar higher the window will appear more displaced, and in the other hand, if I make the taskbar lower, the window is showed more properly...)
Could you explain this to me?
Thank you in advance.
|
|
|
|
|
Joan Murt wrote:
[...] Could you explain this to me?
Not without running a test, which I cannot do right now, sorry. I have to complete a build by this weekend.
Peace!
-=- James (Sonork:100.21837)
"There is nothing worse than being oblivious to the fact that you do not know what you are doing."
[Get Check Favorites 1.5 Now!]
|
|
|
|
|
Hi! I hope someone can help me on this. Is there a way to extract each byte from an integer variable in C++ (4 bytes) ?
thanks, peter.
|
|
|
|
|
There are lots of ways to do this:
<br />
<br />
union ByteToInt<br />
{<br />
unsigned int i;<br />
struct bytes<br />
{<br />
unsigned char a;<br />
unsigned char b;<br />
unsigned char c;<br />
unsigned char d;<br />
} bytes;<br />
};<br />
<br />
<br />
ByteToInt b2i;<br />
<br />
b2i.i = 0xFF00FF00;<br />
cout << b2i.bytes.a << endl;<br />
<br />
- not syntaxchecked or even compileable but I hope you get the picture.
Another method:
<br />
unsigned int i = 0xFF00FFcc;<br />
<br />
unsigned char b1 = static_cast< unsigned char >( i );<br />
unsigned char b2 = static_cast< unsigned char >( i >> 8 );<br />
unsigned char b3 = static_cast< unsigned char >( i >> 16 );<br />
unsigned char b4 = static_cast< unsigned char >( i >> 24 );<br />
<br />
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Basically strip off the other bytes with a mask, then shift the value to fit into a BYTE.
int value;
BYTE b1 = (value & 0x000000FF);
BYTE b2 = (value & 0x0000FF00) >> 8;
BYTE b3 = (value & 0x00FF0000) >> 16;
BYTE b4 = (value & 0xFF000000) >> 24;
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!
|
|
|
|
|
Here is yet another method :
int tempint = 42;
char intbytes[sizeof(int)];
memcpy( intbytes, &tempint, sizeof( int ) );
for( int x=0; x < sizeof( int ); x += 1 )
printf( "byte %d is %02X\n", x, intbytes[x] );
The Ten Commandments For C Programmers
|
|
|
|
|
Perhaps the standard macros HIWORD , LOWORD , HIBYTE and LOBYTE , so you do not reinvent the wheel?
Peace!
-=- James (Sonork:100.21837)
"There is nothing worse than being oblivious to the fact that you do not know what you are doing."
[Get Check Favorites 1.5 Now!]
|
|
|
|
|
Using ado record binding i can extract dbtimestamp info from sql server, however i can't seem to update the timestamp field, all other bound variables work fine with the update
help can dbtimestamp be updated? or is this read only of something
|
|
|
|
|
It is not updatable I think.Its for unique id I guess.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Yes, DBTIMESTAMP (Date/Time SQL Columns) can be updated, I am doing it in my current project (although I am using OleDB directly), as a "last modified" field for a record.
I have had some problems because the way the values are stored are a little different than you may expect. For example, the year field is a 4-digit year, not a 2- or 3(!)- digit one, and the month and day columns start at 1 , while the rest of them start at 0 .
For example, this is not the correct way to format a DBTIMESTAMP :
<br />
DBTIMESTAMP dbtsDateTime;<br />
<br />
dbtsDateTime.year = 99;
dbtsDateTime.month = 2;<br />
dbtsDateTime.day = 31;
dbtsDateTime.hour = 24;
dbtsDateTime.minute = 0;<br />
dbtsDateTime.second = 0;<br />
dbtsDateTime.fraction = 0;<br />
While this is:
<br />
DBTIMESTAMP dbtsDateTime;<br />
<br />
dbtsDateTime.year = 1999;<br />
dbtsDateTime.month = 2;<br />
dbtsDateTime.day = 28;<br />
dbtsDateTime.hour = 23;<br />
dbtsDateTime.minute = 0;<br />
dbtsDateTime.second = 0;<br />
dbtsDateTime.fraction = 0;<br />
Peace!
-=- James (Sonork:100.21837)
"There is nothing worse than being oblivious to the fact that you do not know what you are doing."
[Get Check Favorites 1.5 Now!]
|
|
|
|
|
My UI consists of CWnd inside CWnd that contains some UI, a simple UI layout, in short, some controls inside a controlbar.
I'm using the WindowFromPoint(CPoint) to find the window under the cursor. is there a way to go directly to access the controlBar ?
now, I do this :
CWnd* pWnd = WindowFromPoint( point);
pWnd = pWnd->GetOwner();
MyControlBarThing* pControlBarThing = dynamic_cast<MyControlBarThing*>( pWnd );
while ( pWnd && (pControlBarThing == NULL) )
{
pWnd = pWnd->GetOwner();
pControlBarThing = dynamic_cast<MyControlBarThing*>( pWnd );
}
is this kind of programming safe ? or should I use:
pWnd ->IsKindOf( RUNTIME_CLASS( MyControlBarThing) )
instead of the dynamic_cast ?
Thanks for any tips
Max.
|
|
|
|
|
AFAIK, dynamic_cast requires RTTI enabled in your app*. However the kind of objects you're dealing with are all MFC CObject derived ones, thus you should be fine using IsKindOf(**) only.
// Fazlul
* BTW, if you plan to use dynamic_cast, here is the right syntax:
class B { ... };<br />
class C : public B { ... };<br />
class D : public C { ... };<br />
<br />
void f(D* pd)<br />
{<br />
C* pc = dynamic_cast < C* >(pd);
B* pb = dynamic_cast< B* >(pd);
...<br />
}
|
|
|
|
|
if I have a class "Something" which is derived from a class declared with DECLARE_DYNAMIC, but not the derived one, does this still work ?
the IsKindOf with RUNTIME_CLASS works well to find the CWnd, but now, I have a CWnd, that I know is of class "Something", but I need to cast it to "Something" ?
Max.
|
|
|
|