|
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.
|
|
|
|
|
I only want to do a SetWindowText if the value has been changed, for example when a selection changed from the employee list. How can this be handled in the dialog class? May be OnNotify and OnChildNotify can take care? But I never used OnChildNotify in my code.
Elizabeth
|
|
|
|
|
At whatever point a new employee is selected from the list, call SetWindowText() there.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
You could handle ON_LBN_SELCHANGE:
ON_LBN_SELCHANGE The selection in the list box is about to change. This notification is not sent if the selection is changed by the CListBox::SetCurSel member function. This notification applies only to a list box that has the LBS_NOTIFY style. The LBN_SELCHANGE notification message is sent for a multiple-selection list box whenever the user presses an arrow key, even if the selection does not change
|
|
|
|
|
Since the list is a child window in a tab control. How can the dialog class which has the tab control get notified from LBN_SELCHANGE event? Here is what we are talking about: the list is a child of the tab control; the tab control is a child of the dialog class.
Elizabeth
|
|
|
|
|
ElizabethC wrote:
Here is what we are talking about: the list is a child of the tab control; the tab control is a child of the dialog class.
Yes. I thought that a tab control was derived from CWnd. If it is, you can handle the listbox event.
You'll just need to manually edit your message map for the tab control's class. Then you can send a message to the tab's parent.
|
|
|
|
|
I got it working. I call SendMessage function from the child all the way up to the dialog class. I also added a ON_COMMAND in each parent class to handle the messages. Thanks.
Elizabeth
|
|
|
|
|
if i upgrade my c++ projects from vc6 to visual studio.net, do i need to install .net framework on all the computers that will run my compiled executables?
thanks
|
|
|
|
|
Only if you turn on the /CLR compiler switch which generates managed rather than unmanaged code. Visual Studio .NET can still generate native windows executables (only using C++) that do not use the .NET framework.
Dave
http://www.cloudsofheaven.org
|
|
|
|