|
xonobo wrote: want to ask whether is it possible to have a pointer whose type can change according to the input.
A void* can point to anything, but in turn it looses the information to what it is pointing.
You need to bundle this information with it.
In VB this is done using the VARIANT struct. That is a struct holding a type marker and a piece of memory.
Via a union, all datatypes are 'layered" above each other, using the same memory.
Failure is not an option - it's built right in.
|
|
|
|
|
Thanks a lot for your reply and ask: anyone knows a solution for C/C++?
|
|
|
|
|
You don't tell enough to get a solution to your problem.
What are you trying to accomplish and why can't this be solved in another way?
Does the (Microsoft specific) _variant_t help you?
Failure is not an option - it's built right in.
|
|
|
|
|
Thamks for your help. I thought VARIANT is only available in VB that's why I asked more. Now I will check _variant_t. Thanks again.
|
|
|
|
|
xonobo wrote: I thought VARIANT is only available in VB...
It's definitely not limited to VB.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Hi,
I have a MFC application and wish to change the way the application behaves when a user maximises the main window frame. I understand that I need to add a virtual function to the document class that inherits from the CDocument class. However, I am not sure what the name of the function is that is used when maximising the window. If you can tell me, that would be great.
Thanks !
|
|
|
|
|
the OnSize function takes UINT which identifies the minimise or maximise request.
that how ever is in MainFrm and View not Doc
example of an action based on minimised action.
void CMainFrame::OnSize(UINT nType, int cx, int cy)<br />
{<br />
if(nType == SIZE_MINIMIZED)<br />
{<br />
ShowWindow(SW_HIDE);<br />
}<br />
else<br />
{<br />
CFrameWnd::OnSize(nType, cx, cy);<br />
}<br />
}
hope that helps.
if im wrong about the document OnSize let me know please
|
|
|
|
|
Hi ya,
Thanks for your post. I actually found this
<br />
<br />
void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) <br />
{<br />
static const CPoint point0 = CPoint(0, 0);<br />
if(m_PageSize != point0)<br />
{<br />
const long my = lpMMI -> ptMaxSize.y;<br />
const long ty = lpMMI -> ptMaxTrackSize.y;<br />
lpMMI -> ptMaxSize = m_PageSize; <br />
lpMMI -> ptMaxTrackSize = m_PageSize;<br />
lpMMI -> ptMaxSize.y = my;<br />
lpMMI -> ptMaxTrackSize.y = ty;<br />
}<br />
<br />
CFrameWnd::OnGetMinMaxInfo(lpMMI);<br />
}<br />
<br />
in my code and put a break point on it when I clicked the maximise button. The code then stopped at the break point proving that this function is invoked when using max / min. I guess the structure should contain info whether the user is doing a max / min ?
Thanks
|
|
|
|
|
minkowski wrote: ...proving that this function is invoked when using max / min.
True, but that does not mean it is the only function involved in such a request. The WM_GETMINMAXINFO message is sent to a window when the size or position of the window is about to change. You can handle this message to override the window's default maximized size and position, or its default minimum or maximum tracking size.
The WM_SIZE message is sent to a window after its size has changed. Given your request of, "...change the way the application behaves when a user maximises the main window frame.", I'd opt for handling this message.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I NEVER TRIED, but you can test to handle the WM_ONSIZE Message
There you get the UINT nType, which you can test on if(nType == SIZE_MEXIMIZED)
I hope it's true what i say
Good luck
|
|
|
|
|
Hi
Yes, I am sure what you suggested will work (am implementing it now) as I found this example
<br />
<br />
void CMainFrame::OnSize(UINT nType, int cx, int cy)<br />
{<br />
CFrameWnd::OnSize(nType, cx, cy);<br />
CMenu* pmenu = GetMenu();<br />
<br />
if (nType == SIZE_MAXIMIZED)<br />
pmenu->EnableMenuItem(ID_FREEZE, MF_DISABLED|MF_GRAYED);<br />
else<br />
pmenu->EnableMenuItem(ID_FREEZE, MF_ENABLED);<br />
<br />
Draw<br />
}<br />
<br />
Thanks for your suggestion.
|
|
|
|
|
Is anybody know any free unicode xml lib/classes I can use?
|
|
|
|
|
What about using MSXML?
Steve
|
|
|
|
|
|
|
hi i m using inp32 and out32 function with inpout32 dll, when i read data status and control register of parallel port inp32 function return a value that i stored in a variable all the pin of parallel port have 5V current,now i am connect all the pins one by one to ground i find change in the value of status register but not in the control register,how can i get this.my computer is celeron,but when i did this on p4 i find the change, how can i do this on celeron ,i also enable ECP mode of parallel port but could not get requored result
hi
|
|
|
|
|
hi i think you should get you the documentation of the celeron chip to find which control registers should be set and what are the other requirements for them to be set to 0V when you shortcut them (maybe you need 2 lines somewhere) the fact that it worked on the p4 proves it is only a problem either of hardware or of how the functions are interacting with it and if you have a bit of time remaining learn punctuation.
|
|
|
|
|
Hi everyone,
In my application i am using a hell lot no. of list controls. So i have defined a CCustomListCtrl class derived from CListCtrl class. I have defined the NM and WM functionalities and other stuff in it and it runs just the way i want it. Now i want to define rest of the class derived from CCustomListCtrl. When i do this compiler gives an error
unresolved external symbol "public: virtual int __thiscall CCustomList::PreTranslateMessage(struct tagMSG *)" (?PreTranslateMessage@CCustomList@@UAEHPAUtagMSG@@@Z)
All the errors are related to the WM and NM .I guess the problem is in
BEGIN_MESSAGE_MAP(CCustomListCtrl, CListCtrl) macro. How do i remove this error.
|
|
|
|
|
Hi,
could you please post some code, so that we see how you define the rest of the class
Regards
|
|
|
|
|
It's not really much info you posted but check if the declaration and definition of the method PreTranslateMessage() is correct.
When I look at your BEGIN_MESSAGE_MAP macro your class seems to be called CCustomListCtrl but the definition of PreTranslateMessage() contains a class named CCustomList :
CCustomList::PreTranslateMessage(struct tagMSG *)
cheers,
mykel
OMM: "Let us be thankful we have an occupation to fill. Work hard, increase production, prevent accidents and be happy."
|
|
|
|
|
Hey thanks.. Great observation ...!!!
the error was there.. There was another class CCustomList which i delete because i completely messed up with.. Code is working fine now
|
|
|
|
|
You're welcome! Perhaps next time use search and replace when you rename your classes...
cheers,
mykel
OMM: "Let us be thankful we have an occupation to fill. Work hard, increase production, prevent accidents and be happy."
|
|
|
|
|
class to message map is incorrect
CCustomListCrtl <- Message map
CCustomList <- Class
this could be the problem
if it isnt a bit more code would help thanks
|
|
|
|
|
chaitannya_m wrote: BEGIN_MESSAGE_MAP(CCustomListCtrl, CListCtrl)
The Syntax here is
BEGIN_MESSAGE_MAP(Classname, Baseclassname)
Did you turn it around?
Failure is not an option - it's built right in.
|
|
|
|