|
char is a signed data type.
You have to use unsigned char in order to get the character values above 127 (decimal) right, such as:
unsigned char v;
for (i=0; i {
v = (unsigned char) buf[i];
}
There is a compiler option (/J ?) that defaults char to be unsigned.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
If you just want char to be unsigned, set the compiler option /J.
|
|
|
|
|
How could i make a Combo box readonly(user can not write in the combo box) in design time? How could i make a Combo box readonly(user can not write in the combo box) in run time?
|
|
|
|
|
|
Thanks
|
|
|
|
|
reza matinnejad wrote: How could i make a Combo box readonly(user can not write in the combo box) in design time?
By using the WS_DISABLED style.
reza matinnejad wrote: How could i make a Combo box readonly(user can not write in the combo box) in run time?
By calling EnableWindow(FALSE) .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
reza matinnejad wrote: How could i make a Combo box readonly(user can not write in the combo box) in design time? How could i make a Combo box readonly(user can not write in the combo box) in run time?
use combo list
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
Hey all,
I'm having a problem with an MFC program using CSockets. What i'm trying to do is have a connection to a server (that won't be my own creation) which can reconnect or attempt to reconnect if the connection is ever lost. The problem I have is if the address doesn't exist the application seems to pause and become unresponsive when trying to connect. Which is fair enough, but how do I prevent the connect if the address doesn't exist or isn't ready to connect because the program will be automated and does other stuff between connections.
Thanks in advance,
Chris
|
|
|
|
|
cant you issue an icmp/ping to see if the address is out there before you attempt to connect to it ? .. it seems that this unresponsive behaviour is common in network apps
'g'
|
|
|
|
|
yeah thats what I was thinking, could you point me towards the ping commands please? I had a look yesterday but was unable to find a suitable example.
Thanks
|
|
|
|
|
|
I would suggest looking into non-blocking sockets, or a worker thread to block on the connect (and retry) for you.
Be careful relying on Ping - there are firewalls out there that can be configured to ignore ICMP Ping packets, so relying solely on Ping is not a good idea, IMHO, especially if the server is not yours, implying that you do not have that much control over its connectivity.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
hi,
Can anybody tell me about .aps file like what it is and uses???
Siddharth
|
|
|
|
|
Hi,
I don't know anything about the format but I found this on a Microsoft page :
"The Resource Editor generates and uses a .APS file. This file contains a binary format of the resources. The Resource Editor loads the resources from this file to reduce the time required to load them."
Hope this helps,
Chris
|
|
|
|
|
siddharthsan wrote: Can anybody tell me about .aps file like what it is and uses???
APpStudio
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
siddharthsan wrote: Can anybody tell me about .aps file like what it is and uses???
http://www.wotsit.org/search.asp?s=windows
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
Hi,
Can anybody tell about .aps file like what it is and it's use???
|
|
|
|
|
|
http://www.codeproject.com/script/comments/forums.asp?forumid=1647&select=1905445&df=100&mpp=50&fr=58#xx1905445xx
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
I have written a reference class for one of my classes. It implements reference counting for that class and that's pretty much it. I have written a cast operator to the class type it references, but the compiler does not use that operator implicitly, so whenever i want to access the referenced object, i have to do an explicit cast (or call a method like getObject()). How can i prevent that ?
Here some code to illustrate my problem :
class MyClassReference;
class MyClass
{
public:
void doStuff();
static MyClassReference getInstance();
~MyClass();
private:
friend class MyClassReference();
MyClass();
void addReference();
void removeRererence();
int m_referenceCounter;
};
class MyClassReference
{
public:
MyClassReference(MyClass &object);
operator MyClass &();
~MyClassReference();
};
This is just the principle, feel free to comment on it.
wbr
Brainley
|
|
|
|
|
Your operator needs to return the reference to your class:
MyClass& operator& ();
|
|
|
|
|
same error : doStuff() is not a member of MyClassReference.
-- modified at 6:00 Wednesday 21st February, 2007
|
|
|
|
|
Show the code that is giving the error.
|
|
|
|
|
MyClassReference ref = MyClass::getInstance();
ref.doStuff();
He does not apply the cast implicitly. The following works :
((MyClass&)ref).doStuff();
The compiler told me though, that i have to declare the cast operator
operator class CNeighbour &();
in order for this to work. But he still does not apply the cast-operator implicitly.
|
|
|
|
|
Of course, you are not using the operator at all ! So it is logical that it complains.
BTW, are you trying to do something similar as a smart pointer (but using references instead) ?
|
|
|
|