|
it looks the m_Type is a CString.
CString should be used with care in rare cases.
i.e.
CString cs0="Hello";
CString cs1=cs0;
the cs0 and cs1 share same memory.
CString cs0=5; is also a truble.
I suspect about operator == of CString.
If you change code to
if(m_Type.Compare("XXX")==0)
things shoud be fine.
|
|
|
|
|
Hi
It isn't the case, because I did run the debug & it went into each case as I wanted. I also did try with the number instead & the result is the same
- The symtom is weird (please try yourself):
. The pointer did change but not the way I wanted
. Also it appeared different shape between the Desktop & inside any text document
*) I suspect it is mixed-up in the memory (the previous one & the new one), but I don't know how to fix it!
|
|
|
|
|
Is the m_Type variable a CString as suspected by includeh10.
If it is not, what type is it?
If it is a character array, you will need to use the strcmp or wcscmp functions depending on whether the build is UNICODE or NON-UNICODE.
If it is a CString and the build is UNICODE you have to do the comparison as if (m_Type == L"ARROW") .
Ideally m_Type must be an integer variable and all types must be #defined like -
#define ARROW 1<br />
#define ALLSIZE 2<br />
etc.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi
It isn't the case, because I did run the debug & it went into each case as I wanted. I also did try with the number instead & the result is the same
- The symtom is weird (please try yourself):
. The pointer did change but not the way I wanted
. Also it appeared <u>different shape</u> between the Desktop & inside any text document
*) I suspect it is mixed-up in the memory (the previous one & the new one), but I don't know how to fix it!
|
|
|
|
|
On further reading the documentation carefully, I found that LoadCursor is the problem.
Here is a snippet from the documentation -
The system destroys hcur by calling the DestroyCursor function. Therefore, hcur cannot be a cursor loaded using the LoadCursor function. To specify a cursor loaded from a resource, copy the cursor using the CopyCursor function, then pass the copy to SetSystemCursor.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi,
Thank for suggestion, but I did try with all kind of CopyCursor then passing it to the SetSystemCursor, but the Pointer now is unchanged at all!
I did try to search if anyone can succeed to change the Pointer with VC++ ... but looks like there nothing (well, might be with those link with Chinese language, but I can't read them)
Any further suggestion?
|
|
|
|
|
When using CHtmlView (and using Javascript to get the broswer version), I get version 4( corresponding to IE4 to IE6)... whereas I would like the latest installed version to use...
Does anyone know how/if this is possible?
I am doing this so I can run flash controls in the control - and so that they can call Jasvascript functions... Any pointer for that would be welcome too... it seems only possible in http but not on local files...
Thanks in advance!
Jerome
|
|
|
|
|
BadJerry wrote: using Javascript to get the broswer version
The actual version of the browser is contained in the navigator.userAgent property and is typically extracted with a regular expression. For instance one of my test machines is still running Internet Explorer 6.0. The userAgent field returns the following:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
To extract the version information you can use the following:
var exp = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
var version = 0;
if (null != exp.exec(navigator.userAgent)) {
version = parseFloat( RegExp.$1 )
}
1300 calories of pure beef goodness can't be wrong!
|
|
|
|
|
I am receiving a data structure from a Unix machine (Big Endian) which contains doubles, integerss and shorts. Using UDP for the transmission of the data.
Now what do I need to do at the Windows end to access this data correctley; i.e. adouble with the value 55.5 on Unix having the same value on Windows;
Can I do byte swapping on the data structure received (this must have been done before); or do you need to byte swap each type individually; e.g. to get the double and the 32 bit integers and the 16 bit shorts.
At present I will assume byte aligned but will check during testing and avoid booleans.
Regards,
Andy.
grahamfff
|
|
|
|
|
you have to swap on the individual items (not on the struct).
|
|
|
|
|
As Chris said, you do need type-specific code.
In particular you need byte swapping only when multi-byte data is involved, so a 4-byte int needs its 4 bytes swapped; an 8-byte double needs its 8 bytes swapped; and a 4-byte byte array is fine the way it is.
Just make a drawing of what the data looks like on a big-endian machine, and then again on a little-endian machine, and you'll never forget what is involved.
BTW: float values could use different encodings altogether; nowadays most systems use an IEEE format, however I have seen some other schemes over the years. When different, it becomes really hard to get them across, and you might want to consider a different representation, maybe even a string!
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
As the other answers suggested, you have to do this for individual elements of the structure.
Here is an article on endian-ness - Basic concepts on Endianness[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks for the posts, I did try the following code, but am I on the right track as the float did not work.
struct RXData {
double timeStamp;
double item1;
long item2;
double item3;
int flag1;
bool state;
}
float swap(float d)
{
float a;
unsigned char *dst = (unsigned char *)&a;
unsigned char *src = (unsigned char *)&d;
dst[0] = src[3];
dst[1] = src[2];
dst[2] = src[1];
dst[3] = src[0];
return a;
}
short byteSwap16(short value)
{
short newValue = 0;
char* pnewValue = (char*) &newValue;
char* poldValue = (char*) &value;
pnewValue[0] = poldValue[1];
pnewValue[1] = poldValue[0];
return newValue;
}
unsigned long byteSwap32(unsigned long value)
{
unsigned long newValue = 0;
char* pnewValue = (char *) &newValue;
char* poldValue = (char *) &value;
pnewValue[0] = poldValue[3];
pnewValue[1] = poldValue[2];
pnewValue[2] = poldValue[1];
pnewValue[3] = poldValue[0];
return newValue ;
}
RxData.timeStamp = swap(RxData.timeStamp );
grahamfff
|
|
|
|
|
Hello,
Good Evening,
I need to read data from the file ,which contains some special characters (in european languages).I need to read those data as it is and display those reading data in CEdit box,But what's my problem is while reading data some of the characters got changed.How can i read data as it is. Please help me out.
With Kind regards,
Bhanu
|
|
|
|
|
What does your code look like? And what are the contents of the file (Unicode/Non-Unicode)?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
It is non unicoded. For eg. è ë
|
|
|
|
|
Read my previous reply to you again and provide all the details I asked for.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi
GDI + implements many class which include Graphics, Image, and Bitmap.
The Bitmap (Inherited from Image) only implements a function call "RotateFlip" which can be used rotated Bitmap by only "90, 180, 270, 360..". The Bitmap can not be rotated by any angle.
I post a message several days ago. David suggested me to use "Graphics" and "Grphics.DrawImage". But I found out that "Graphics" is only used to display the image.
Can I rotated a Bitmap not on screen but the Bitmap itself using GDI+?
Best regard,
|
|
|
|
|
You can use a Graphics to draw into a Bitmap, then save that Bitmap to a file.
--Mike--
Dunder-Mifflin, this is Pam.
|
|
|
|
|
Hi Mike
Please tell me how to draw into a bitmap? I tried following code:
Graphics g(hdc);
Image i(L"HelloWorld.bmp");
g.DrawImage(&i,0,1024);
g.TranslateTransform(100.0f, 50.0f);
g.RotateTransform(45.0f);
g.DrawImage(i,0,0);
CLSID jpgClsid;
GetEncoderClsid(L"image/jpeg", &jpgClsid);
i.Save(pIStream1, &jpgClsid);
I can not get the Bitmap rotated.
I don't know the operation to show on screen. I just need the rotated the bitmap.
Please help me.
modified on Monday, August 3, 2009 4:22 PM
|
|
|
|
|
Graphics has a constructor that takes an Image*. Construct a Bitmap, use a Graphics object to draw into it, then save that Bitmap to a file with Image::Save().
--Mike--
Dunder-Mifflin, this is Pam.
|
|
|
|
|
Dear Mike
Thank you so much, I finally figure out how to let it work now. You are great.
Best regards,
|
|
|
|
|
Hi Mike
I have another question for you. Can I save a bitmap as 8 bit or 16 bit instead of GDI default 24 bit?
Best regards,
|
|
|
|
|
I haven't tried this, but when you create a Bitmap, you can give it a pixel format. See if using different formats affects how the file is saved.
--Mike--
Dunder-Mifflin, this is Pam.
|
|
|
|
|
I recently switched from Bloodshed to Visual in order to use FLTK, but I'm having trouble with just compiling/running a simple file. I know that a file has to be in a project for it to be compiled (what is the purpose of this by the way?), but even after I figured that out I'm still having issues. The errors given aren't very clear either :/
Something as simple as this doesn't compile.
#include "std_lib_facilities.h"
int main()
{
cout << "This creates an error." << endl;
keep_window_open();
}
1>. \Debug\Exercises.exe.intermediate.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified.
My guess would be that this is because it doesn't recognize the std_lib_facilities header, even though it's in my project folder. How can I get the IDE to recognize the header?
|
|
|
|