|
Numbers written in 0.1 format are treated as doubles, to get he compiler to treat them as floats write them as 0.1f
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Its always better to use a 'double' array instead of float. If you are very specific about float array, you can initialize it by explicitly type-casting each element as shown below.
const float feature_scal_intervall_low[ NR_FEATURES ] = { (float)0.1,(float)0.0,(float)0.1,(float)0.1,(float)0.3 ,(float)0.2,(float)0.1,(float)0.1,(float)0.0,(float)0.2 };
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Hi,
Is it possible to use the same Windows socket for listening (for new connections) and at the same time exchanging data (using the sendto() and recvfrom() functions)? Or must I have two separate sockets, and if so must the separate sockets also be bound to separate network ports? Just for the info, I am using WinSock 2 API functions.
High thanks in advance
Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
|
|
|
|
|
A socket is bi-directional, so you can read and write on it.
|
|
|
|
|
Sorry, didn't read your message correctly. When you 'accept' a connection on a listening socket then Windows will automatically create you a seperate socket with which you communicate to that client. You don't need to worry what port this is on as its all handled by the 'accept' call.
|
|
|
|
|
You must have misunderstood me (could be partly my fault sorry), I meant if it is possible to listen for incomming connections (not to accept them) and simultaneously communicate (sending/receiving) with a non-connected client? For ex:
* socket S is created.
* bind S to network address with specific port.
* Create thread T.
* set S to listen for incoming connections
* meanwhile on thread T, socket S is sending and receiving messages.
Is the above situation possible?
Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
|
|
|
|
|
I have a tree list control and I want to differentiate certain entries in it. How can I, for example, set text on an item to a different color or make it bold?
|
|
|
|
|
You can bold an item by setting the TVIS_BOLD style on the item. To change colors, use custom draw.
|
|
|
|
|
Inserting an item with bold text:
pTree->InsertItem(TVIF_TEXT | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE, "text", nImage, nSelectedImage, TVI_LAST);
Setting an existing item's text to bold:
pTree->SetItem(treeItem, TVIF_STATE, NULL, 0, 0, TVIS_BOLD, TVIS_BOLD, 0);
"The folly of man is that he dreams of what he can never achieve rather than dream of what he can."
"If you think education is expensive, try ignorance."
|
|
|
|
|
Hi everybody
I have a Chinese sentence;for example,"大家好", I don't know which kind of Data types I can use to assign this sentence to.
I use CString, but it does not work.
and the UNIT only read one word.
Thanks
|
|
|
|
|
|
hi
Maybe your computer donot support Big5 code.
CString is a good idea to process string. if you can't use it.
I suggest that:
to vc, char also is integer type, so you can do it as follow:
static DWORD szChar[]={"你好嘛?"}
hope a little help for you!
dupengfei
|
|
|
|
|
CString does work on Chinese characters even without _UNICODE being defined, if the operating system is able to display them. You can try:
<br />
CString str(_T("大家好"));
AfxMessageBox(str);<br />
Compile and link the code on a Chinese operating system and it will work.
|
|
|
|
|
Hello,
I want to draw a CButton object in a SDI. If I try to do this I am getting assertion. How to do this?? Anybody got some clue??
Thanks
Satya
|
|
|
|
|
I presume, You are giving a NULL value for the 4th parameter in the Create function, which is the handle to the parent window. You are supposed to pass a valid HWND there. If you are creating the button in the CView derived class, you can give 'this' as the value to 4th parameter.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Jagadeesh VN wrote:
...the 4th parameter in the Create function, which is the handle to the parent window. You are supposed to pass a valid HWND there.
I assume you meant a CWnd* is the 4th parameter to Create() .
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi,
Thanks it seems working. But one more problem. My code is now like this.
CButton mybutton;
HICON myicon;
myicon=AfxGetApp()->LoadIcon(IDI_ICON1);
RECT myrect;
myrect.top=10;
myrect.bottom=30;
myrect.left=10;
myrect.right=30;
mybutton.Create(" ",WS_CHILD|WS_VISIBLE,myrect,this,1);
mybutton.EnableToolTips(TRUE);
mybutton.SetIcon(myicon);
// AfxMessageBox("Complete");
Now my problem is if I comment that AfxMessageBox I am not finding the button. One more problem is, I am not finding the Icon on button. What's wrong with my code??
Thanks
Satya
|
|
|
|
|
I have a suggestion for you. You have to learn the basics of programming..."take it on the lighter side."
You are declaring the mybutton variable within the local scope, So when the program exits the current scope, that variable will no longer exist. Make mybutton a member of the class, and try.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
I have a set of legacy DLLs which are being maintained, but proving very difficult to manage. First issue: they are written in C and not compiled under VisualStudio, and we have opted to leave them as-is.
Does anyone know the simplest way of embedding version information into them without going down the <project>.rc route? Or how can I call the resource compiler before the C compiler from my makefile?
Obviously I can link them with the Windows Version.lib to give the correct external interfaces - but how do I actually embed the data into the DLL?
Many thanks, Jay
|
|
|
|
|
I need to print a metafile which I have in memory. There are basically two parts to the question, one being a current problem and one I can see loking ahead.
I've got a DC so all I need to do is pDC>PlayMetaFile(hMyMetafile, &rc)
right? That kind of works, but the resulting image comes out much buigger than it should be. Why? Is it because the rectangle that I am passing to PlayMetaFile is the usable drawing area from the CPrintInfo and not the size of the metafile? Because the mapping mode means the interpretaion of whatever I send it is incorrect?
Second point - If the metafile is wider than the page, how do I print the remainder of the metafile on the second page (if that makes sense)? Presumably I have to set pInfo->m_bContinuePrinting to FALSE so that OnPrint gets called again, but then how do I get the piece of the metafile which was not printed in the first time around to print this time? I can't just call PlayMetaFile again. Can I?
Thanks to anyone kind enough to throw a nugget of wisdom my way!
|
|
|
|
|
First off, you need to know how big your metafile is. If you're gonna scale the metafile to be as [wide|tall] as the page you are printing it on, then be sure you preserve the aspect ratio. Yes, you'll need to pay attention to the mapping mode to know how to convert the measurements when calculating the drawing rectangle. Finally, assuming you know how big the page you are printing onto is, you can simply adjust the [top|left] of the drawing rectangle by that amount when printing subsequent pages.
Shog9
I returned and saw under the sun,
that the race is not to the swift,
nor the battle to the strong...
|
|
|
|
|
hi,
i would like to add a system dsn to the system in the application. i have tried SQLConfigDataSource(). but, it returned "fail" to me.
would anyone give me some insight about this function?
thanks,
jim
|
|
|
|
|
Well, without a code snippet of how you are using the function, a diagnosis would be a guess at best.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Friends,
I need to enable/disable the menu items. For this purpose i am using the EnableMenuItem() function of CMenu class.
The problem is that this function takes input the menu item's ID. But, there are menu items known as "Pop Up Menu Items " having no ID.
How can i enable/disable, popup menu items.
|
|
|
|
|
Hi,
take the parameter MF_BYPOSITION
e.g.
CMenu::EnableMenuItem(2, MF_BYPOSITION | MF_GRAYED);
-> disabled / grayed the third menu item.
Regards
Frank
|
|
|
|