|
Stuart Dootson wrote: int twos_complemented_sum = -sum;
I don't think this is quite right. You first have to negate each bit of sum and then add 1.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Read this[^]. On an x86 architecture (and pretty much all other processors), negative numbers are represented using *2s complement*. Which means that the 2s complement of a number can be determined by applying the negation operator.
|
|
|
|
|
Stuart Dootson wrote: ...by applying the negation operator.
To each bit, not the whole number.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Do some simple examples with bit-patterns (the page I pointed you at had some examples using 4-bit numbers).
There's a difference between numeric negation (- ) and the bit-wise operator (~ ). ~ does indeed just invert bits, while - performs numeric negation, which does that and then adds one to the number - that'll be the 2s complement of the number you first thought of.
|
|
|
|
|
Perhaps the difference is sign and magnitude vs. two's complement.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
i want to integrate ms word in my asp.net web application like i want to use the ms word tools in my asp.net web applicaiotn like " bold, italic, alignment doc save...etc
plz help me its very urgent
Thabkx in advance
uniq_vyas@yahoo.com
|
|
|
|
|
You do realize there is an asp.net forum, right?
|
|
|
|
|
Well do you think your question has c++ answer?
|
|
|
|
|
Hi all,
I have a form,in that i have a static label ..i want to make it italic...as in c# we have a property in font section .. but i didnt find it in VC++,now onit screen i have to make it italic can any budy help me..
i googled it and find a link in code project .. but there is no source code for that ...
please help me here ....
vikas da
|
|
|
|
|
You can use of CreateFont(....DWORD fdwItalic,// italic attribute option,...) and then use of <code>SetFont for set font to your control.
|
|
|
|
|
can you please tell me how to set the font to my text..
CFont font;
font.CreateFont(16,0,0,0,FW_BOLD,TRUE,FALSE,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,DEFAULT_PITCH | FF_SWISS,"Tahoma");
i can have my static text like GetDlgItem(IDC_STATIC10);
can you help me again please...
vikas da
|
|
|
|
|
GetDlgItem(IDC_STATIC10)->SetFont(&font);
|
|
|
|
|
Hi. This Error is make me crazy please helpme.
I dont know where ir the IID_IADsUser
Thanks
ompiling resources...
Compiling...
StdAfx.cpp
Compiling...
ADFind.cpp
D:\Erith\PROGRAMING C++\ADFind\ADFind.cpp(45) : warning C4101: 'bstrName' : unreferenced local variable
Linking...
ADFind.obj : error LNK2001: unresolved external symbol _IID_IADsUser
Debug/ADFind.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
ADFind.exe - 2 error(s), 1 warning(s)
|
|
|
|
|
Please consider the following declarations:
class base1 {<br />
public:<br />
virtual int f1() = 0;<br />
};<br />
<br />
int<br />
base1::f1()<br />
{<br />
return 1;<br />
}<br />
<br />
class dev1 : public base1 {<br />
public:<br />
int f1();<br />
};<br />
<br />
int<br />
dev1::f1()<br />
{<br />
return 2;<br />
}
Since the class base1 cannot be instantiated, is there anyway to call base1::f1()? If so, please tell me how?
Thanks
Bob
|
|
|
|
|
what about calling the base class in the derived method of f1 ?
int dev1::f1()
{
return base1::f1();
}
This signature was proudly tested on animals.
|
|
|
|
|
Thanks for the response and your response works. I just checked it. I should have thought of that myself.
Bob
|
|
|
|
|
Yes! You could call it by using the pointer of derived object. For instance,
dev1* pDerived = new dev1;
pDerived->base1::f1();
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi everybody...
this is my first question here,... hope someone can help me!
I have following problem: I have programmed an own file transfer protocol for a network,
but i do not check the rights for accessing directories; the groups are organized with active directory, so i need to check if the user is allowed to access the directory, which he requested.
I have never worked with active directory before, so i am a absolutely newbie!
But i am learning fast, so if someone could tell me how to get the directorie's, which the logged on user is allwowed to access i would be proud of it!
You could also also help me, by answering this question:
How can I read the yet blue database, so i could read the active directory database and check it with a own function... But mybe someone knows a better way to solve my problem,...
If you do so please answer this question!
Greetz BI0sSt@R
|
|
|
|
|
Hi folks,
I'm in a bit of a pickle here. I have been working on a dll that runs in debug and also runs in release mode when the executable is started from Visual Studio, but it causes a crash when invoked from the command prompt.
I have did my homework and read a lot of useful information on this site as well as others but failed to find the culprit.
I can go as far as dumbing down the code so much that commenting a single line makes it run. I'm using a map container.
I can also post the header file, but first I thought that someone might be able to offer some insight about map containers gotchas...
Here is the code:
typedef std::map<int,> ObjectMap;
ObjectMap s_objectMap;
CLINKAGE
DLLFUNC void STDCALL SOMEFUNCTION(int *id, int *init)
{
ObjectMap::const_iterator it = s_objectMap.find(*id);
if (*init)
{
if ( it == s_objectMap.end())
{
int ti = (int)s_objectMap.size()+1;
mbdObject *pTheObject = new mbdObject(ti, id);
}
}
}
basically if I comment out the creation of the new object the code would not do anything useful but it would run. As soon as the 'new' operator is back in. BOOM....
Any help *greatly* appreciated!
Andrea.
|
|
|
|
|
Try putting Messageboxes or writing a log in the code to see where your code gets, maybe it dies in the contructor of that object or later when the object is used.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
bingo.. it crashes in the constructor. nothing to do with maps apparently.
I'll have to take a close look. thanks for the suggestion that got me further ahead...
andrea.
|
|
|
|
|
Member 3694270 wrote: it crashes in the constructor
In that case, Check for uninitialized variables/ Garbage values. That can cause trouble in release version.
And this article will be helpful - Surviving the Release Version.[^]
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
modified on Wednesday, December 3, 2008 3:11 PM
|
|
|
|
|
I would like to change the title of the frame window created by AVI capCreateCaptureWindow function.
I have a slow video capture application and would like to see title change after each frame is processed.
So far I have been unsuccessful.
Any constructive help is as always appreciated.
Thanks for reading
Cheers
Vaclav
<div class="ForumMod">modified on Wednesday, December 3, 2008 4:51 PM</div>
|
|
|
|
|
What have you tried?
SetWindowText()/WM_SETTEXT should work if you're providing the correct HWND.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
here is my code snippet and the error I get after the test run of SetWindowText.
As always - my text is not showing the derefference "->" correctly, but it is there!
m_hWnd = capCreateCaptureWindow(_T("Preview - AVI frame "),
WS_CHILD|WS_CLIPSIBLINGS | WS_CAPTION | WS_VISIBLE | WS_MAXIMIZE |WS_MAXIMIZEBOX |WS_MINIMIZEBOX , x, y, 100,200,
pParentWnd?pParentWnd->GetSafeHwnd():NULL, 0xffff);
VERIFY(m_hWnd);
m_hWnd->SetWindowText(_T("Ready for AVI frame "));
error C2039: 'SetWindowTextA' : is not a member of 'HWND__'
|
|
|
|