|
use OnKeyDown or OnKeyUp
You can read up about these functions on MSDN.
hope this helps.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
I am using onKeyUp member function only, but how to navigate in the list box according to the appropriate key.
Thank you,
Neelesh Jain.
|
|
|
|
|
test for VK_UP (VK_DOWN)
then you can set the selectitem (or SetCurSel) property or something of the listbox +1 or -1.
Look up the members for CListBox...
Good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Neelesh K J Jain wrote:
...in the list box...
In your original post, you indicated this was a listview, yet now you indicate it is a listbox. Which is it?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hello all,
needing to allocate a large number of buffers (let's say 20.000 buffers of
sizes between 8 and 200 bytes (I do not know their size at first)), which method would you recommend:
1. malloc (slow from my tests)
2. dlmalloc (Doug Lea's malloc replacement)
3. other
If your solution is a custom memory allocator, I need it to work on Win32
(e.g. Win9x included). I've done tests with dlmalloc and it seems pretty
fast. Perhaps an experience/advice of using it in the real-world would help.
Thanks.
Regards,
George Ionescu.
|
|
|
|
|
http://www.mathtools.net/C_C__/Memory_management/index.html[^]
Short of rolling your own with Virtual*() i was impressed with what i read about Hoard.
If you know the allocation size extents(8-200) and the pattern of allocations you should be able to write an optimized allocator that will outperform most generic implimentations.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Since you are using VC++, the choice should be the new operator.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi,
How to eliminate this warning?
warning C4652: compiler option 'Generate Browser Info' inconsistent with precompiled header; current command-line option will override that defined in the precompiled header.
pls help
Mithuna
|
|
|
|
|
I suggest you completely clean and rebuild your project. This should eliminate the warning.
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 Williams (Little Britain)
|
|
|
|
|
|
Hi,
I am developing a client server application with vc++.
I have the following 3 main classes
* PayrollDlg - This is the main dialog box
* WageDlg - This dialog box is accessible thru PayrollDlg
* AbsSocket - This class manages the networking aspect i.e creating a socket & sending , receiving data.
Now i need to create an object os AbsSocket that can be accessed from both PayrollDlg as well as WageDlg. Where do i declare this object to achieve this. If i declare the AbsSocket object in either PayrollDlg or WageDlg classes it becomes local to that class. What i actually want to know is where is the main() function as if i declare the AbsSocket object in this main it can be accessed anywhere right?
|
|
|
|
|
You can declare it as global in one cpp file and then declare it using extern in another
AbsSocket g_AbsSocket;
extern AbsSocket g_AbsSocket;
or if u want a cleaner way you can do this
class CGlobalVariables
{
static AbsSocket g_AbsSocket;
};
CGlobalVariables::AbsSocket g_AbsSocket;
and include this class in stdafx.h
then u can use it like
CGlobalVariables::g_AbsSocket
whereever u like
as for accessing the main function, in MFC it is buried deep under the classes of MFC u can't(shouldn't) access it
hope it helps
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
You could always derive PayrollDlg and WageDlg from a common class where AbsSocket is a member variable.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Using visual C++ 6.0, I have created a user drawn bitmap button and the up,down,focused,etc states and it works just fine. It's a red sphere, but I would like to be able to change it to blue,green,yellow,etc.
I've tried
m_pic1.AutoLoad(IDC_GREEN,this);
where GREEN is the "GREENU" sphere picture, but it just crashes during run time.
I think I may be really barking up the wrong tree.
B
|
|
|
|
|
I think I would use an imagelist.
Load all bmp's in there and switch accordingly.
hope this helps.
(eg. for setting an icon to a button I did this:
icon = (HICON)::LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_PRINT), IMAGE_ICON, 16, 15, LR_DEFAULTCOLOR);<br />
pPrintbutton->SetIcon(icon);<br />
I presume it's round about the same for a bmp)
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
--------------------Configuration: xt3 - Win32 Debug--------------------
Linking...
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in libcpmtd.lib(delop.obj)
xt3.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
xt3.exe - 2 error(s), 0 warning(s)
What causes this? And what should I do to fix it easily.
Thanks very much.
|
|
|
|
|
|
Linker Tools Error LNK2005
symbol already defined in object
The given symbol, displayed in its decorated form, was multiply defined.
Tips
One of the following may be a cause:
The most common cause of this error is accidentally linking with both the single-threaded and multithreaded libraries. Ensure that the application project file includes only the appropriate libraries and that any third-party libraries have appropriately created single-threaded or multithreaded versions.
The given symbol was a packaged function (created by compiling with /Gy) and was included in more than one file but was changed between compilations. Recompile all files that include the symbol.
The given symbol was defined differently in two member objects in different libraries, and both member objects were used.
An absolute was defined twice, with a different value in each definition.
This error is followed by fatal error LNK1169.
|
|
|
|
|
hi,
I'm a developper and i'm lookin for books oriented to non beginner on different subjects :
- comrehensive information on run-time librairies and their ideology (ie memory working, the dipatching of messages between objects and their ordonation, error enhancing with (very) old dlls)
- fuzzy logic
- neural networks
- algorythms of mostly used video and audio formats (compilable and shareware if exists)
- a comprehensive one on multithreading and if possible parrallelism
thanks if you can help me, being jobless i prefer stuff on line or in numereical form
styx
|
|
|
|
|
Hi,
I am new to VC++ and would like to know that if I have a C++ console
application and want to add it to a VC++ MFCAppwizard project, how do
I do it? The problem I am facing is thatwhen I add those .cpp files to
the project, I am unable to compile the code as the compiler
apparently is unable to resolve classes defined in the console
application. To give you the exact nature of the problem, I have a C++ console application which I want to import to VC++ and add forms and UI.
Is this problem something to do with "using namespace .."? I
would like to get some pointers on how to solve this problem.
Thanks.
Sid
|
|
|
|
|
It's highly unlikely that your default code is using namespaces, if you've put stuff in a namespace ( and good for you if you have ), then you just need a using statement to scope it. You should just be able to add your classes, unless your classes rely on libraries that your MFC project does not use, then you need to add them to the project settings. Again, unless you added them to the C++ console project, I don't see this being the case. What errors do you get ? It's kind of hard to help you fix a problem if I don't know what the actual problem is
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi,
May be very simple question, but I can't find the answer. Please help me.
class A{
public:
const int My_some_const;
int k;
A(int k_):k(k){};
}
class B:public A{
B(int k):A(k) //<---How to initialize Mysome_const without passing the value througth constructor of A????
}
Thanks in advance,
Boni
|
|
|
|
|
Boniolopez wrote:
How to initialize Mysome_const without passing the value througth constructor of A????
Why? What's wrong with using the constructor?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
The constructor of B must have the described signature (specific for the application)
|
|
|
|
|
Boniolopez wrote:
The constructor of B must have the described signature
Sorry, I still don't understand what the problem is. Are you saying you're not allowed to explicity call A's constructor?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|