|
Simply let your code be something like this:
file.cpp
#include "file.h"
struct{
int tagA;
int tagB;
};
setTagA(..){..}
setTagB(..){..}
getTagA(..){..}
getTagB(..){..}
Operation1OnStruct(..){..}
Operation2OnStruct(..){..}
....
OperationNOnStruct(..){..}
PublicOperation1OnStruct(..){..}
PublicOperation2OnStruct(..){..}
PublicOperation3OnStruct(..){..}
file.h
setTagA(..);
setTagB(..);
getTagA(..);
getTagB(..);
PublicOperation1OnStruct(..);
PublicOperation2OnStruct(..);
PublicOperation3OnStruct(..);
In this way the user can only use the public operations on the struct, but not the private ones because on the .h file you will put only declarations of public functions.
In file.cpp you have to define first the struct, then every function (public or private).
Important: the order!
First declare the struct and include the file.h , then define public and private functions.
the private functions on the cpp file can use each other ONLY if they calls function jet defined/declared. So the private Operation2OnStruct(..) can use Operation1OnStruct(..) but not OperationNOnStruct(..) . Then if you want add some prototipes of the private function at the beginning of the file.
Russell
|
|
|
|
|
Hi,
i include some headers to use sockets. The project works great, till now no problems.
Now, the IntelliSense will not work anymore.
My own classes and variables the IntelliSense shows the members and type, but
for example "accept(...);" it doesn't even know the function "accept" if i hit the F12 Key
Is there a special work to do, that IntelliSense works again?
Big thanks
|
|
|
|
|
Try some third party applications like Visual Assist[^]. I cannot think of coding with out it now a days( Very useful ).
|
|
|
|
|
Quite often this can be solved by closing your project, then delete the .ncb, .aps, and .clw files (they will be recreated when required).
Re-open the project and the .ncb is rebuilt and your intellisense may work again.
Good luck.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
I use CDC to draw a string in a control.
But it always draw extent to other controls,parent window,for example.
I only want to draw in its own client area.
How should I control to draw?
Thanks
GOOD LUCK
|
|
|
|
|
Use TextExtOut
Good luck!
Greetings from Germany
|
|
|
|
|
You can use DrawText. If not possible, apply a clip to the DC using SelectClipRgn.
- NS -
|
|
|
|
|
kcynic wrote: I use CDC to draw a string in a control.
Can you show me how you took the CDC ?
|
|
|
|
|
I think he got the problem of having CS_PARENTDC style.
- NS -
|
|
|
|
|
even if that style is present, if you take CClientDC or CWindowDC, it will apply the clilp so that the painting will not go outside that control.
Check the DCX_PARENTCLIP flag in the GetDCEx() function. CClientDC and CWindowDC calls this API with that flag.
|
|
|
|
|
The drawings should be in OnPaint. So the CPaintDC will be used. It is not having the clip.
Naveen.R wrote: Check the DCX_PARENTCLIP flag in the GetDCEx() function
It has NO use.
- NS -
|
|
|
|
|
NS17 wrote: The drawings should be in OnPaint
But he didn't mention so?
NS17 wrote: So the CPaintDC will be used. It is not having the clip.
And about the paint dc. I will all other parts that needn't to be updated in the current paint message. And offourse It will never allow you to draw on parent.
NS17 wrote: It has NO use.
Can u tell me why?
|
|
|
|
|
Naveen.R wrote: But he didn't mention so?
That I agree...
Naveen.R wrote: offourse It will never allow you to draw on parent.
Did you try it even once before?
Naveen.R wrote: Can u tell me why?
It is simply not working...
- NS -
|
|
|
|
|
the control is drived from CStatic.I use " CDC* pDC=GetDC();" to create the DC.
|
|
|
|
|
Simply the static control is having the CS_PARENTDC class style. That is reason of this issue. You can avoid the issue as I said before. Or you can remove this style from the class, which will solve the issue. But it is not promoted it because it will affect all the static controls.
- NS -
|
|
|
|
|
But How to remove such style?
|
|
|
|
|
Use SetClassLong( hWnd, GCL_STYLE, GetClassLong( hWnd, GCL_STYLE ) & ~CS_PARENTDC );
- NS -
|
|
|
|
|
Yes,it works well now.
Thank you very much.
|
|
|
|
|
Can you show your code how did you try to it?
|
|
|
|
|
Yes,I use CWindowDC,it works well,but CClientDC not.
Thank you all.
GOOD LUCK.
|
|
|
|
|
Hi All,
What is the difference between a parent and owner?
I have three functions
CWnd::GetParent ();
CWnd::GetOwner ();
CWnd::GetParentOwner ();
Please help.
Thanks,
NB++
|
|
|
|
|
In both cases, the parent or owner has been set as the parent of a control (e.g. SetParent(), or by specifying in the parent parameter of a Create() call).
The difference is that if the control was created with the WS_CHILD style, then the outer window is a PARENT. If it was created without this style, it is only an OWNER.
For a parent window, when the parent is minimized all child controls are hidden. For an owner only, 'owned' windows remain in place and can be minimized separately.
Note that only 'windows' can be owned - 'controls' *must* have a parent and are therefore created with WS_CHILD.
(GetParentOwner() will find the nearest window that is *either* a parent or an owner, but not a child - the others will keep walking up the chain until they find specifically one or the other.)
|
|
|
|
|
Hi,
I need to create an application that is shown in Windows Taskbar as a Toolbar, same as the Windows Media Player do.
I dont know where should I start.
Thanks in advance.
- NS -
|
|
|
|
|
search for Shell_NotifyIcon in msdn
i think this will help
Regards,
Pankaj Sachdeva
"There is no future lies in any job"
"but"
"future lies in the person who holds the job"
|
|
|
|
|
They are called deskbands. check Here[^]
|
|
|
|