|
Soitanly! Glad to help
Bob Ciora
|
|
|
|
|
To understand what is giong on, read this article[^].
Ylis wrote:
I don't have much experience with C++ in general so it could be something really basic.
I hope you don't mind a piece of advice Refrain from trying to learn how to make template libraries, at least at this stage of learning C++. This is the most complex area of a very complex programming language, and chances are you are never going to do it in practice anyway. Just learn how to use template libraries - start with STL and Boost; it is not hard, and it will improve your productivity significantly.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
I had been working for several years with Visual C++, when one day a friend of mine introduced me Visual Assist. Since then, I became a fan of it. It helped me to type code in a time saving way.
A month ago, I started to work in a new job, where the official compiler is Borland C++ 6. As the computer that I have should be in the Museum of Natural History, Borland's code completion takes a looooong time to find what I want to type. I have tried visual assist with MSVC++6 on that computer and it's as helpful as always, but MSVC++ is not allowed as code editor in this company.
So, the million dollar question is:
Is there any plugin, addon or similar that can help with code completion in a slow machine?
Answers are welcomed.
|
|
|
|
|
Hi. I am so new in .NET project devolopment.My question is :
I want to devolop a Windows Form Application that will uses SNMP libraries. But I couldnt find where the SNMP headers and libraries are.
İs there any one help me?
|
|
|
|
|
You may want to look at WinSNMP. See MSDN[^] for help.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
thanx for your helps.
May I ask a new one?
it is OK. But in msdn ı coulndt find which .h .dll include to my project
Can u help
|
|
|
|
|
You may need to install the Platform SDK.
Inside the include directory
winsnmp.h
IIRC the lib file is called
WSnmp32.lib
and it is inside the lib directory.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
I found that I cannot use CTime::GetCurrentTime(), as it is accurate to seconds only.
Is there another function I can use?
For example, I want to calculate the time elapsed in an operation, accurate to millisecond.
Thanks
|
|
|
|
|
Look at GetTickCount() function
|
|
|
|
|
Well I think that better would be to use the QueryPerformanceCounter and QueryPerformanceFrequency . AFAIK the GetTickCount in reality works in accuracy of 10 miliseconds (and even 55ms on 9x systems).
|
|
|
|
|
geo_m wrote:
AFAIK the GetTickCount in reality works in accuracy of 10 miliseconds
Do you know if this problem occurs also with the C function _ftime(struct _timeb *timeptr) , which should return something with a precision of a millisecond?
Fold With Us!
Sie wollen mein Herz am rechten Fleck, doch
Seh' ich dann nach unten weg
Da schlägt es links
|
|
|
|
|
K(arl) wrote:
Do you know if this problem...
It is not a problem, but a hardware limitation. Read here for more.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks for the link!
Fold With Us!
Sie wollen mein Herz am rechten Fleck, doch
Seh' ich dann nach unten weg
Da schlägt es links
|
|
|
|
|
Yes, that was true for old NT machines, running on the fastest processors few years ago.
Today, on average you get down to 1msec. (at most 2msec due to rounding problems) with GetTicCount(). (It is almost acurate on a Win2K, 2.4GHz. and even more with a WinXP 3.0GHz.)
-- Ricky Marek (AKA: rbid)
-- "Things are only impossible until they are not" --- Jean-Luc Picard
My articles
|
|
|
|
|
rbid wrote:
Today, on average you get down to 1msec.
What you are seeing is a mere approximation or simulation, not a true count. The system clock quantum, as described in the link I provided, is as accurate as you can get without introducing approximations.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have a .h and a .c file which have some subroutines I would like to call.
How should I add these 2 file to my MFC project?
Should I use add files or add class? (these two files are not a class)
also, they may be written in c, what should I do to ensure the compilation in VC++ is correct when compile c program in C++ project?
thanks
|
|
|
|
|
You must add the .c file, otherwise it won't be compiled and your program won't link. Adding the .h file is optional; IntelliSense normally works better if you do. Just use the Add Files feature to add them.
You don't need to do anything in VC6 to compile a .c file as C. The C/C++ compiler uses the extension to decide how to compile the file, unless you override it. The defaults for a new project in VS.NET include the /TP flag, which instructs the compiler to compile all files as C++. This is rarely an issue as C is a mostly-compatible subset of C++. There are a very few cases where the compiler will produce different code when compiled as C versus compiling as C++.
To turn this feature off in VS.NET, go to Project Properties, Configuration Properties, C/C++, Advanced and set Compile As to Default.
[EDIT] I forgot to mention how to use the functions. Simply #include the header file in any source file you want to use the functions in. [/EDIT]
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
when I use a modal dialog box (win32 DialogBox()), the application does not have a main message loop; instead, the application uses the dialog box manager message loop to translate and dispatch messages.
how can i handle the keyboard input or Accelerator Keys using win32 modal dialog box?
|
|
|
|
|
The solution is to add accelerator handling in your dialog. This isn't very difficult, and requires only a few steps:
1. Declare an HACCEL data member for your dialog:
HACCEL m_hAccel;
This will hold the handle to the accelerator table.
2. In your OnInitDialog , add the following statement:
m_hAccel = ::LoadAccelerators( AfxGetResourceHandle(),
MAKEINTRESOURCE(IDR_ACCELERATORS) );
The IDR_ACCELERATORS is the resource handle for your list of
accelerators. This can be the main set of application accelerators, or you can define only a subset of accelerators to use in your dialog.
3. Next, override PreTranslateMessage in your Dialog. It should look something like this when you're done:
if( (pMsg->message >= WM_KEYFIRST) &&
(pMsg->message <= WM_KEYLAST) &&
(m_hAccel != NULL) )
{
if( ::TranslateAccelerator(m_hWnd, m_hAccel, pMsg) ) return TRUE;
}
return CDialog::PreTranslateMessage(pMsg);
TranslateAccelerators will check the accelerator table indicated by m_hAccel and, if the key code specified by the pMsg is assigned to an accelerator, the function will generate an appropriate WM_COMMAND and send it to the window specified by m_hWnd .
Since the m_hWnd receives the WM_COMMAND, you may want to specify the main application window here (the parent of your dialog, easily obtained via GetParent() ). Alternately, if your Dialog only handles a subset of the application's accelerators, you can define a mini-accelerator table for your Dialog.
If you need to do this a lot, you may want to specify a thin class that derives from CDialog that is designed specifically to handle an accelerator table. Then you can derive your own dialogs from this base class.
Hope this helps!
Bob Ciora
|
|
|
|
|
Sorry Bob,
But your solution is for MFC. Torrentmoon and I both write in Win32 DialogBox application coding. This is different from your normal situation within MFC. In MFC and normal Windows class programming, you're right, one simply just has to override their message flow and toss in TranslateAccelerator() in it.
Unfortunately for us, Torrentmoon, I don't think we'll be able to do it. According to Microsoft: "A modal dialog box has its own message loop, which has no interaction with the application's main message loop." / http://support.microsoft.com/kb/126874[^]
I'll let you know if I hear anything about it, though.
V/r,
Suendisra
|
|
|
|
|
we already have a pointer string1 which accepts input at runtime. it is in Visual C++. The words in string1 has to be compared with a dictionary of words such as "i", "are", "the". How to initialise the dictionary as a pointer and store the values to be able to compare it with string1.
|
|
|
|
|
Maybe this little piece of code helps you. (I too hate working with strings in C++)
char* string1="are";
char* dictionar[3]={"I","are","the"};
for (int i=0;i<3;i++)
if (strcmp(string1,dictionar[i])==0) printf("%d",i);
Good luck!
Cristina
|
|
|
|
|
I seem to have a simple problem, but I didn't find a solution yet. So, please help me with any ideas.
I have a number, let's say X. I have its value.
I want to obtain in a C++ program, the (approximate) value of its cube root.
I thought I could approximate it with the function pow(number,1/3), but even cube root of 9 returns the value of 2.08008 which is too far from truth.
I know the problem is 1/3 which cannot be reprezented with accuracy because of its fractional part.
Do you have any other solution you can think of?
Thanks in advance,
Cristina
|
|
|
|
|
The cube root of 9, given to 5 decimal places (6 significant figures), *is* 2.08008. I can not see a problem with this.
Do you need more accuracy? Is the figure state the exact figure returned from the pow function?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
How to link functions in a .asm file?
Should I compile it first, and how to compile?
|
|
|
|