|
i am setting timer on mouse move function like that
void CShow_ImageDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CRect rect; // Get the bounds of the control (just the client area)
GetClientRect(rect);
bool WasIn=false; // Check the mouse is inside the control
if(rect.PtInRect(point))
{
if(!WasIn)
{ // This is the OnMouseEnter area
KillTimer(1);
SetCapture();
}
else
SetWindowText("Moved Again"); // This else wouldn't normally be used.
WasIn=true;
}
else
{ //This is the OnMouseLeave area:
SetTimer(1,100,0);
ReleaseCapture();
WasIn=false;
}
//TrackMouseEvent( LPTRACKMOUSEEVENT lpEventTrack);
CDialog::OnMouseMove(nFlags, point);
}
when i stop timer then thses costom button functions properly but i have to use timer.
eg. for custom button function is that:
void CShow_ImageDlg::OnBnClickedClose(NMHDR * pNotifyStruct, LRESULT * result)
{
CPoint pt;
::GetCursorPos(&pt);
PostMessage(WM_SYSCOMMAND,SC_CLOSE,MAKEWORD(pt.x,pt.y));
}
Bankey Khandelwal
Software Engineer
|
|
|
|
|
why setimer in onmousemove and do you need settimer?
|
|
|
|
|
yes i am working on moving pictures thats why i have to use settimer
Bankey Khandelwal
Software Engineer
|
|
|
|
|
|
I think this problem isnt impossible and I suggestion you say this problem to write program
|
|
|
|
|
Hello
As i have studied, WinZip is using LZW compression algorithm to compress files. In this algorithm, during encoding phase, a table of codes in maitained and these codes are written in a file. This file is .rar file. Am i right?
Now i want to ask does WinZip stores that code table too? I think it should. Can anyone please guide me in this regard?
Thank You
We Believe in Excellence
|
|
|
|
|
Have a look at InfoZip. AFAIK, InfoZip is used both in Winzip and in java.util.zip
InfoZip is free, and available in source code.
http://www.info-zip.org/[^]
|
|
|
|
|
But Kakan!
I just wanted to ask if we have to stores that code table in the file along with encoded information or not?
By the way thanks for the link.
We Believe in Excellence
|
|
|
|
|
One of the features of LZW compression is that you don't need to store the 'dictionary' with the compressed data. It is reconstructed during the decompression process.
Software Zen: delete this;
|
|
|
|
|
Hello friends,
I need help for creating a bitmap using 'CreateBitmap' MFC function.
I have array that contain the rgbquad value of some picture. I have to convert that array to bitmap using CreateBitmap and 'SetBitmapBits'.
replay.
Rahul here
|
|
|
|
|
|
hi,thanks for reply!
i have a project in which , a .bmp file is converted into some different format and now i have to draw a bitmap fromm that pattern. Now i know only pixel positions and rgbquad values of entire bitmap.
plz reply
Rahul here
|
|
|
|
|
BYTE closeBmpBits[] =
{
0xBF,0xA0,
0x1F,0x00,
0x8E,0x20,
0xC4,0x60,
0xE0,0xE0,
0xF1,0xE0,
0xE0,0xE0,
0xC4,0x60,
0x8E,0x20,
0x1F,0x00,
0xBF,0xA0
};
CBitmap bmpClose;
bmpClose.CreateBitmap(11,11,1,1,closeBmpBits); Nibu thomas
Software Developer
|
|
|
|
|
Hi fellows,
I'm launching a program for a PocketPC (Windows Mobile 2003) that requires that every other process (other than system's) finalize.
Now, I know I can use TerminateProcess for finishing them, and OpenProcess for retrieving a HANDLE to such process (this handle will be used with TerminateProcess). The problemo is that OpenProcess requires the ID of the process, and that's unavailable for me.
My question is: is there any way of getting such process' ID? Or is there any way for terminating the processes?
Regards,
Fernando.
A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
|
|
|
|
|
What u know about the process to kill? if u know the image name, just enumerate all the process untill u find the process name required. u can take the process id of matching name
But this may create problem if more than two instance of the application is runnig.
Another way is to keep the process id in some shared memory..
nave
|
|
|
|
|
Fernando A. Gómez F. wrote: My question is: is there any way of getting such process' ID? Or is there any way for terminating the processes?
GetProcessId(HANDLE hProcess);
Nibu thomas
Software Developer
|
|
|
|
|
This API is only available on Windows XP SP1 and Windows Server 2003. Hard to see why it wasn't always there, I guess they realized that and added it for symmetry.
Steve
|
|
|
|
|
Fernando asked for the process id so that he could get the process handle by giving this id in OpenProcess method. If he know the process handle what's the need of getting process id???? he can directly call TerminateProcess
nave
|
|
|
|
|
Terminating processes is asking for grief. If you call TerminateProcess the code doesn't get a chance to cleanup after itself.
Steve
|
|
|
|
|
A friendlier approach would be to enumerate the top-level windows and send SC_CLOSE command messages to them. This gives the user a chance to save his work.
Software Zen: delete this;
|
|
|
|
|
General Problem: I am having a bit of trouble figuring out why my program's memory usage continues to grow during run-time.
Basic Information: Visual Studio 2005
Project: Game
Libraries: SDL and GLUT
Tools: Visual Leak Detector and Application Verifier
Comment:
I think I should first state that I am using the task manager to monitor memory usage (so perhaps that's my first mistake), suggestions on a different tool are welcome and wanted.
Low-Down:
I have been creating a game that involves eight or more classes (thus far) and basically is run through a series of 'scenes' which are themselves unique class objects designed for their appropriate section (exp: TITLE,GAMESETUP,OPTIONS). This error only occurs with my 'world' scene which is the main gameplay scene that must last untill the player wants to stop playing the game. Within this scene, the player can click the menu button which creates a new 'menu' class object. When this object is first created with 'new' (from the gameplay scene object), it takes up about 200k due to mostly dynamically loaded textures. When they choose to return to the game from the menu, I delete the textures and then the menu object itself. However, memory usage only drops 20k. There is a similiar problem with the only other class object created by the gameplay scene. I haven't actually added much game play content, i've just been building the engine until thus far. I assume if the class object takes 200k to create, once it's properly deleted it should return that 200k. I tried clicking the menu and returning multiple times and the usage kept rising and rising.
I have used tools to check for memory leaks and it tells me none exist in my program. I have tried the program in debug mode and release mode and it still occurs. Can anyone give me some ideas for what I should look out for, or some sort of memory leak that isn't detected by the software.
|
|
|
|
|
Are you compiling for managed code? If so, the memory usage won't go down until the garbage collector kicks in.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Well, I am using Visual Studio 2005, so yes I am. I didn't see the other c++ section till now, so my mistake. Perhaps the 20k that seems to be coming back is simply local variables being used and let go instead. Do you know what a person should do to call the garabage collection early or as needed?
-- modified at 0:10 Tuesday 14th March, 2006
I see a tutorial from codeproject, none the less
http://www.codeproject.com/managedcpp/garbage_collection.asp
I'll give it a shot and post back the findings.
-- modified at 12:06 Tuesday 14th March, 2006
After reviewing my code, it appears I wasn't using managed code at all. So this solution will not fix the problem.
|
|
|
|
|
The C/C++ heap generally shrinks only under certain conditions. 200k is perfectly acceptable. The only real concern is if it allocates an additional 200k each time.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
That is exactly the problem,
each time the player clicks the menu, the object is created, 200k is used. When they return the object is properly deleted, but the 200k is still in use.
...
(repeat as each time menu is clicked)
I am still looking into the garabage collection suggestion and it more then likely is the answer, just having trouble with that at the moment.
|
|
|
|