|
Now i foudnd something that can prove
++i is better then i++.
this is in the case ur passing a argument
to a function in my case the fun name is
add. So ++i i better as it donot create any
temp variable to store . As the value is
need to be incremented first . But in the
late case the value have to be incremented
afterwards so a temp variable is needed..
Assmebly code to prove my words
U r wrong the case is vice versa
Tough to Belive
Assembly code to prove my observations
<br />
507: Add(++i);<br />
004010CE mov eax,dword ptr [ebp-4]<br />
004010D1 add eax,1<br />
004010D4 mov dword ptr [ebp-4],eax<br />
004010D7 mov ecx,dword ptr [ebp-4]<br />
004010DA push ecx<br />
004010DB call @ILT+15(Add) (00401014)<br />
004010E0 add esp,4<br />
508: Add(i+1);<br />
004010E3 mov edx,dword ptr [ebp-4]<br />
004010E6 add edx,1<br />
004010E9 push edx<br />
004010EA call @ILT+15(Add) (00401014)<br />
004010EF add esp,4<br />
506: Add(1+i);<br />
004010CE mov eax,dword ptr [ebp-4]<br />
004010D1 add eax,1<br />
004010D4 push eax<br />
004010D5 call @ILT+15(Add) (00401014)<br />
004010DA add esp,4<br />
507: Add(i++);<br />
004010DD mov ecx,dword ptr [ebp-4]<br />
004010E0 mov dword ptr [ebp-5Ch],ecx<br />
004010E3 mov edx,dword ptr [ebp-5Ch]<br />
004010E6 push edx<br />
004010E7 mov eax,dword ptr [ebp-4]<br />
004010EA add eax,1<br />
004010ED mov dword ptr [ebp-4],eax<br />
004010F0 call @ILT+15(Add) (00401014)<br />
004010F5 add esp,4
I dont know but how i+1 is more effecient to
pass then i++ or ++i
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Can anyone please giv me the simple code for building modeless dialog box in win 32 application.
Thanks and regards,
pooja
|
|
|
|
|
A good but simple example from Nishant Sivakumar...
http://www.codeproject.com/dialog/gettingmodeless.asp[^]
Apart from this a small example is given here...
CDialog dialog;
dialog.Create(IDD_YOUR_DIALOG_TEMPLATE, this);
dialog.ShowWindow(SW_SHOW);
Jesus Loves You and Me <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
use DialogBox api in win32 or create a dummy win32 application and see how the about dialog box is launched.
<hr<span style="color:gray;size:15px;">-Prakash
-Prakash
|
|
|
|
|
How can I know if there is a Floppy disk in the Floppy drive?
Jesus Loves You and Me <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
|
He he, At last...
Thanks, Buddy...
God Bless You.
Jesus Loves You and Me <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
But there is nothing about floppy drive...
Jesus Loves You and Me <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Do you already know the drive letter of the floppy drive?
If so, then try GetVolumeInformation
And heed this warning:
When a user attempts to get information about a floppy drive that does not have a floppy disk, or a CD-ROM drive that does not have a compact disc, the system displays a message box for the user to insert a floppy disk or a compact disc, respectively. To prevent the system from displaying this message box, call the SetErrorMode function with SEM_FAILCRITICALERRORS.
Marriage slows down your coding, a baby slows it down even more!
|
|
|
|
|
What is the difference between using __try/__except and try/catch? Can one be used in place of the other, anytime? Are there cases that are handled better by only one of them?
thanks!
|
|
|
|
|
AFAIK, try/catch is the Standard C++ way of exception handling. It's guaranteed to work in all platforms. __try/__except is a Windows specific extension for Structured Exception Handling (SEH). It is typically used to catch problems like access violation, stack overflow etc. which are outside the bounds of standard C++.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
In Microsoft C++,
identifiers with two leading underscores are reserved for compiler implementations. Therefore, the Microsoft convention is to precede Microsoft-specific keywords with double underscores. These words cannot be used as identifier names.
for ur code to be portable ensuur that u replace
the microsoft specific keywords
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Hi.
Can anyone tell me how to upload an indexed palette image into opengl to use as a texture?
Thanks in advance.
|
|
|
|
|
Hi,
I am working with Visual Studio .NET 2003 and everything worked fine until...
I added a new dialog and tried to create a new CDialog class to attach to it by either double clicking on the dialog frame or right click and "Add Class".
When I fill in the class name and base class and hit OK, nothing happens and the new class is not created anywhere. I don't see any error messages as well.
I tried multiple names, but nothing works.
I can do it manually but this takes longer to do...
Thanks in advance,
Shay
|
|
|
|
|
I've just done this and successfully added the dialogue box and a class (by right clicking on it and using the context menu) so I don't think it's a bug.
Which version of Visual Studio .NET 2003 are you using? I'm using 7.1.3088 (Click Help=>About Microsoft Visual C++ 2003).
|
|
|
|
|
got the same version.
I was able to add dialog classes but from some reason I can't do it anymore on this project (other projects are good).
The "bug" is that I see no error message and the new class is not created...
Shay
|
|
|
|
|
Problems of this type usually signal that one or more of the temporary files that Visual Studio creates has been corrupted.
Exit Visual Studio. Look in the folder containing your project file project.vcproj . Delete any files named project.ncb or project.aps . This is safe to do, since Visual Studio will re-create them as needed.
Software Zen: delete this; // <a href="http://www.codeproject.com/script/profile/whos_who.asp?msg=1307432&id=10338#xx1307432xx" rel="nofollow">Fold With Us!</a>[<a href="http://www.codeproject.com/script/profile/whos_who.asp?msg=1307432&id=10338#xx1307432xx" target="_blank" rel="nofollow" title="New Window">^</a>]
|
|
|
|
|
I already did the work manually but thanks a lot for the info.
This had happen more than once so next time I will try this trick.
shay
|
|
|
|
|
OK, I have been developing an interface for editing records in our database.
I want to set it up as a control that I can use in other applications I
build. I am using databinding to tie the fields to my controls, such as
labels and textboxes.
I can create a solution for a stand alone application that runs like I want,
but whenever I create a solution for a control, then none of my data shows
up. I have tried making C++ controls (the language I am familiar with) and
VB and even C#. I get the same result: The interface compiles and displays
as designed, but no data.
When I add the control to the toolbox, I get the control plus a dataset and
adapter, but no databinding control.
|
|
|
|
|
I'm new to C++ so forgive my confusion.
Could someone please give me an overview how to use a DLL in VC++.
I got a DLL for a TreeView control with checkboxes from this site (QuickFilter.dll) for filtering some data but i don't know how to get the methods of the control. I can't even create the control.
Please help me.
|
|
|
|
|
In Win32 API...
Are there any OS funcs for printing out the addresses of each function called in turn
right up until now (where my app died)
?
Thanks in advance
...Steve
|
|
|
|
|
or even just the os function to call to terminate your app and show the usual
error dialog that'll get you to a stack trace, etc...
When I call ExitProcess(), it just dies silently (which is what I USUALLY want)
|
|
|
|
|
Take a look at this excellent tool[^].
The two most common elements in the universe are Hydrogen and stupidity. - Harlan Ellison
Awasu 2.2 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
Cooooooool. Thanks - I thought the answer would be around here somewhere.
Just didn't know where
Thanks mucho!
...Steve
|
|
|
|
|
This is to document a solution with CWnd::MoveWindow and CWnd::Create when you have to position your window at a point larger than 32768 in the parent view.
A little background first:
I was trying to position my CmyView objects in a CScrollView object and everything worked as expected up until the point that the vertical location of the new CmyView object was going to be larger than 32768. At this point all the rest of the CmyView objects were being placed on top of themselves. The first 1800 or so CmyViews were placed in the CSrollview correctly but the last 1800 were just drawing on top of each other.
After at least 3 days of trying to figure out what I was doing wrong I came to the conclusion that the MS code is wrong. I can trace the calls through ::CreateEx, ::MoveWindow but I not no nothing about debugging assembled code so that is as far as I could trace it. If you tell the window to move to a vertical position of say 40,000, this is passed all the way through what I can follow in the code through CWnd::MoveWindow. But if you get the position of the window as the next call (and adjust it for screen coordinates) you find that the actual moveWindow call didn't place the window correctly.
At first I thought it was because all the calls use int as the "lowest" level type, but even an int can be larger than 32768.
Workaround:
I had to create a "Holder view" and place that in the CSrollView prior to placing all the CmyView objects into the CHolderView. BUT (this is the important part) the CWnd::Create call to create the Holder (which is a CWnd object) has to be large enough to hold all the CmyView object INITIALLY! If you try to resize it with MoveWindow it also fails to resize correctly.
Workaround:
I had to create a "Holder view" and place that in the CSrollView prior to placing all the CmyView objects into the CHolderView. BUT (this is the important part) the CWnd::Create call to create the Holder (which is a CWnd object) has to be large enough to hold all the CmyView object INITIALLY! If you try to resize it with MoveWindow it also fails to resize correctly.
Chris
|
|
|
|