|
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.
|
|
|
|
|
Maximilien wrote:
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 ?
IsKindOf works on all MFC classes derived from CObject with DECLARE_DYNAMIC declared inside the class and IMPLEMENT_DYNAMIC implemented elsewhere. If the class is not derived, then IsKindOf will return FALSE.
|
|
|
|
|
I would like to iterate over an const array, call a function, and populate a struct, but how can I make this a variable to be dereferenced before it is called so it can set the right struct property?
const char *attrTypes[7] = {"one",
"two",
"three"}
typedef struct COMP_STRUCT {
char first[128];
int count;
char test[128];
} COMP_STRUCT;
int Function() {
char *buf
int i;
COMP_STRUCT * p_comp;
for (i=0;i<7;i++) {
SomeFunction((char*)attrTypes[i],buf,exists);
if (exists==TRUE) {
strcpy(p_comp-> ,buf);
}
}
|
|
|
|
|
You need to create a second pointer, set it to equal attTypes[0], then add strlen(attTypes) to it every time you copy.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I wrote an MDI application using MFC. It is an application to build proprietary (in-house format) documents using a form. This application also has a feature to taking such a document and transform it to another format understood by a third-party application.
I would like this feature to be able to run on the command line, for example:
c:> MyMIDApp /i:infilename.xxx /o:outfilename.yyy
The advantage of this is being able to automate the task of transforming the document from a script. We could really use such a feature.
Is there a simple way to do this?
tx
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
|
So if the application realizes that the parameters tell it to run from the command line, do I simply exit before the call pMainFrame->ShowWindow(m_nCmdShow); or do I return FALSE before the above line of code?
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
You can move the command line checking even before the MDIDocTemplate is created and return without creating it, if you do not want the windows. When you run the line that creates the DocTemplate, that is when the MainFrame, Doc and Views are created and linked together.
<code>
if (ProcessCommandLine())
{
m_pMainWnd = NULL;
return TRUE;
}
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_MDITYPE,
RUNTIME_CLASS(CMdiDoc),
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CMdiView));
AddDocTemplate(pDocTemplate);
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
return TRUE;
</code>
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
|
In the InitInstance of your application, you have access to the CCommandLineInfo, so derive a new class from it, and override the ParseParam method to handle the parameters on your command line.
Max.
|
|
|
|
|
What is the easiest way to update a pane in a status bar from within a view? I would really just like to access the main window's or CMainFrame m_wndStatusBar member from within my view and call the SetPaneText method as opposed to using any update command handlers. If anyone knows how I could do this I would appreciate it.
|
|
|
|