|
What do you mean "right?" Data is the same through a socket no matter where it originated.
Kuphryn
|
|
|
|
|
I am talking about such things like "htoln" and "ntohl" and it's usage
|
|
|
|
|
Hello,
let's say we gave window A and in that window I process a WM_TIMER message.
The timer message arises from another window (SendMessage(WM_TIMER...)) each 10 ms...
I want to know if it is possible to destroy the window while the WM_TIMER handler is being processed.
PS:
I'm searching for a memory leak:
during the WM_TIMER message I allocate and deallocate some memory, and in one hand if I enter and exit the window continuously, the memory gets leaked. In the other hand if I do it slowly the memory gets freed as it should be...
Thank you in advance
|
|
|
|
|
One problem here is that you are misusing the WM_TIMER message. It would be better to have the second window to send a user-defined message (based on WM_USER or WM_APP ).
Secondly, since you are using SendMessage , the second Window is blocked until the first Window processes the message. WM_TIMER messages receive special handling by Windows. Essentially, WM_TIMER messages are only processed by a window when it has no other messages in its queue. They are the least priority messages of all. Without seeing your code, this may be the source of your problem, in that the WM_TIMER handler isn't being called as many times are you are issuing it.
Software Zen: delete this;
|
|
|
|
|
Hello,
Gary R. Wheeler wrote:
this may be the source of your problem, in that the WM_TIMER handler isn't being called as many times are you are issuing it
Could you explain it again? sorry, but I do not understand this very well:
You are telling me that the sending of the message is what occupies memory?
I like the fact of the WM_TIMER message has the least priority, because I'm using it in order to refresh some values:
NOTE:
I have an external programming language that allows me to read from sensors and to send signals to actuators (moving machines), and I need to get info. from that program, as it don't have callback functions that would allow me to do that I use timer events, and each 10ms I spread the WM_TIMER message from my main window to all their visible childs. Once the WM_TIMER message is received I process those variables.
I have tried to place a for( ;; ) before the portions of code that could generate memory leaks, but I've seen using the task administrator and other tools from Microsoft and I've noticed that the memory remains OK.
The fact is that if I enter the dialog (the one that seems to leak memory) and wait a little bit, and then I exit it seems that the memory is not being occupied, but in the other hand, if I enter and exit the same dialog fast and continuously then the memory seems to be leaked...
I'm very stuck by now, and this is part of a project that is already working, but after some hours the PC gets down, I need to solve this, could you try to find out something using the info I've given to you?
Thank you in advance.
|
|
|
|
|
Hello, I'm posting this here in order to avoid you working for nothing:
I'm sure that the problem is not in my timer (I've deleted it) and the problem is still here (moreover this method of working has been used by me for a long time 3 years at least and this has never happened...).
I've noticed that some DLL's related to the internet explorer, fails and generate an exception the first time that the dialog is shown, I'll post another question in the forum in order to try to get help, but after all, thank you for your reply.
|
|
|
|
|
hit an exit(0)
it does wonders !
//be cool
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
Hi there,
When i was using VC++ 6 i was using Depends 2.x for looking for dlls and other external files that my project uses. Now i had to transfer my projects to VS.NET and i couldn't find Depends 2.x in the package series so if anybody knows how can i look the dlls that my releases are using plz reply to this post... Thanx...
|
|
|
|
|
It is in:
...\Microsoft Visual Studio .NET\Common7\Tools\Bin
but I think you may have had to specify that you wanted the tools installed as part of your studio installation.
If you don't have it maybe someone knows where you can download it from Microsoft. It is a great little tool.
Art
|
|
|
|
|
I have it... Thanx for your help...
|
|
|
|
|
|
This may be elementary to most of you gurus. I have an ATL COM DLL which I instantiate from ASP (using Server.CreateObject). If I want to debug it, what should I do ? I tried follwing: Project->Settings->Debug->Executable for debug session = IEXPLORE.EXE - I am able to put the break points but it would not stop on the break points. If I use a small app written in VB for the same purpose, I am able to debug.
Please help,
Thanks
|
|
|
|
|
Hi..
I think you should choose InetInfo not IEXPLORE .. its the IIS which processes asp not the browser...
|
|
|
|
|
Can you please tell me how to do that ? I tried attaching the inetinfo process but the breakpoint would still not stop execution of the program. Thanks.
|
|
|
|
|
Right Idea, wrong executable:
If you are using iis4 try inetinfo, else for Com+ attach to DLLHOST.EXE.
Brian
|
|
|
|
|
As testing for a real MFC application I made a trivial one, but ran in to problems. To my mind this exemplifies the difficulties faced by the newbie to MFC and doc/view.
I wanted a single-window MFC doc/view app with a static control on the window.
I used AppWizard to make an MFC EXE. It ran and showed an empty window.
I put my static control in the view .h file
private:
CStatic Statcontrol;
Now I made my ..Create() in the view .cpp file
RECT rect = {100,100,200,200};
Statcontrol.Create("hello",WS_CHILD | WS_VISIBLE | SS_CENTER,rect,this,ID_STAT);
But where do I put this code? In the view constructor it fails. In PreCreateWindow() it fails. All I get is a FALSE return - not much diagnostics. (But I guess 'this' is wrong). In the OnDraw() handler it works! But then it's called multiple times.
Help! Why is something so simple so difficult? MFC books never help with things like this.
Andrew
MisterTransistor - germanium is King
|
|
|
|
|
Try putting it in your view class OnInitialUpdate function leave
CStatic Statcontrol in the header...should work
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Gary,
thanks - that has indeed fixed it.
You don't by chance know a good book/article that explains the principles of MFC programming rather than just showing which menus to click?
cheers
Andrew
|
|
|
|
|
I am kind of partial to "Inside Visual C++" by Kruglinski.
I have found that the best way to learn MFC is by doing. I have never learned much from reproducing book examples. I came from a C, Basic, FORTRAN, assembly language background. I learned the most by taking one of my old programs and making a MFC application out of it. I already knew how the meat of the program worked, so I could just concentrate on the GUI interface. I would use the programming books I bought (I own quite a few) and use the coding examples that applied to the program I was writting.
It may not be the best way to learn MFC, but it worked for me.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
There is no such thing as a "trival MFC" app.
That's why it is EOL;P
|
|
|
|
|
I have an integer. For example my integer is 2147483712.
Now in hex form this is: 0x80000040
Now i need this system that works with "flags", flags as in a property that can be given to an object (what kind of object or whatever is beside the point). For example:
Property name HEX DEC
Property1 0x1 1
Property2 0x2 2
Property3 0x4 4
Property4 0x8 8
Property5 0x10 16
Property6 0x20 32
... and so on till
Property32 0x80000000 2147483648
So the object can have different properties which are put together into a single integer like this:
For example an object has properties 7 and 32 so the integer is 2147483712 as mentioned before. My question is, how do parse this, how do i get the individual properties from the integer, there must be an algorithm for this but i can't think of it.. (i never was very good at maths). So can anyone help me?
Thanks
Kuniva
--------------------------------------------
|
|
|
|
|
Hi..
the good news is that you don't need to be good at math
use bitwise and operator &
msdn explains it better than me:
The bitwise-AND operator compares each bit of its first operand to the corresponding bit of its second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.
so if you need to check the first bit (the first boolean property) use :
if(intVar & 1)
to check the second use :
if(intVar & 2)
etc..
so you compere with 1,2,4,8 etc ..
got it ?
|
|
|
|
|
You can check the flag with a logical AND like this
if(flag & Property32)
if the if statement returns true then the flag was set if it returns false (0) then the flag wasn't set.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
ok..
small correction : logical AND is &&
& is a bitwise operator
|
|
|
|
|
I'm sure this[^] can help!
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|