|
Thanks; however this does not help. The OnSize description states:
The framework calls this member function AFTER the window's size has changed.
I fact, this filtering in OnSize does not change the result. A call of CDialog::OnSize will be generated by the wizzard in OnSize. I admit that I don't know, what CDialog::OnSize does (this will be generated by the wizzard in OnSize), but no matter if I call it or not, the result is the same.
In the meantime I tested my own suggestion, posting a WM_SIZE message with SIZE_RESTORED. This does not work either; I'd like to know, why. The message goes through properly, it appears in OnSize as well, with the identical parameters, as a RESTORE from the minimized state generates - but restoring does not happen.
SetWindowPlacement works, but that needs more preparation: not only the size, but the position of the last non-maximized window too has to be recorded. Not a big deal, but all this is nonsense.
|
|
|
|
|
Have you tried to catch WM_WINDOWPOSCHANGING[^]?
Silence Means Death
Stand On Your Feet
Inner Fear
Your Worst Enemy
|
|
|
|
|
You must also process the CWnd::OnGetMinMaxInfo or handle WM_GETMINMAXINFO.
If that does not work, override CWnd::PreTranslateMessage and trap the sizing calls.
The memories of a man in his old age are the deeds of a man in his prime.
|
|
|
|
|
Thanks for the suggestions.
WM_WINDOWPOSCHANGING appears a good solution, but it does not say, when the window will be maximized, i.e. it would need a "calibration" to get the actual maximum size.
In the meantime I solved the problem already, with a combination of OnSize and OnMove plus SetWindowPlacement as correction of MAXIMIZE. However it is not a nice solution. Sometimes OnSize, sometimes OnMove is the first, when both will be called. Lots of work-around only to prevent the system from doing something, what it should not do per definition.
Anyway, now it's working, but I'm now trying Blake's suggestion, GetMinMaxInfo. This function gets called before each MAXIMIZE (I have expected a call at MINIMIZE at well, even though it does not matter in my case). Simply to prevent MAXIMIZE to a large size is very simple this way. However, there is still a small problem: it positions the window to the upper left corner; one has to work around it.
Once more, thanx for the help.
|
|
|
|
|
int nTemp;
nTemp=0xe;
My aim is to put a hex value to a int varalbe "nTemp".
As a result, the real value is 0 after those are executed.
Can a int varable receive a value like 0xe directly?
|
|
|
|
|
|
Now the varable can get its right value.
Maybe something is wrong with my VC6,isn't it?
Thanks!
|
|
|
|
|
Hi,
I have a source code tree (C++) traditionaly compiled in unix Makefiles. I want to create a project in VC++ so that I can view the source code easily.
Is there some easy way to create a project (dsw file) for the whole tree (>100 files C++ in >15 directories).
Thanks
John
|
|
|
|
|
Visual Studio can open .MAK files. If .MAK files are in a standard format, it shouldn't be a problem. Otherwise, if they are compiler dependent, I guess manually creating the projects will be necessary.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi,
need to know how to draw a text string in the center of client area.
regards
|
|
|
|
|
sorry, i found it
GetClientRect(hWnd, &rc);
DrawText(hdc, "Text", 4, &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
|
|
|
|
Hi,
I have a main dialog that has a tab control. For each tab, I have a child dialog. The problem is that the tab control's color isn't solid (with XP styles), so if I use COLOR_WINDOW for the child window, it will not take the gradient pattern of the tab control.
How can I manage to make this work?
Thanks!
---------------
Tired of Spam? InboxShield for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|
|
Found it!
Take a look at the EnableThemeDialogTexture() function!
---------------
Tired of Spam? InboxShield for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|
|
I copy these sample codes from MSDN:
if (!ReleaseSemaphore(
hSemaphore, // handle to semaphore
1, // increase count by one
NULL) ) // not interested in previous count
{
// Deal with the error.
}
But what can I do to Deal with the error. And what will cause ReleaseSemaphore Error?
Thank you!
Let's roll!
|
|
|
|
|
call GetLastError() to find it out!
Don't try it, just do it!
|
|
|
|
|
This is what I have to work with... I have a program of tic tac toe that is in the console, command prompt , and the board is an array and have everything finished up to the point of getting the computer move. I am trying first to make the computer do random moves and then record to a seperate file, one for each win, lose, and draw and learn from which moves were good and which weren't as good. So far I have the below: (please help)
#include <iostream>
#include <fstream>
using namespace std;
char matrix [3][3]; //Tic Tac Toe Matrix
char check();
void init_matrix();
void get_player_move();
void get_computer_move();
void disp_matrix();
void f_matrix();
fstream SaveFile("wx.txt",ios::in | ios::out | ios::trunc);
fstream SaveFile2("wo.txt",ios::in | ios::out | ios::trunc);
int main()
{
char done = ' ';
init_matrix();
do
{
disp_matrix();
get_player_move();
done = check(); //See if any winner
f_matrix();
if(done != ' ')
{
break; //Winner!!!
}
get_computer_move();
done = check(); //See if any winner again
f_matrix();
} while(done == ' ');
disp_matrix(); //Display final matrix
if(done=='X')
{
SaveFile << "winner X\n;" << endl;
cout << "You won!\n";
}
else
{
SaveFile2 << "winner O\n;" << endl;
cout << "I won!!!!\n";
}
// f_matrix(); //Write to file final matrix / result
SaveFile.close();
SaveFile2.close();
return 0;
}
//Initialize the matrix
void init_matrix()
{
int i, j;
for(i=0; i<3; i++)
for(j=0; j<3; j++) matrix[i][j] = ' ';
}
//Get the player's move
void get_player_move()
{
int x, y;
cout << "Enter X,Y coordinates for your move: ";
cin >> x;
cin >> y;
x--; y--;
if(matrix[x][y]!= ' ')
{
cout << "Invalid move, try again.\n";
get_player_move();
}
else
{
matrix[x][y] = 'X';
}
}
//Get a move from the computer
void get_computer_move()
{
int i, j;
do
{
i = rand() % 3;
j = rand() % 3;
}while(matrix[i][j] != ' ');
if(i*j==9)
{
cout << "draw\n";
system("pause");
}
else
{
matrix[i][j] = 'O';
}
}
//Display the matrix
void disp_matrix()
{
int t;
for(t=0; t<3; t++) {
cout << matrix[t][0] << " | " << matrix[t][1] << " | " << matrix[t][2];
if(t != 2)
{
cout << "\n---|---|---\n";
}
}
cout << "\n";
}
//See if any winner
char check()
{
int i;
// New checking system
// check rows
for(i=0; i<3; i++)
if(matrix[i][0]==matrix[i][1] && matrix[i][0]==matrix[i][2])
{
return matrix[i][0];
}
// check columns
for(i=0; i<3; i++)
if(matrix[0][i]==matrix[1][i] && matrix[0][i]==matrix[2][i])
{
return matrix[0][i];
}
//Test diagonals for winner
if(matrix[0][0]==matrix[1][1] && matrix[1][1]==matrix[2][2])
{
return matrix[0][0];
}
if(matrix[0][2]==matrix[1][1] && matrix[1][1]==matrix[2][0])
{
return matrix[0][2];
}
/*
// Old checking system
// Check rows
if(matrix[0][0] == matrix[0][1] && matrix[0][0] == matrix[0][2])
{
return matrix[0][0];
}
if(matrix[1][0] == matrix[1][1] && matrix[1][0] == matrix[1][2])
{
return matrix[1][0];
}
if(matrix[2][0] == matrix[2][1] && matrix[2][0] == matrix[2][2])
{
return matrix[2][0];
}
// Check columns
if(matrix[0][0] == matrix[1][0] && matrix[0][0] == matrix[2][0])
{
return matrix[0][0];
}
if(matrix[0][1] == matrix[1][1] && matrix[0][1] == matrix[2][1])
{
return matrix[0][1];
}
if(matrix[0][2] == matrix[1][2] && matrix[0][2] == matrix[2][2])
{
return matrix[0][2];
}
// Check diagonal (left to right)
if(matrix[0][0]==matrix[1][1] && matrix[1][1]==matrix[2][2])
{
return matrix[0][0];
}
// Check diagonal (right to left)
if(matrix[0][2]==matrix[1][1] && matrix[1][1]==matrix[2][0])
{
return matrix[0][2];
}
*/
return ' ';
}
void f_matrix()
{
int t;
for(t=0; t<3; t++)
{
SaveFile << matrix[t][0] << matrix[t][1] << matrix[t][2] << "\n";
}
}
<marquee>Universal Project... Soon to be a .net</marquee>
|
|
|
|
|
Tic Tac Toe is now an "ASAP!!!' problem?
Oh dear, sounds like the homework assignment is nearly due.
-Blake
|
|
|
|
|
|
Michael P Butler wrote:
Another Stupid Amateur Programmer
The kindest thing you can do for a stupid person, and for the gene pool, is to let him expire of his own dumb choices.
[Roger Wright on stupid people]
We're like private member functions
[John Theal on R&D]
We're figuring out the parent thing as we go though. Kinda like setting up Linux for the first time ya' know...
[Nitron]
|
|
|
|
|
Noo its due in a little bit more than one month but I still have to get it done early are at least do some tests on it.
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Fine just ignore it, doesn't matter anyways.
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Hey there... Quick background: I author two freeware music visualizations called G-Force and WhiteCap for a few media players out there, and I'm fixing up my win32 and direct x fullscreen code. I'm been (unsuccessfully) trying to get thru an issue for a while now, losing some major major time on it, and I'm desperate to resolve it...
Normally, my software does it's video output thing in a plain-jane hwnd. When it's told to go into fullscreen mode, I first create a new hwnd (to be the fullscreen window), call SetCoopertiveLevel() (using that new hwnd), call SetDisplayMode() (actually causing the disp device to change res, etc), and then go from there. It works great and the video out works as expected, execept that all messages to the hwnd's message handler proc suddenly stop! Indeed, I have an output log that shows that it gets no more messages (following all the typical messages from a creation and resize, etc of making a new window). So, amusingly, it enters fullscreen mode, looks great, but doesn't respond what so ever to any keystrokes, not even system ones (ctrl alt del, alt tab)... The only way out is a manual reset. :^(
Add'l info: Win98SE (chosen for compatibility reasons), Compiler: Metrowerks codewarrior 8, targeting Win32 EXE, direct x 9 on the machine (but the DX API that I use goes back to DX3).
Data point 1... If I pass the normal window as fullscreen hwnd's parent in CreateWindow(), flow stops somewhere near or right after SetCoopertiveLevel() and before SetDisplayMode(), but the same effect seems to be occurring: all messages to the process (ie, it seems to be blocked by something).
Data point 2... This whole problem doesn't occur whatsoever (passing a parent window or not) when I target to a DLL and I'm running as a plugin under Winamp 2 (ie, mysteriously, there's something present when I'm running as a DLL in winamp that avoids the problem than when I'm just running as my own EXE).
Thanks in advance for your time and effort here. If you know my software, then you know my specialty is not OS APIs, but more abstract things (my shareware targets MacOS classic, MacOS X, and win32 and runs under half a dozen media players). This is to say all help is appreciated! Thanks!
Andy
|
|
|
|
|
Hi,
I need help on trying to display Chinese characters in a CListCtrl. I have _UNICODE flag in project settings, and I'm using the unicode conventions (i.e., _T() for string literals, _tcscpy in place of strcpy(), etc.). Still no luck, I've even tried to set the font:
CFont *cFontPtr = m_CertListCntrl.GetFont();
LOGFONT lFontObj;
int success = cFontPtr->GetLogFont(&lFontObj);
lFontObj.lfCharSet = CHINESEBIG5_CHARSET;
CFont cfObj;
BOOL s = cfObj.CreateFontIndirect(&lFontObj);
m_CertListCntrl.SetFont(&cfObj, TRUE);
And still no luck. Note: I tried to test the code by hard coding chinese characters and filling in the list. Not sure if that has an effect on it.
Thanks,
Raymond
|
|
|
|
|
You need a Chinese Operation System.
|
|
|
|
|
You need to set the font name in the LOGFONT struct to one that contains the characters, like SimSun.
--Mike--
Ericahist [updated Oct 26] | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|
|