|
The reason I can think of is that 'GetClientRect' returns the area minus the non-client area. So perhaps your CButton has no non-client area while your CStatic does ?
You should be able to resize your static control with no problem.
You can do this :
<br />
CRect rc;<br />
control.GetWindowRect(rc);
ScreenToClient(rc);
<br />
rc.left = 400;<br />
<br />
control.MoveWindow/SetWindowPos(rc);<br />
|
|
|
|
|
In MSDN under DialogProc it tells you to return TRUE (1) if you process the message, but when you check out most of the messages, it tells you to return 0 (FALSE). So which one do I use?
wWw.KruncherInc.cOm - My programs
|
|
|
|
|
It's by design. Just follow the documents for every implementations you use.
For example, if you invoke a certain function defined by Maxwell:
int MaxwellCreateDialog(HWND* phSomeThing)
{
return 77;
}
Then in your code.....
HWND hWnd = NULL;
int iRetValue = MaxwellCreateDialog(&hWnd);
switch(iRetValue)
{
case 77:
AfxMessageBox("Congratulation! DialogBox is created.");
break;
default:
throw ErrorObj("Error creating a dialogbox", iRetValue);
}
Maxwell Chen
|
|
|
|
|
Hi,
The code I am writting: cout<<"Our start time is"<
|
|
|
|
|
int(floor(iDur/60)) and iDur%60 will give you what you want, won't it ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I know this isn't a question and this probably doesn't belong here but I figured what better place to put it. I'd like to say Thank you(yet again) to DavidCrow for the tremendous help he gave me when I needed it. And just have to say what a person you must be. To have the patience you have. I hope one day to be able to help others the way you've helped me thank you.
|
|
|
|
|
There are a number of very helpful people on this site, and David is definitely one of them. It's good of you to say "Thank you," as so many of us often fail to do.
Will Build Nuclear Missile For Food - No Target Too Small
|
|
|
|
|
After all he is MrNice.
MSN Messenger.
prakashnadar@msn.com
Tip of the day of visual C++ IDE.
"We use it before you do! Visual C++ was developed using Visual C++"
|
|
|
|
|
Hello,
I downloaded a source code in sourceforge.net and rebuild it to learn what it does in system!
It requires too many: Service Pack 3 for Visual C 6.0, DirectX SDK, DDK, and Processor Pack for Visual C 6.0 too.
But after passing many error in compiling, building its dependencies, I come to the last component: the main program.
In the "stdafx.h" file, it includes many header, but the important is:
<br />
#include <vector><br />
#include <string><br />
<br />
using namespace std;<br />
<br />
and VC say error when compiling the first file stdafx.cpp:
<br />
<br />
--------------------Configuration: DScaler - Win32 Release--------------------<br />
Compiling...<br />
StdAfx.cpp<br />
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\istream(557) : error C2059: syntax error : 'catch'<br />
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\istream(557) : error C2143: syntax error : missing ';' before '{'<br />
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\istream(559) : error C2712: Cannot use __try in functions that require object unwinding<br />
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\istream(578) : error C2059: syntax error : 'catch'<br />
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\istream(578) : error C2143: syntax error : missing ';' before '{'<br />
Error executing cl.exe.<br />
<br />
DScaler.exe - 5 error(s), 0 warning(s)<br />
<br />
If I comment #include <string>, I can pass this file (remember it is stdafx.cpp), but I will get many many other errors in next files.
So please help me to fix this error!
PS. I download DScaler from sourceforge.net. Thank you very much!
|
|
|
|
|
A DirectX program is clearly a fairly advanced thing to be pulling apart, especially if you don't have DX already ( i.e. are not into that sort of stuff ).
It's possible that there's a compliler setting you need to turn on for try.catch to work ( I'm going from memory here ). Otherwise, could you clarify what headers you're including ? You didn't check Do not treat <'s as HTML tags, nor did you use the buttons below to enter < for <, etc, so they got stripped as HTML.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Firstly, thank you very much for your reply, Chris! I'm very very happy when receive your reply...
This is the include code:
#include <vector>
#include <string>
using namespace std;
If I comment the sencond include code, I can pass the first compiling for stdafx.cpp, but I will get many many errors in next files.
I think that there are some wrong options in C/C++ tab of the property of project. But this project is original from its source. I've just re-compiled it only.
Please help me, Chris! Thank you very much!
|
|
|
|
|
The problme is probably due to namespace pollution. As your doing a using namespace std you may find you end up adding a lot of symbols/names which clash with some of the symbols/names in your projects. Try reducing the amount beinf incuded by using:
using std::string;
using std::vector;
Globally includint entire namespaces like this may be good in the short term, but can bite you on the a$$ later on. We had a similar problem here recently.
Roger Allen - Sonork 100.10016
Strong Sad:
Clever I am? Next to no one.
Undiscovered and soggy.
Look up. Look down. They're around.
Probably laughing. Still, bright, watery.
Listed among the top. Ten.
Nine. Late night. Early morn.
Early mourn. Now I sleep.
|
|
|
|
|
Can't resolve this problem....
|
|
|
|
|
Hi,
If I have an app with a dialog resource is there an easY way to export the dialog
from one app and import it into the other app? Or do I have to re add it and then move the code for it over to the new application.
Regards,
axe
|
|
|
|
|
Open the .rc file as text and copy and paste it over. Then make sure the resource ID's referred to in it are in the resource ID file of the new project.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I am working with Dialogbased application.I was created one Modalless Dialogbox part of the application.Now How to send the Message from Modalless Dialogbox window to MainDialog whenever modellessDialogbox closed?Pl Tell me How to implement the SendMessage function?
dadsadasd
|
|
|
|
|
Why not hold a pointer to the main dialog in the modeless dialog and then in OnClose, call a function you provide in the main dialog ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Better to store the handle to main dialog window. The SendMessage to that window handle.
greatest thing is to do wot others think you cant suhredayan@omniquad.com>
messenger :suhredayan@hotmail.com
|
|
|
|
|
Right before the modeless dialog is destroyed, call GetParent()->SendMessage(...) . You'll then need a corresponding message handler in the parent (modal) dialog.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I was implemented Like.
1.In the Parent DialogBox I declared like
#define GOODBYE WM_USER+1
ON_COMMAND(GOODBYE,OnGoodBye)
LRESULT OnGoodBye(WPARAM wparam,LPARAM)
{
//implementation
}
2.In the CHildDIalog WM_CLOSE
void OnCLose()
{
GetParent()->SendMessage(GOODBYE,0,0);
DestroyWindow();
}
I was implemented Like that. But I am getting the Result?
How ?
dadsadasd
|
|
|
|
|
asv wrote:
I was implemented Like that. But I am getting the Result?
Ok, so what seems to be the problem?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi,
I'm writing about 20kb of data into a binary file, but at some point during the file output (usually after a certain amount of objects are required to be saved to disk), some form of corruption occurs. Can anyone help with this? Here is some example code:
<br />
ofstream myFile(lpszPathName, ios::binary || ios::trunc);<br />
<br />
<br />
myFile.write((char*)(&version), sizeof(int));
myFile.write((char*)(&w0.numMeshes), sizeof(int));
myFile.write((char*)(&w0.numLights), sizeof(int));<br />
myFile.write((char*)(&p.pos.x), sizeof(float));<br />
myFile.write((char*)(&p.pos.y), sizeof(float));<br />
myFile.write((char*)(&p.pos.z), sizeof(float));<br />
<br />
for(int m = 0; m < w0.numMeshes; m++) <br />
{<br />
myFile.write((char*)(&w0.world_meshes[m]->numFaces), sizeof(int));<br />
myFile.write((char*)(&w0.world_meshes[m]->numVerts), sizeof(int));<br />
myFile.write((char*)(&w0.world_meshes[m]->numNormals), sizeof(int));<br />
etc... etc... going through all mesh faces, vertices and what not, and then finally a myFile.close().
Exactly the same happens for reading, but using file.read() instead. The read function is exactly the same as it's copied & pasted with just swapping of myFile.write to file.read, although there are a few initializations in between the reading lines which are not there during the writing lines.
It seems to be completely random, and I know this isn't possible in programming! It mostly happens when 12 objects need to be required to save to disk, although sometimes it works fine up to an infinite amount, other times, 5 or 6 objects can be written and the corruption starts.
I'm thinking along the lines of some kind of buffer error happening once it reaches a certain size? If anyone can help me on this problem I would be so greatful.
Yours desperately,
Nathan
|
|
|
|
|
From your code example, I understand that the version and other variables are of type integer , float or similar. Also, according to the writing function, the input is supposed to be a pointer to a character string.
As far as I know, a direct conversion like this is not going to work. What gets written into the file is a character representation of the number. This means, that the integer is readed, converted to it's equivalent character code, and written into the file. Now, as a character can only have 8 bits, this works until a certain number limit is reached. When this happens, an over/underrun in the bit sequence happens (INT_MAX becomes INT_MIN, for example) and the character value written into the file no longer represents the actual data.
What you should do, instead, is use an intermediate buffer, into which you convert the value (int-to-string / long-to-string). There is no float-to-string conversion, as far as I know.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thank you for your further explanation! I must have understood the concept wrong, as I imagined that sizeof(type); would have specified exactly the size in bits to be written in, and that the (char*) cast at the start was only required to write to the file.
|
|
|
|
|
I think that the conversion to char* is OK. Because integer is converted to an array of chars (with appropriate length), no information is scratched.
But for storing and loading basic data types you could use operators >> and << instead of write() and read() . It's more readable
I know, that these paragraphs probably don't solve all of your problem. So write us, what does your corruption mean? It causes an error message or the read data are different from the written data?
Robert-Antonio
"A piece of paper is an ink-lined plane.
An inclined plane is slope up.
A slow pup is a lazy dog.
Q.E.D.: A piece of paper is a lazy dog."
|
|
|
|