|
prakash reddy wrote: float fDiffLat = -0.19629669; //input values to cos()
float fDiffLon = 0.060424805;
As CG has already indicated, float s only have 6-7 significant digits. Use double s for 15-16 significant digits.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi everyone,
on my Dialog i have multiple components for example a label with a textbox a side
If i resize the CFormView ( Not the dialog -> MDI Project ) the event reacts each pixel.
How can i center the label with the textbox a side ?
My only idea is to get the position of the component and to move the LEFT (re-setting) one pixel farer.
Next event the RIGHT one pixel farer...
But aren't there more possibilities to center components?
many thanks
|
|
|
|
|
The only way to position something is to set it's position yourself, in code. Handle the WM_SIZE event.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
S*** .. ok thanks
Before i started the hard way, i would ask about another possibility
|
|
|
|
|
Sure - there are better options in .NET, but not in MFC.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi, I am working on VC++ 2003. I am using a string as "char *pchData;". now at some point how can I check that 'pchData' is defined or undefined?
Thanks in advance
|
|
|
|
|
Your code is wrong. NEVER create a pointer without setting it to a valid value, or NULL. Then, just check if it is NULL.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
If you're unsure whether a particular pointer is pointing at a valid address, then something's wrong with your design. In C/C++ it's the program's responsibility to make sure that pointers are either NULL or contain a valid address.
The IsBadXxxPointer() APIs are not reliable (search MS blogs for them, you'll find a few posts about how evil they are).
|
|
|
|
|
We have an application that was written on VC++ 6.0 a few years ago. Today a customer reported that it did not work on their 64 bit laptop (that's all they said 'it doesn't work'!). We are waiting for more info on the problem and we don't have a 64 bit system to try it on.
I just wondered, has anyone had any experience running 32 bit apps on 64 bit machines? Good / bad etc?
Many Thanks,
Ali
|
|
|
|
|
|
Thanks, I will take look at that - sounds like just what I need.
Regards,
Ali
|
|
|
|
|
The first thing that comes to mind is that a 32-bit EXE can't load 64-bit DLLs and vice-versa. For example, a 32-bit IE plugin won't load in 64-bit IE. But without any details, we can only give you WAGs.
|
|
|
|
|
Michael Dunn wrote: we can only give you WAGs.
Fair comment, just checking out the general opinion. I thought a 32bit exe would run on a 64bit machine using WOW, and wondered if anyone else has had any trouble - looks like they haven't - its just my customer!
Thanks Anyway,
Ali
|
|
|
|
|
Alison Pentland wrote: I thought a 32bit exe would run on a 64bit machine using WOW
It can, you just can't mix 32 and 64 bit modules in the same process.
|
|
|
|
|
rand() returns an integer in the range [0 - RAND_MAX]. What if I want to generate random integers in a wider range? is there no escape from calling rand() twice and then multiplying the results?
Is there a continuous random number generator in C++ ?
Thanks,
Avi.
|
|
|
|
|
avimitrani wrote: is there no escape from calling rand() twice and then multiplying the results?
That's not really random, nor does it give a wide enough range. Try calling it twice and shifting the first result to take the bits above the second result.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
You could generate a random number between 0 and 1, then multiply that by the bigger number you want to use, e.g.
flaot fRand = rand() / (float)RAND_MAX;
int iValue = fRand * 10000000;
|
|
|
|
|
That won't work: some values might have no chances at all to be picked.
|
|
|
|
|
|
avimitrani wrote: What if I want to generate random integers in a wider range?
You'll need to roll your own. Something like this.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
Iam new to vc++ programming.. iam writing an application which needs some functionalities of some of the activex dlls that I have. Previously static linking to the lib file is done. But right now i need to load active x dlls at runtime. Iam not getting how to instantiate the libraries and loading it at runtime. My platform is Visual Studo 6.0..Can anyone of you help me regarding this. Any help will be appreciated.....
thanks
Bollapalli
bollapalli
|
|
|
|
|
Make sure your ActiveX DLLs are registered. Are these functions graphical or non-graphical components? If they're graphical, you can easily use the dialog editor to put the controls into place, or you could use CWnd::CreateControl to create the controls.
If they're non-graphical components, there are basically two ways to use them. If your components expose interfaces with a vtable (IUnknown-based interface or dual interface), you can use the #import feature of Visual C++. The MSDN docs describe how they are used, and I'm sure you can dig something out about #import here on Codeproject. If not, Google is your friend.
If your component is dispatch only (no vtable), you don't need to #import the ActiveX DLL (unless you've defined structs or typedefs in the typelibrary). Then you can use the COleDispatchDriver class, which helps you to instantiate the component, as well as call methods and manipulate properties. This project could probably benefit you a lot: http://www.codeproject.com/com/xydispdriver.asp[^], as it simplifies the dispatch stuff a great deal.
--
Verletzen zerfetzen zersetzen zerstören
Doch es darf nicht mir gehören
Ich muss zerstören
|
|
|
|
|
I have designed the FTP client application using the WinInet classes . In that for storing the file on the FTP server i have used the CFtpConnection: PutFile(), but it is not retuning true and so the local file is not getting stored at the FTP server.The Error it is saying is that dwd =2(i.e ERROR_FILE_NOT_FOUND )Please help me out in this ....
Is there any other to store the file on the FTP server...
Thanks n Regards
Shikha
|
|
|
|
|
Why don't you work out why it's returning false, and fix it ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks for your immediate reply...
its showing ERROR_FILE_NOT_FOUND when i try to fix it using the GetLastError() but i cannot able to find out the reason..
why it need to find the file on the ftp server it should just get store the specified local file on the server side....
Thanks
Shikha
|
|
|
|