|
Hello,
When I enter the left arrow key or the right arrow key nChar = 39 or 38 for the OnKeyDown() but nChar = 13 for OnKeyUp()
void CRICH::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
}
void CRICH::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
}
Why there is a change in nChar value for both the functions
Thanks
Pritha
|
|
|
|
|
What view base class were you using? It's entirely possible that the base class could be using PreTranslateMessage or something to alter the OnKeyUp handler?
I tried this with a view class derived from CView and the character code was always the same in OnKeyUp as in OnKeyDown.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hey thanks
But can you please tell me what is the use of PretranslateMessage(). I searched for it but didnt get any proper answer.
Pritha
|
|
|
|
|
See the documentation[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
Dear all,
I am facing quite an annoying problem I can't solve. I have a std::valarray<MyT>, where MyT can be anything, and I need slices of it to work locally on them.
If the elements MyT contained in the valarray are big (not to say HUGE), the usage of std::slice is quite inconvenient, since temporary copies of the objects are created in the slice.
Same problem in case MyT is small (let's say MyT = int), but the slice contains a large number of elements, let's say 1e4 or 1e5.
An approach using references would be much more efficient than std::slice in my opinion (+ it would allow to modify the elements contained into the valarray), but I don't know how to implement an object like this. The only alternative to that I have in mind is to use std::valarray<T*>, but I don't really like the pointer syntax and I'd prefer to avoid it.
Any suggestions, please?
Thank you in advance to anybody willing to help & best regards
|
|
|
|
|
What specific capabilities of valarray are you using that make you prefer it to std::vector? Because I'd tend to prefer using std::vector (which is, post-TR1, guaranteed to store its data as an array) and represent slices as pairs of iterators.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Well, from some performance test I made quite a while ago (using MSVC++ 2005) I noticed that reading/writing into a std::valarray was quite noticeably faster than using std::vector. Since I am working on a numeric application which has to handle quite large amounts of data, the fastest container seems the most natural choice. Apart from execution time, there are no other reasons.
Shall I re-run my performance test using a compiler better than MSVC++ 2005?
Stuart Dootson wrote:
using std::vector (which is, post-TR1, guaranteed to store its data as an array)
What does this sentence exactly mean? What would happen scanning a pre-TR1 std::vector with an iterator? Or, perhaps worst, using pointers? Access to wrong memory places?
Thanks a lot for your suggestions!
|
|
|
|
|
Presuming a pre-allocated vector, read/write times should be the same for a valarray or a vector, I believe.
Pre-TR1, vectors were not guaranteed to store their elements in contiguous storage. They did, because that was the only reasonable implementation. That guarantee was added to TR1, meaning that you could rely on it being true, rather than having to know what your particular STL implementation did.
misterMF wrote: What would happen scanning a pre-TR1 std::vector with an iterator? Or, perhaps worst, using pointers? Access to wrong memory places?
Iterators are fine - they're guaranteed to be, so long as you don't change the number of elements in the vector. Pointers? Practically, you'd be fine, but you couldn't guarantee that using the standard.
BTW - you'll probably also find significant performance improvements by turning off checked iterators[^]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks a lot for the explanations!
Stuart Dootson wrote: Presuming a pre-allocated vector, read/write times should be the same for a valarray or a vector, I believe.
That's what I believed too, but I remember I noticed differences for large size arrays. Now it's a bit too late( ), but tomorrow I'll re-check read/write times for valarrays and fixed-size vectors.
|
|
|
|
|
You can't have an array of references as far as i know. You could try having an array of objects who have references to your "MyT-s" maybe. But why don't you like pointers? You can create a reference out of a pointer wherever you need to access the pointed object if you don't want to use the -> operator.
MyT &mightyReference = *mightyPointer;
mightyReference.Hello();
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Yes, I know that it's not possible to have an array of references (unfortunately).
Maybe the solution is to have an array of pointers and then to use the trick you suggest to make these pointers to look like references.
By the way, it's not that I really hate pointers, but I think that while going on with code development I'll have to create objects able to intereacte either with valarray<MyT> or with its slices (with same rules and same results). An example can be the following:
std::valarray<MyT> A(20);
std::valarray<<MyT> > B(10);
slice<std::valarray<MyT> > C(A,parameters);
C += B;
Thanx!
|
|
|
|
|
I have a single .dll file: "LED.dll"
I had examined it with an app and I have it's function names and their inputs
I just want to call one of it's functions "SetAlwaysONOFF" in my program and i dont know anything about this stuff.
I have searched a lot but all of the tutorials are about how to create a dll or use a dll that has .h files with it and...
I dont anything about these stuff,
and i use visual studio 2003 (c++)
these are the led.dll functions(expotred from the app):
==================================================
Function Name : public: __thiscall CLED::CLED(void)
Address : 0x10001220
Relative Address : 0x00001220
Ordinal : 1 (0x1)
Filename : LED.dll
Full Path : C:\Program Files (x86)\ASUS\Direct Console\LED.dll
Type : Exported Function
==================================================
==================================================
Function Name : public: __thiscall CLED::~CLED(void)
Address : 0x100012a0
Relative Address : 0x000012a0
Ordinal : 2 (0x2)
Filename : LED.dll
Full Path : C:\Program Files (x86)\ASUS\Direct Console\LED.dll
Type : Exported Function
==================================================
==================================================
Function Name : public: unsigned long __thiscall CLED::SetAlwaysONOFF(unsigned long,int)
Address : 0x10001390
Relative Address : 0x00001390
Ordinal : 7 (0x7)
Filename : LED.dll
Full Path : C:\Program Files (x86)\ASUS\Direct Console\LED.dll
Type : Exported Function
==================================================
|
|
|
|
|
You mean you don't have any header file and any lib file with the dll ? Where did you get the dll from ?
I wanted to explain you how to load the dll and retrieve the function pointers dynamically but then I realized that the exported functions are from a class. As far as I know, there's no way for you to call these functions without using the lib file generated along with the dll.
|
|
|
|
|
ok the truth is this is a part of a program called "Direct console" -an app that controls side LEDs of my notebook "asus g50vt"- I want to write a little app so I can control my notebook's side LEDs without launching "Direct console", I searched the "Direct console" directory and I found LED.dll that has some intresting functions in it.
so i have no libraries, no headers and ...
I have another question, is there a way to find which dlls the "Direct console" accessing and with which functions and parameters, I mean some kind of monitoring tools?
and another one:is there an application that runs dll's functions without having to write a program?
this is a picture of g50vt's back token by my friend clutchx2:
|
|
|
|
|
The functions in question are (non-virtual) member functions of the CLED class. The simple answer to your question is that you need the header file (.h file) as the compiler needs information about the class (such as its size) to work with it. It's possible to get by without the vendor supplied header file in cases like these, but to do so requires a good understanding of how things work under the hood.
Steve
|
|
|
|
|
Hi all,
if Directory is empty its remove with this function CeRemoveDirectory,but if the directory have some files so its not working .
please tell me how can i remove directory with all existing files.
please help me for this.
if possible please explain me with example.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Recursively loop over the folder contents deleteing all the files individually. If you hit a file that is a folder, recurse and delete all the files therein and then you can remove the folder itself. Finally, remove the outer folder.
Acutally writing the code to do this is an exercise for the student and will teach you tons of stuff about files / folders / searches / etc. It will serve you well in later life.
|
|
|
|
|
"_$h@nky_" wrote: please tell me how can i remove directory with all existing files.
By using SHFileOperation() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
I am using Microsoft Visual Studio 2008.
I want to know how can we detect the memory leaks and Other Types Of Error while working in Microsoft Visual Studio 2008.
Is there any thing in the setting of the Microsoft Visual Studio 2008 so if I enable it I can easily get the Memory Leaks.
Like we have a tool BoundsChecker to find the Memory leaks,Unintialized Error,Pointer errors etc.
Or can I have some sought of Plug-in,like I have PC Lint,But that I alredy have.
Please do tell the steps to enable it in Settings.
Thanks
|
|
|
|
|
Check out _CrtDumpMemoryLeaks[^]
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Hi,
I am trying to compile this program with Visual Studio C++ 2008 as the compiler in Windows.
It is the program:
#include <stdio.h>
int main()
{
char texto[100];
gets(texto);
do {
printf( "%s\n",texto );
gets(texto);
} while ( strcmp(texto, "salir") != 0 );
fprintf( stderr, "El usuario ha tecleado 'salir'" );
}
It is the error message:
> .......program.cpp(11) : warning C4996: 'gets': This function or variable may be unsafe. Consider using gets_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
>c:\archivos de programa\microsoft visual studio 9.0\vc\include\stdio.h(279) : vea la declaración de 'gets'
> .......program.cpp(12) : error C3861: 'strcmp': no se encontró el identificador
--------
Could anyone help me?
|
|
|
|
|
I believe you need to #include<string.h>
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
|
/* strcmp example */
#include <stdio.h>
#include <string.h>
int main ()
{
char szKey[] = "apple";
char szInput[80];
do {
printf ("Guess my favourite fruit? ");
gets (szInput);
} while (strcmp (szKey,szInput) != 0);
puts ("Correct answer!");
return 0;
}
|
|
|
|