Click here to Skip to main content
15,905,971 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How can i lock the internet from a C++ program Pin
David Crow18-Sep-08 5:21
David Crow18-Sep-08 5:21 
JokeRe: How can i lock the internet from a C++ program Pin
Iain Clarke, Warrior Programmer18-Sep-08 5:22
Iain Clarke, Warrior Programmer18-Sep-08 5:22 
AnswerRe: How can i lock the internet from a C++ program Pin
Bram van Kampen18-Sep-08 14:55
Bram van Kampen18-Sep-08 14:55 
QuestionRatio result placing a square not working - when resizing window Pin
simon alec smith18-Sep-08 5:01
simon alec smith18-Sep-08 5:01 
QuestionRe: Ratio result placing a square not working - when resizing window Pin
David Crow18-Sep-08 5:26
David Crow18-Sep-08 5:26 
AnswerRe: Ratio result placing a square not working - when resizing window Pin
simon alec smith18-Sep-08 5:30
simon alec smith18-Sep-08 5:30 
AnswerRe: Ratio result placing a square not working - when resizing window [modified] Pin
Iain Clarke, Warrior Programmer18-Sep-08 5:29
Iain Clarke, Warrior Programmer18-Sep-08 5:29 
AnswerRe: Ratio result placing a square not working - when resizing window Pin
Mark Salsbery18-Sep-08 5:56
Mark Salsbery18-Sep-08 5:56 
In addition to DavidCrow's reply...

simon alec smith wrote:
widthRatio = Rect.Width() / 756;
then * the x posistion by the widthRatio


When working with integers like this, you can often rearrange the
calculation to avoid getting the 0. Do the multiply first, then the
divide. This way you can avoid floating point types which can give better
performance in certain situations.

Of course, if you need the ratio variable in other places, then you'll
need to make sure you do a floating point calculation as DavidCrow showed.

Mark

Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

QuestionWinInet issue Pin
George_George18-Sep-08 4:16
George_George18-Sep-08 4:16 
QuestionDrawing wider dashed lines Pin
softwaremonkey18-Sep-08 2:18
softwaremonkey18-Sep-08 2:18 
AnswerRe: Drawing wider dashed lines Pin
Cedric Moonen18-Sep-08 2:35
Cedric Moonen18-Sep-08 2:35 
GeneralRe: Drawing wider dashed lines Pin
softwaremonkey18-Sep-08 4:44
softwaremonkey18-Sep-08 4:44 
QuestionCSpinButtonControl : undeclared identifier. Pin
tenwang18-Sep-08 2:09
tenwang18-Sep-08 2:09 
AnswerRe: CSpinButtonControl : undeclared identifier. Pin
tenwang18-Sep-08 2:11
tenwang18-Sep-08 2:11 
AnswerRe: CSpinButtonControl : undeclared identifier. Pin
KarstenK18-Sep-08 2:13
mveKarstenK18-Sep-08 2:13 
GeneralRe: CSpinButtonControl : undeclared identifier. Pin
tenwang18-Sep-08 2:19
tenwang18-Sep-08 2:19 
QuestionRe: CSpinButtonControl : undeclared identifier. Pin
Roger Stoltz18-Sep-08 2:20
Roger Stoltz18-Sep-08 2:20 
AnswerRe: Pin
tenwang18-Sep-08 18:39
tenwang18-Sep-08 18:39 
AnswerRe: Pin
Roger Stoltz18-Sep-08 21:29
Roger Stoltz18-Sep-08 21:29 
GeneralRe: Pin
tenwang18-Sep-08 21:51
tenwang18-Sep-08 21:51 
AnswerRe: Pin
Roger Stoltz18-Sep-08 22:16
Roger Stoltz18-Sep-08 22:16 
GeneralRe: Pin
tenwang18-Sep-08 23:12
tenwang18-Sep-08 23:12 
Questiongethostname() function returns errror Pin
Anu_Bala18-Sep-08 1:38
Anu_Bala18-Sep-08 1:38 
AnswerRe: gethostname() function returns errror Pin
Roger Stoltz18-Sep-08 1:55
Roger Stoltz18-Sep-08 1:55 
GeneralRe: gethostname() function returns errror Pin
Anu_Bala18-Sep-08 2:11
Anu_Bala18-Sep-08 2:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.