|
ThatsMe. wrote: ...the OnInitialUpdate function is not working.
Which means what exactly?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi
I am working in complete 'C' environment on UNIX. I have to convert signed char and signed char* to unsigned char and unsigned char* respectively.
I have read that using (unsigned char) is not very safe and can cause.
Please suggest me any way I can do this conversion. Is there some function I have to write?
Please help
think because thats what matters
|
|
|
|
|
vikramaditya234 wrote: I have to convert signed char and signed char* to unsigned char and unsigned char* respectively.
Cast to appropriate type! E.g.
signed char SignedChar = 'A';
unsigned char UnsignedChar = (unsigned char)SignedChar;
signed char* pSignedChars = "ABCDEDF";
unsigned char* pUnsignedChars = (unsigned char*)pSignedChars;
vikramaditya234 wrote: I have read that using (unsigned char) is not very safe and can cause.
Normally signed chars are used for string operations and unsigned chars are used as bytes. In windows a BYTE is an unsigned char! signed chars normally have NUL termination and unsigned chars are normally accompanied by their length, since users of such an array don't have an idea where it ends! So how safe it is depends on how you code!
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
modified on Thursday, April 3, 2008 11:41 PM
|
|
|
|
|
i cant afford to use the type cast. please suggest me something else
think because thats what matters
|
|
|
|
|
vikramaditya234 wrote: i cant afford to use the type cast
Why?
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
vikramaditya234 wrote: i cant afford to use the type cast. please suggest me something else
You're right, there is no need to cast stuff here as they basically are just different representation of the same data. It should work without having to cast, for example:
char C = '-';
unsigned char U = C;
char *c = new char;
*c = 'a';
unsigned char *u = new unsigned char;
*u = *c;
Are you getting a compile time error or something? Could you show us what and how you are exactly trying to do?
The signed attribute would matter to you, only if you are performing some kind of arithmetic operations on it.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: You're right, there is no need to cast stuff here as they basically are just different representation of the same data.
I don't agree. If you don't explicitely cast for the first case (char to unsigned), you'll get a warning because data might be lost. So, for me putting an explicit cast would mean "Yeah, I know that data might be lost but I know what I'm doing (e.g., that will never be the case here)".
For the second case (pointers), you'll get an error because type pointed are unrelated.
|
|
|
|
|
I also said that it the signed and unsigned property would matter if you perform some kind of arithmetics (in case you may be worried about the data loss).
Cedric Moonen wrote: For the second case (pointers), you'll get an error because type pointed are unrelated.
You mean the code I provided will produce an error during compilation? Please try it. It should compile.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Or, is this what you missed?
vikramaditya234 wrote: I am working in complete 'C' environment on UNIX.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Ow, yes, maybe that get lost somewhere between my eyes and my brain
|
|
|
|
|
Too much of C++ and you really forget the kind of 'freedom' (of course along with its side effects) that C offers.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I thank you all for giving your response.
I do like to add i strictly cant use typecasting to change char* to unsigned char* and vice-a-versa the unsigned variables mostly contain numerics and cant afford to loose any data.
Is there however a way to typecasting without the regular (unsigned char*) and (char*)
think because thats what matters
|
|
|
|
|
I used the following code to change the alignment of an edit box:
<br />
::SetWindowLongPtrW(m_ctlMean.GetSafeHwnd(), GWL_EXSTYLE, WS_EX_LEFT);<br />
::SetWindowPos(m_ctlMean.GetSafeHwnd(), NULL, 0, 0, 0, 0, SWP_NOMOVE<br />
|SWP_NOOWNERZORDER|SWP_NOSIZE);<br />
where m_ctlMean is a variable of type CEdit...
But the alignment has no change!
Where have I done a wrong?
modified on Thursday, April 3, 2008 4:02 PM
|
|
|
|
|
Usef Marzbani wrote: Where have I done a wrong?
When you failed to read the documentation.[^]
led mike
|
|
|
|
|
Also note in the documentation (and when you are using the correct style):
"After the control has been created, these styles cannot be modified, except as noted."
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Also note in the documentation
What, you mean you have to read all that stuff? Can't Tank just download it to me?
led mike
|
|
|
|
|
Is this what your trying to do?
LONG style=::GetWindowLong(m_edit.m_hWnd,GWL_STYLE);
style &= (~(ES_RIGHT|ES_CENTER|ES_LEFT));
style |= ES_LEFT;
::SetWindowLong(m_edit.m_hWnd,GWL_STYLE,style);
::SetWindowPos(m_edit.m_hWnd, NULL,0,0,0,0,SWP_NOMOVE|
SWP_NOOWNERZORDER|SWP_NOSIZE);
m_edit.Invalidate();
|
|
|
|
|
Or something like this?
m_edit.ModifyStyle(ES_RIGHT|ES_CENTER|ES_LEFT,ES_LEFT);
m_edit.Invalidate();
|
|
|
|
|
Hi Everyone,
There are lot of sample code for developing a custom toolbar for IE. But none for Windows Explorer . Why?.Can anyone help with a sample code for developing a toolbar for Windows Explorer?.
thanks
Nitheesh
|
|
|
|
|
Try seaching on Shell Extensions instead of toolbars.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></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! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
In IE 6 and earlier, Explorer can use toolbar extensions just like IE (since they're really the same app).
|
|
|
|
|
Click here[^]
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
I have a project that is used in control and acquisitions of a system with camera and stage motor to to move the slide.
Now i am trying to optimize the system, where in i need include status function displaying the current image being scanned by camera now heres the issue although the status functions works fine but it is never displayed cause the loop runs so fast that although the dialog box pops up it is blank and cant see data in it now i need a way in which i can make the loop stop and make sure that it displays dlg box and then return to next image acquisition without too long delay. could one suggest tips. any help is highly appreciated.
regards
sunny
|
|
|
|
|
You should probably be using separate threads for the UI and the acquisition loop.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Sunny, perhaps you could resolve your problem using a pomp of messages in the loop that hocks as heavily the application.
// Pompa dei messaggi
MSG msg;
while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
theApp.PumpMessage();
|
|
|
|