|
You need to input the required lib files to the linker - such as Gdi32.lib, user32.lib etc.
|
|
|
|
|
Thanx, that helped solved the problem.
The "Inherit from parent or project defaults" option was unchecked; once I checked that, it worked.
Thanx,
Lee H.
|
|
|
|
|
Is there available NET dll's for capturing video from usb device to some memory location, which is not to much complicated to use?
9ine
|
|
|
|
|
I made an application in opengl with glui libraries and i call it from a VB.NET form,well my problem is how can i redisplay my shape in opengl window without creating a new window and change his values at a run time mode!!!is there any statement in opengl i can do that with?I think that i must reset my buffers and reaload it!Any ideas?
Thanks....
giotis
|
|
|
|
|
Hi
Can anyone tell me the mathimatical explanation of converting a floating point to a hexadecimal?
Thanks..
|
|
|
|
|
It depends on the range of the number you want to represent. I put some basic macros at the end of this message, but the concept that you need to understand is the range of the floating point number and the number of bits in your integer representation (HEX or DECIMAL is really not relevant, they are just ways of viewing the integer). So for example if you are trying to represent PI as a integer number using a 16 bit word, you need at two integer bits for the 3 and the rest could be fractional bits. Assuming an signed 16-bit word, gives you 1 sign bit, 2 integer bits and 13 fractional bits. So multiply PI * 2^13 = 25735.9270. Since this is an integer, your loss of precision is the .9270.... So you are left with 25735 (0x6487).
My original PI was 3.1415926535897932384626433832795
If I convert my integer PI back to a floating point number (by dividing by 2^13) we get 3.1414794921875.
The important thing to remember when using these converted numbers is to keep track of the decimal location in all of your mathematical operations using that number.
If you send me an email address I can send you a couple articles that describe fixed point math operations can concepts.
typedef long fixed; // Our new fixed point type.
#define itofx(x) ((x) << 8) // Integer to fixed point
#define ftofx(x) ((x) * 256) // Float to fixed point
#define dtofx(x) ((x) * 256) // Double to fixed point
#define fxtoi(x) ((x) >> 8) // Fixed point to integer
#define fxtof(x) ((float) (x) / 256) // Fixed point to float
#define fxtod(x) ((double)(x) / 256) // Fixed point to double
#define Mulfx(x,y) (((y) * (x)) >> 8) // Multiply a fixed by a fixed
#define Divfx(x,y) ((y << 8) / (x)) // Divide a fixed by a fixed
#define Printfx(x) printf("%ld.%ld", x >> 8, 100 * (unsigned long) ((x) & 0x00ff) >> 8)
// Print fixed point.
#define NDPrintfx(x) printf("%ld", x >> 8)
// Print fixed point without a decimal point.
|
|
|
|
|
if you can get the binary array of the float, you can easily get its hexadecimal representation...
group the bits by groups of 4 bits. then use the following :
binary <--> hexa
------------------------
0000 0x0
0001 0x1
...
1010 0xA
...
1111 0xF
then, you have it.
see this example :
0b 0010 0101 1101 0110
0x 2 5 D 6
so, the hexadecimal representation of the bits shown is 0x25d6 ...
understand ?
[edit]
ok, i'm quite sure it won't be that ease for you to get the bit array, so here is a sample for that :
<font color=blue>float</font> floatToAnalyse = 3.45; <font color=green>
<font color=blue>char</font> floatBits[32] = <font color=gray>""</font>;
<font color=green>
<font color=blue>unsigned int</font> uiBitsArray = *((<font color=blue>char</font>*)(<font color=blue>void</font>*)floatToAnalyse);
<font color=blue>for</font> (<font color=blue>int</font> i = 0; i < 32; i++) {
floatBits[0] = (((uiBitsArray >> (31-i)) & 0x00000001) == 1)
? <font color=gray>'1'</font>
: <font color=gray>'0'</font>;
} [/edit]
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
-- modified at 8:54 Friday 16th December, 2005
|
|
|
|
|
Dear Members,
I need to color a button using ATL, WTL or WIN 32 API..
I can easily do it using MFC but because of the Application requirement
I have to do it by using the above mentioned technologies only.
Kindly help me out by sending tips and useful codes.
Regards,
Mayank Srivastava
|
|
|
|
|
you are on the managed C++ forum, which .NET related. what you need (ATL, WTL, MFC, Win32) is all except MC++.
try the ATL/WTL/STL forum[^]...
ps: asking your question once is sufficient...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
-- modified at 9:41 Wednesday 14th December, 2005
|
|
|
|
|
thanks a lots,
My meaning is web service client how to access web service endpoint?
|
|
|
|
|
If I have a dll created by Managed C++ and receiving array. How do I pass the array from application in C# to the generated DLL?
Any help is appreciated.
|
|
|
|
|
C++/CLI
public: void MyClass::myDllFunction(cli::array<String^>^ stringList)
{
...
}
C#
using MyClass;
string[] list = new string[]{"one", "two", "three"};
myClassInstance.myDllFunction(list);
-- modified at 16:05 Tuesday 13th December, 2005
|
|
|
|
|
Thanks a lot. So it is pretty natural on both sides.
|
|
|
|
|
Hi All,
This might be a really silly question but,...
I have a class A defined as:
<br />
class A<br />
{<br />
protected:<br />
float data[4][4];<br />
};<br />
And I need to get the data out so I created a function:
float **GetData (void) { return (float **) data }
However this causes an 3f800000 exception in VS 2005 Express when I try to use the float returned. Do I need to physically copy the data into a tempory buffer?
regards,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
is the array well initialized (in the constructor tor instance)
before using it, test if it is different from NULL .
and at last, if your class exist only for such things, prefer using a struct instead...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20] | soon : [VisualCalc 3.0]
|
|
|
|
|
Hi,
The array is initialised to have all elements 0. It is not pointer, so it is not dynamically allocated, and it is not a NULL pointer exception. Also I need to overload the arithmetic operators so the best is to use a class. There are also other data members not meantioned here.
BTW, I tried this in normal code (i.e. in the main function) calling another function that took a float ** and it did the same thing.
regards,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
toxcct wrote: and at last, if your class exist only for such things, prefer using a struct instead...
Just curious - why ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
The problem is probably elsewhere because it looks correct. Did you try to use the debugger and see where EXACTLY the code crashes ? (Press F5 to start the debugger and F9 to set or remove breakpoints).
|
|
|
|
|
Cedric, how can you be so sure that his code is correct ?
nowhere he says that he initialized the array, so if he doesn't test for a NULL pointer, i may use a wrong array !!!
moreover :
float **GetData (void) { return (float **) data }
is missing a ; after the return statement...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20] | soon : [VisualCalc 3.0]
|
|
|
|
|
Hi,
You are right, there should be a ';'. I didn't copy it exactly as I removed a lot of other stuff to simplify the post
I also thought that seeing that the memory is allocated with the class, I wouldn't need to test for a NULL pointer. Am I wrong?
regards,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
Ok, maybe I was a little bit fast to say that but I suspected that if he declare the array like that:
float data[4][4];
he will use it without using pointers, so something like that:
data[0][0] = 1.2345;
When you do that, there is no chance that your pointers inside your array are NULL (and they are allocated when the array is created, not like declaring an array float* data[4]; ).
|
|
|
|
|
Hi,
Yes I did. It crashes as I use the memory passed back. If I look at the memory it has f [0x0012fe30 -> 0x3f800000]. The memory address of 0x0012fe30 corresponds to the memory in the class.
regards,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
Hmmm, it is difficult to guess what is happening. Post the code in which you use the array (where you put stuff inside it).
Off topic: I like your sig
|
|
|
|
|
Sure:
<br />
void main (void)<br />
{<br />
float **f;<br />
A id;<br />
f = id.GetData ();<br />
<br />
cout << f[0][0] << endl;<br />
}<br />
I have also just noticed that the error code is:
Unhandled exception at 0x004150e0 in agile_tests.exe: 0xC0000005: Access violation reading location 0x3f800000.
Sorry for the misleading info before.
regards,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
looking in the debugger, is id well constructed so ?
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20] | soon : [VisualCalc 3.0]
|
|
|
|