(Mental Block I had, not looking for 'Modems' in the first place!), as you know, that's how it goes.
However, it covers, apart from a sprinkling of C or CPP, a Lot of CE, C#, etc, which have their own libraries, etc, and hence are instructive, but not very useful. For Instance, "Phone.Lib" is not a component of MFC42.
All I need to do is the Dialling, and the Channelling of the connection to the Sound System, and hanging up, after ending the call.
I'm going to try for now something called "RasDial.exe" and see how I get on with it. Hopefully I can fool it in not looking for a Phonebook Entry, or stopping it from trying to make an Internet Connection.
I have also bought a £6.00 USB Dialup Modem which comes with a CD. Hopefully the CD contains something useful. I live in hope. Even if it fails, the cost is less than a packet of cigs, and, I still have the Modem.
Hope if all else fails to be able to hang a Head Set and Mike to the 'Phone' Output, and, hope the Modem can do the Dialling via the Line Socket.
May need to set to Pulse, and a switch to isolate the head set, (I know how POTS works) but, for now hope we can make it work without having to resort to this.
Worth Six Pound to try it, though, even if it does not work!
Thanks, and, I'll keep you Posted, but, remember, I'm on my own, and have to resolve many issues, all by myself. If I get an Intractable Problem in One Place, I put it aside, for dealing with, and whilst waiting, tackle something else. That keeps the entire front moving.
No, Richard gave you the link all child windows are automatically disposed.
Your only responsibility is to cleanup any memory allocation, handles etc you specifically created. You do that by intercepting the WM_DESTROY message and cleaning up there. WM_DESTROY is sent just before the window is deleted but while the window is actually still valid.
Typically you create things in the WM_CREATE and you dispose of it in the WM_DESTROY.
Okay the rules with memory or object allocation and deleting are very simple.
If the memory/object is used by multiple children windows and/or the parent then you create it in OnCreate (WM_CREATE) on the parent and destroy it on OnDestroy (WM_DESTROY) of the parent. The reason is because multiple children and/or parent are using it and you need it created before any children and disposed of after the children are deleted.
If the memory/Object is used by ONLY the SINGLE child window EXCLUSIVELY (that is the data belongs really to the child) then you create it on OnCreate (WM_CREATE) of the child and you delete it with the OnDestroy (WM_DESTROY) of the child.
Sometimes people get lazy and just use situation 1 to cover situation 2 but there are traps in that. It is very easy to forget you need something done before the child is created which is in an unrelated block of code in the parent window create function. So generally I would advise against being lazy and using situation 1 to try and cover all situations. Using Situation 2 when it is valid to do so makes your code self contained portable without thinking about it.
Situation 2 is that most often not understood by people. I will give you a simple example I might use on your edit entry, and this is a subclass of the edit I use a lot in programs. OnCreate (WM_CREATE) of the edit box I create a string object. Whenever the user hits enter, I validate the entry via a message call and if its valid put the current value into the string object and then update the edit window to the new value. Why do this ... well because in the edit box handler hitting the "esc" key goes and gets the value from the string object and puts it back it the edit box. It is a return to last valid value function or a simple single step back. If you think about it you could extend the concept to a list and be able to scroll back thru the list of entered values something you might recognize for the entry address input of your web browser. Now the point here is the string object is the edit boxes responsibility to delete so it will do that on it's OnDestroy (WM_DESTROY). Now everything is self contained I can create as many of these edit boxes as I want into a parent and they all look after there own object string.
So basically you need to work out what data is being used where and in this regard it is very similar to thread or task code.
I don’t know how to use git. I just downloaded a Windows version yesterday (haven’t installed it yet), and am studying an ebook on it. Or should I use GitHub? I don’t know anything about these things. Is there an easier way to do it? Is there an ftp site where you can just download it from without having to learn/use some complicated source code management system?
I’ve nearly completed writing my own version of only what I need from the C Standard Library, and all I need from the C++ Standard Library is a String Class, and I’ve used my own for many, many years which works fine. The only thing I need yet is a full implementation of pow, and possibly exp if pow needs that, and I don’t know how to do it myself. That’s why I need to study and learn from the GCC C sources. I’m linking without the Standard Libraries so as to avoid the bloat, and using Windows.
But if I’d have asked here first how to implement pow, within 1 minute of posting that question I’d have been told to look at the GCC sources, which I don’t know how to do. That’s why I’m asking for instruction here first on that. Once I’ve figured out how to get at the GCC sources, then I can tackle my pow issue.
I think I'm on the right track Richard. I downloaded Subversion for Windows from SourceForge, but it doesn't look like I have to use it. By replacing svn:// with http:// I can browse to sources as just ftp folders. I've gotten this far...
Perhaps I just need to spend some time searching for pow. Haven't found it yet.
What you are looking for are the glibc sources (the C standard library) and not the GCC sources (the GNU compiler collection). Glibc download: The GNU C Library[^]; download without using Git: Index of /gnu/glibc[^].
The pow() and exp() functions are part of the math library which depends on the target platform processor. Once you have unpacked the glibc sources, these functions can be found here for x86 CPUs (file names for double):
sysdeps/i386/fpu/e_pow.S: Implementation using the x87 math coprocessor.
sysdeps/ieee754/dbl-64/e_pow.c: Implementation in plain C.
The FPU implementation is in assembler and should not need any other functions. The IEEE implementation needs other modules (at least e_exp.c) and some header files.
Thanks very much Richard and Jochen. It dawned on me yesterday afternoon while taking a walk (which is how I solve most of my programming problems) that I needed libc - not GNU GCC sources. Just now before checking in here I managed to download libc in tarball format. Now I need to see if I have an app to extract tarballs. I much appreciate your help! Thanks very much!
We have a Server and Client application developed in MFC
The Server and the client exchange data using CSocket class
We have a big Structure of size 900000 bytes to exchange data.
Our Structure contains array of integer, char and float as data members. Our structure looks like the below eg.
float LH ;
float XS ;
float NER ;
float TDER ;
float DER ;
float SS ;
float SS2 ;
float COMP ;
char POIC ;
int AMID ;
char AMS ;
char WTL ;
I am copying all the structure data to char variable and send and receive data between clients through serialization. We have a global object for the above structure whose values changes continuously based on some calculations every 250 millisec. So some of the data changes continously every 250 millisec.
Example calculations that change data:
Test->ss = Test->ss + Test->Log * Sin(5.62) * Test->LH /4.566
There are several formulas that get executed based on logics which process the data in cycles.
I want to send only the values that are changing whereas now I am transfering the entire data every 2 seconds.
Is there any better way of identifying only the changed data to send it. Please help.
A Shared memory using CreateFileMapping function is created by the Server application to share the ModData with another process named 'Plantmodel' running local which does the most of the calculations.
A GUI Client is also connected to the Server using sockets which gets the User inputs anytime. So the User gives an input anytime which is send to the server through sockets and the server updates the input in the shared memory and the plantmodel process which is already doing all the calculations in 250millisecs takes this input too. So at anypoint of time the real time data is available at the server.
My actual question is...Is there anyway to find out only the data that is changed from the big structure from the server side, so that i could use a function to update it to the other client application instead of sending the entire data.
It can be still done with my solution. Just send a message after each data update indicating whch data has been changed. If you need to track the changings, you may add another structure containing flags for the elements. However, in this case the flags must be cleared when the clients has processed the update (sending some kind of acknowledgement in the other direction).
Windows forms applications and console applications are quite different. If you want a full GUI then create a Forms application from scratch. However, since this is C++ you may like to investigate the Windows API or MFC.