|
Hello
I would like to auto run my Floopy Disk which insert in Drive.
How can Trick the win98se/Win2k/winXP?
Please anybody Help me??
I'm Beginner of MFC and Visual C++.
|
|
|
|
|
|
not only beginner to MFC and vc++...
no support for this, because the system does not even know if a floppy is inserted without checking the drive... and this would case the drive to produce the good old "no floppy inserted" sound!
Don't try it, just do it!
|
|
|
|
|
I am trying to use SetWindowPlacement to
display the dailog at the recorded size and position.
The problem is when the dialog appears some part of title
bar( dialog ) missing and whole dialog is not displayed
But if i try to resize the dailog whole dialog appears
Does anyone have solution to this?
Thanks
Shin
|
|
|
|
|
See this article
Start Here[^]
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Hi
How to convert the Char[1] to UINT?
Thanks
|
|
|
|
|
When you define a variable as char[1] rather than just char:
char CharArray[1];
rather than
char SingleChar;
you have changed a lot!
Even though the array you defined has only 1 element (making it the same as a single char memory usage-wise), it is referenced the same way as if you had defined it as char[1000] - ie as the memory address of its first (zero-eth) element.
Since the value of CharArray is a memory address (in other words CharArray is a pointer), it is not compatible for direct assignment to an UINT.
So, to convert a char[1] to an UINT you need to specify which element of the array you are talking about. In the case of an array of chars with 1 element, the only valid reference is the zeroeth element - CharArray[0].
Whenever you assign a variable that has a data type that is different from the one you are assigning it to, you need to cast it. "Cast" just means that you are basically telling the compiler "Thanks for the warnings, but I know what I'm doing. I know they were defined as different types, but I really want to do this, so butt out!". Casting will only work if the 2 data types are compatible. Since an UINT is large enough to hold the largest possible char and both data types are non-abstract, the types are compatible and your casting will succeed:
<br />
char CharArray[1];
char SingleChar;<br />
UINT x;<br />
<br />
CharArray[0] = 'A'; <br />
SingleChar = 'A'; <br />
<br />
x = (UINT)SingleChar; <br />
<br />
x = (UINT)C[0]; <br />
|
|
|
|
|
Thanks for your reply.
<code>
CString aStr = "中文";//a Chinese CString
char cChinese[3];
cChinese[2] = '\0';
int i = 0;
while (i<aStr.GetLength())
{
if ((byte)aStr[i] >= 0xA1 && (byte)aStr[i] <=0xFE)
{
cChinese[0] = aStr[i];
cChinese[1] = aStr[i+1];
UINT aWord = cChinese // is it possible to assign the arrary to UINT
++i;
}
++i;
}
</code>
|
|
|
|
|
wow9999 wrote:
char cChinese[3];
UINT aWord = cChinese;
Here, you are trying to put the address of your chinese character into the UINT variable.
You could force the compiler to do that, but it probably makes no sense here.
What are you trying to achive here? Assign one chinese letter to the UINT?
Then you need to write something like UINT aWord = cChinese[i];
That means you need to say which letter you want to assign.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
wow9999 wrote:
UINT aWord = cChinese // is it possible to assign the arrary to UINT
Yes (at least under VC++ 6.0).
You would need to write it as so:
UINT aWord = (UINT)cChinese;
This is what I said in my previous post. You need to cast it.
But the real question is why? When you assign the value of cChinese to an UINT you are not assigning the value of any char in cChinese - you are only copying the address of the zeroeth element.
If you are trying to look at or manipulate the character codes for the Chinese character set, then you need to assign cChinese[0] to aWord and not cChinese.
|
|
|
|
|
Hi:
Anyone know how to convert a string of data that can be converted into a Bitmap using Visual C++ embedded under Window CE 3.0??
Thanx
|
|
|
|
|
#include <iostream><br />
using namespace std;<br />
<br />
char matrix [3] [3];
<br />
char check();<br />
void init_matrix();<br />
void get_player_move();<br />
void get_computer_move();<br />
void disp_matrix();<br />
<br />
int main()<br />
{<br />
char done = ' ';<br />
<br />
init_matrix();<br />
<br />
do{<br />
disp_matrix();<br />
get_player_move();<br />
done = check();
if(done != ' ') break;
get_computer_move();<br />
done = check();
system("cls");<br />
} while(done == ' ');<br />
<br />
disp_matrix();
<br />
if(done=='X') <br />
cout << "You won!\n";<br />
if(done=='O')<br />
cout << "I won!\n";<br />
<br />
cout << "Programmed by:\n Tom Dziedzic \n";<br />
<br />
return 0;<br />
}<br />
<br />
void init_matrix()<br />
{<br />
int i, j;<br />
<br />
for(i=0; i<3; i++)<br />
for(j=0; j<3; j++) matrix[i][j] = ' ';<br />
}<br />
<br />
void get_player_move()<br />
{<br />
int x, y;<br />
<br />
cout << "Enter X,Y coordinates for your move: ";<br />
cin >> x;<br />
cin >> y;<br />
<br />
x--; y--;<br />
<br />
if(matrix[x][y]!= ' '){<br />
cout << "Invalid move, try again.\n";<br />
get_player_move();<br />
}<br />
else matrix[x][y] = 'X';<br />
}<br />
<br />
void get_computer_move()<br />
{<br />
if(matrix[1][1] == ' ')<br />
{<br />
matrix[1][1] = 'O';<br />
goto e;<br />
}<br />
if(matrix[0][0] == ' ' && matrix[1][1] == ' ' && matrix[2][2] == ' ')<br />
{<br />
matrix[2][2] = 'O';<br />
goto e;<br />
}<br />
e: ;<br />
}<br />
<br />
void disp_matrix()<br />
{<br />
int t;<br />
<br />
for(t=0; t<3; t++) {<br />
cout << matrix[t][0] << " | " << matrix[t][1] << " | " << matrix[t][2];<br />
if(t != 2) <br />
cout << "\n---|---|---\n";<br />
}<br />
cout << "\n";<br />
}<br />
<br />
char check()<br />
{<br />
int i;<br />
<br />
for(i=0; i<3; i++) <br />
if(matrix[i][0]==matrix[i][1] && matrix[i][0]==matrix[i][2]) <br />
return matrix[i][0];<br />
<br />
for(i=0; i<3; i++) <br />
if(matrix[0][i]==matrix[1][i] && matrix[0][i]==matrix[2][i]) <br />
return matrix[0][i];<br />
<br />
if(matrix[0][0]==matrix[1][1] && matrix[1][1]==matrix[2][2])<br />
return matrix[0][0];<br />
<br />
if(matrix[0][2]==matrix[1][1] && matrix[1][1]==matrix[2][0])<br />
return matrix[0][2];<br />
<br />
return ' ';<br />
}
this is what i have so far... though I'm trying to make the computer first search if the user will win in the next move and then block it if it can, and then if it doesn't then find a row it can fill. Please I need help, comments, suggestion, articles, please anything at all which would make the computer react like a human would...
P.S. TAKE YOUR TIME, don't rush
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Is it September already?
Here is a pointer that ight work:
Any of the numbers shown on the outside of the grid are "winning" moves
1 | 2 | 4 = 7
------------------
8 | 16 | 32 = 56
------------------
64 | 128 | 256 = 448
/ =============== \
84 73 146 292 273
The numbers below show all of the possible conditions for a player that can win on the next turn:
R1: ( 3, 5, 6)
R2: ( 24, 40, 48)
R3: (192, 320, 384)
C1: ( 9, 65, 72)
C2: ( 18, 130, 144)
C3: ( 36, 260, 288)
D1: ( 17, 257, 272)
D2: ( 20, 68, 80)
|
|
|
|
|
I'm sry I'm not that advanced with understanding it, can you further explain your reasoning, I would appreciate it, THANKYOU
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Anyone here was successfull at adding XP themes to it's DLLs? If so, how? I added the manifest and called InitCommonControls but it doesn't work.
Is there anything particular to add in the manifest since it's a dll or where do I need to call InitCommonControls (which function?)
It's for a Outlook add-in by the way...
thanks!
---------------
Tired of Spam? InboxShield 2.0.2 for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|
|
i don't really understand you question...
what e.g. does adding
LukeV wrote:
XP themes to it's DLLs
mean? what is "it's"?
Don't try it, just do it!
|
|
|
|
|
I have opened a JPG file just to read the header and determine if it is in fact a JPG, but I also want the width and height in pixel of the image. I this easy to acheive? Or does it involve decompressing the stream or something?
There doesn't appear to be 2 fields in the header which hold this information that really sux....
I just need a quick yes or no...please don't refer me to any image lib's or classes here on CP...I only need to know if getting the width and height of a JPG in pixel is almost as easy as retreiving the sig???
Thanks
I'm drinking triples, seeing double and acting single
|
|
|
|
|
There is no height or width in the file - as there is no header. JPEG is a compression specification that has grown into a file format. You can extract the width from the first scanline.
|
|
|
|
|
i was afraid of that
I'm drinking triples, seeing double and acting single
|
|
|
|
|
After moving to the .NET studio I'm experencing problems running my app. When I run it I get an error:
Runtime Check Failure #2 Stack around the variable 'sDataParse' was corrupt.
Can someone explain this error to me please. The variable pertains to a section of code that I copied from the MSDN concerning the API strtok.
I'm passing a LPSTR to this function that has that snippet of code in it. Do I need to delete this LPSTR before I exit my function?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
No IDE is perfect. Visual C++ .NET 2003 has its flaws.
Kuphryn
|
|
|
|
|
okay...this doesn't really help.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
The message is a diagnostic telling you that there is a buffer overrun or a problem with an out-of-range index into a buffer. If you're doing strcpy or sprintf it might be that the buffer 'sDataParse' is too small. Are you also passing a string length, assuming that you're passing the LPSTR as a destination of some kind?
Steve S
|
|
|
|
|
that's not a problem of .NET studio, it's one of your software!
this error is caused by a call(in debug mode) at the end of a function, which checks if the stack layout has been modified!
Don't try it, just do it!
|
|
|
|
|
Hi again:
Another problem, I am able to maximize the main window and the tabctrl that is on it, but what it is inside the tabcontrol doesn't change the size. Any idea?
Thanks
|
|
|
|