|
Hi friends.
How my parent window class could be notified of its child's windows movement?
a code block could be more useful.
|
|
|
|
|
I am assuming that you are using C++. Here is how I would solve the problem. When the child window is created, you should save a pointer to the class that represents the parent window. When
the child window gets the message that it has moved (WM_MOVE) it can call a function (method)
in the parent window notifying the parent.
I am not sure that I answered your question. I think I could give you a better answer if I knew
a little bit more about your application such as what tools you are using to program the GUI?
Are you using SDK, MFC, or something else? Feel free to ask a follow up question.
Bob
|
|
|
|
|
Thanks for your suggestion of course the olution above works fine.
And I am using MFC Application Programming if there is any other solution (for exapmle MFC built-in solution) It would be more better.
|
|
|
|
|
I do not know of any MFC built-in solution for this problem.
Bob
|
|
|
|
|
Hi, everyone!
I build the exe file for a program. When I start this exe to do one particular task, it takes different time to finish the task with the same settings and the same results.
How can this happen?
|
|
|
|
|
There's a lot more going on besides your program - take a look at the Taks Manager and see how many processes are running on your machine.
The processor time allotted to your program by the OS is varying due to other demands on the system. To get truly repeatable results, you'd have to eliminate every other task consuming processor cycles.
|
|
|
|
|
I think the group could give you a better answer if they knew a little more. Here are some things
I would like to know:
1) How long does the program take?
2) How much is the variation in time?
3) Is it CPU bound? Is it disk bound?
4) How are you measuring the time it takes to run?
I will also make some general comments. If the time varies by less than 10%, I would call that insignificant. Also, if the running time is very small (say under 30 seconds) it is difficult to get accurate measurements. Also, if you run the same program twice in a row, the second run will often take less time because the program is already in memory. What I am trying to say is that if you want accurate timings you need to be very carefully about what you do.
Bob
|
|
|
|
|
I build a release version exe program in MFC for image segmentation.
I start the exe.
I open an image and a child window appears, after the command for segmentation is executed, the time is recorded. Note I use the same setting in each run and stop all irrelevant programs in computer.
I do this operation several times and record time expense for each run.
here are a list of time expense:
first, 2.609s;
second,3.297s;
third, 3.469s;
fourth,3.406s---.
They vary mysteriously!
If I restart this exe, the time for the first run also changes, but the first runs always spend less time than later runs.
If I want to get stable time expense, What should I do to improve my code?
|
|
|
|
|
First, I want to be honest with you, I do not know what is going one. Therefore, what
I am going to suggest is probably wrong. One possibility is that your code makes heavy
use of dynamic memory allocation and that the heap is not in the best of shape. Therefore, later runs take more time.
Another possibility is that the times you are seeing are not quite right. That is, they are only accurate with a second. I am also wondering if it could be machine specific. Does it exhibit this behavior on more than one machine?
By the way, if it was my program, I would not worry about this variation in time. I hope this helps.
Bob
|
|
|
|
|
|
|
|
May i know why only constant static integral types are allowed to be initialised inside struct....
struct A
{
static int x=0;
};
the above code throws error...
but
struct A
{
const static int x=0;
};
works fine...
Please explain...
|
|
|
|
|
|
hi,everyone recent i was study how to use ffmpeg to make a media player,but now i miss a question that how to show a bitmap on dc.
CRect rt;
GetClientRect(&rt);
CClientDC dc(this);
CDC mem;
mem.CreateCompatibleDC(&dc);
CBitmap bp;
bp.CreateBitmap(width,height,1,24,lpbits);
mem.SelectObject(&bp);
dc.StretchBlt(0,0,rt.Width(),rt.Height(),&mem,0,0,width,height,SRCCOPY);
but the code not work
lpbits is pointer to the data of bitmap,"height" is the height of bitmap "width" is the width of bitmap
and the size of one pixel's color is three byte
lpbits height width 24 is the all data we know about this bitmap
can you help me to show the data on DC
|
|
|
|
|
may be lpbits has a bad data.
Try to write it to a file on disk(with .bmp), then open it with Paint, see if it can load it or not.
Hope this can help you
www.logicsims.ir
|
|
|
|
|
thanks,but when i try to write it to a bitmap file i find it is normal,some friends told me this bitmap is not a compatible bitmap .
|
|
|
|
|
try it with CImage class.
IStream* pImageStream;
CreateStreamOnHGlobal(NULL, TRUE, &pImageStream);
...
CImage image;
image.Load(pImageStream);
...
www.logicsims.ir
|
|
|
|
|
oh,i am sorry ,i was work on visual C++ 6.0 and is not have CImage calss
and never used gdi+ before, so can you give me some code
|
|
|
|
|
|
I advise you to use gdal library which is a powerful tool supporting almost all kinds of image formats! You at most spend 2 hour to get acquainted with this library! good luck!
|
|
|
|
|
Okay so long story short I'm doing some string manipulation in order to determine the file format the user would like to save an image as in DirectX. Simple enough.
bool saveToFile(const std::tstring &path)
{
size_t pos = path.find_last_of(_T('.'));
std::tstring extension = path.substr(pos + 1);
D3DXIMAGE_FILEFORMAT fmt;
if(extension == _T("bmp"))
{
fmt = D3DXIFF_BMP;
}
else if(extension == _T("png"))
{
fmt = D3DXIFF_PNG;
}
else if(extension == _T("tga"))
{
fmt = D3DXIFF_TGA;
}
else
{
return false;
}
return true;
}
Problem is, upon debugging this code (scratching my head at why no image is being saved!) I come to the realisation that the test for the extension being "bmp" falls through every time. I've checked the contents of extension and sure enough, it's "bmp" - so why is the test falling through?
I'm fairly certain it's got something to do with std::tstring, which is simply defined like so:
namespace std
{
typedef basic_string< TCHAR > tstring;
}
Any ideas?
|
|
|
|
|
The default comparison of a string class is case sensitive.
You will need to write a traits class for case insensitive comparison.
You might as well use _tcsicmp to do the case insensitive comparison.
And you should be using _splitpath_s to get to the file extension.
|
|
|
|
|
I don't need case-insensitive comparison - the contents of extension is literally the lower case string "bmp" - furthermore, shouldn't the default char_traits be fine? TCHAR is either defined as char or wchar_t , and std::string implements a char_traits specialisation for both of these.
|
|
|
|
|
Hi,
I want to display vertical text.
pDC->DrawText("SV",svRect,DT_TOP|DT_LEFT);
Here i want to display "SV" vertically.
Not Like
S
V
It should display as it as but vertically..We have to turn our head to read the text.
Pls help me
Anu
|
|
|
|