Click here to Skip to main content
15,899,679 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Need source for WSAAsyncGetHostByAddr() Pin
Remus Lazar5-Jul-00 3:25
Remus Lazar5-Jul-00 3:25 
GeneralATL CImageList Pin
alainserge2-Jul-00 19:54
alainserge2-Jul-00 19:54 
GeneralRe: ATL CImageList Pin
Mike Dunn2-Jul-00 21:55
Mike Dunn2-Jul-00 21:55 
Question'CDateTimeCtrl' missing storage-class or type specifiers???? Pin
danielle2-Jul-00 9:48
danielle2-Jul-00 9:48 
AnswerRe: 'CDateTimeCtrl' missing storage-class or type specifiers???? Pin
Mike Dunn2-Jul-00 10:25
Mike Dunn2-Jul-00 10:25 
AnswerRe: 'CDateTimeCtrl' missing storage-class or type specifiers???? Pin
Blake Miller2-Jul-00 10:27
Blake Miller2-Jul-00 10:27 
GeneralGetting top window... Pin
Member 37471-Jul-00 11:56
Member 37471-Jul-00 11:56 
QuestionCMap restricted use? Pin
Nuno Tavares1-Jul-00 8:01
Nuno Tavares1-Jul-00 8:01 
Hello,

I've been trying to use CMap to create a hashing table of pointers to elements based on a class that specifies an unique coordinate.
Class CPonto (translates to CPoint) has 3 members: x,y,z of type UINT, and my CMap member should be able to give me a pointer to the object CMyObject if there is any at [x,y,z], or NULL if not.

Each unique coordinate refers to only one CMyObject, or NULL if it isn't ocupied.

I have declared my CMap member variable as follows:
[ccode]
#include <afxtempl.h>
CMap<cponto,cponto&,cmyobject*,cmyobject*> myWorld;
[/ccode]
However compilers generates:
[b]. D:\Program Files\DevStudio\VC\MFC\include\afxtempl.h(129) : error C2440: 'type cast' : cannot convert from 'class CPonto' to 'unsigned long'
. No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called[/b]

which jumps to a line containing
[ccode]
return ((UINT)(void*)(DWORD)key) >> 4;
[/ccode]
and it seems to my that my key has to be a sizeof() 4-bytes variable, which isn't explained by MSDN.

My main question is: Is it possible to have CPonto as KEY and ARG_KEY type? How?
Thinking of what error says: "No user-defined-conversion operator available that can perform this conversion"... Does it mean i can do that (programatically specify an automatic operator that converts CPonto to DWORD)? How?

Note: UINT types for CPonto members x,y,z could be of type BYTE, so it would fit in 3 of the 4 byte of DWORD, still, i don't know if CPonto's definition correctly aligns these members, but anyway, i bet it can be done, so i'm asking here. Also, i'm trying to use CMap to avoid certain limitations I have with other ways, mainly the resources needed only to reach a coordinate like (100,100,100) - memory - ie, there is no sense in using an UINT to store a XYZ coordinate like (500,500,500) if most of the times user can't reach it, right? I think that with CMap it would be possible.

If you can be of any help... Thanks in advance,
AnswerRe: CMap restricted use? Pin
Sam Hobbs2-Jul-00 21:17
Sam Hobbs2-Jul-00 21:17 
AnswerRe: CMap restricted use? Pin
Sam Hobbs2-Jul-00 21:31
Sam Hobbs2-Jul-00 21:31 
GeneralRe: CMap restricted use? Pin
Nuno Tavares3-Jul-00 0:56
Nuno Tavares3-Jul-00 0:56 
GeneralRe: CMap restricted use? Pin
Blake Miller3-Jul-00 7:01
Blake Miller3-Jul-00 7:01 
GeneralRe: CMap restricted use? Pin
Sam Hobbs3-Jul-00 8:17
Sam Hobbs3-Jul-00 8:17 
GeneralRe: CMap restricted use? Pin
Nuno Tavares9-Jul-00 5:41
Nuno Tavares9-Jul-00 5:41 
GeneralCool Menu Bar Pin
Member 39871-Jul-00 7:40
Member 39871-Jul-00 7:40 
GeneralRe: Cool Menu Bar Pin
Erich2-Jul-00 9:50
Erich2-Jul-00 9:50 
GeneralPrinting Dialog Box Pin
MFCDude1-Jul-00 4:09
sussMFCDude1-Jul-00 4:09 
GeneralRe: Printing Dialog Box Pin
Jeremy Davis2-Jul-00 22:23
Jeremy Davis2-Jul-00 22:23 
GeneralDialog in ATL object Pin
Magesh K.1-Jul-00 3:30
sussMagesh K.1-Jul-00 3:30 
GeneralRe: Dialog in ATL object Pin
Mike Dunn1-Jul-00 9:18
Mike Dunn1-Jul-00 9:18 
GeneralRe: Dialog in ATL object Pin
Magesh K.2-Jul-00 2:05
sussMagesh K.2-Jul-00 2:05 
GeneralRe: Dialog in ATL object Pin
Mike Dunn2-Jul-00 9:22
Mike Dunn2-Jul-00 9:22 
GeneralKey strokes Pin
Member 37471-Jul-00 1:28
Member 37471-Jul-00 1:28 
GeneralRe: Key strokes Pin
Mike Dunn1-Jul-00 9:22
Mike Dunn1-Jul-00 9:22 
GeneralInteresting Dialog problem Pin
Member 238630-Jun-00 17:13
Member 238630-Jun-00 17:13 

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.