|
Protect from multiple inclusion:
#ifndef _MY_GROUP_H__
#define _MY_GROUP_H__
class Group
{
};
#endif
Yes Joaquin is right, function definitions in .H also cause such errors.
Maxwell Chen
People say "No news is good news". Then, no bug is good bug!?
|
|
|
|
|
thanks joan, thanks max . It was a big help. Yeah the problem is i implemented the constructor in the header file where as i should do it in cpp file.
Cheers
|
|
|
|
|
Hi,
We had several signal handling functions in C++ code under Unix platform.
SIGTERM - drain the requests, and shutdown
SIGHUP - A important signal handler in that it signals a reload of the data.
SIGUSR1 - drains the requests and shutdown.
It is our requirement to find functionality in the win32 world that would be analogous to signals in Unix.
we need to find Windows idioms for these functions, some type of ways to indicate to a process that we want it to drain requests and shutdown or reload data etc.
According to our understanding signal processing isn’t one of the Windows strong points.
We are in the process of finding alternatives to scope out a solution for signals in Windows.
Currently we do not have adequate domain knowledge.
Can you please provide us some directions in this regard?
Thanks,
-Sarma
|
|
|
|
|
There is 'signal()' function described in the MSDN, but I have never used it on Windows platform. If it will not help, try to map windows messages to your signals (I mean like WM_ENDSESSION to probably SIGTERM).
|
|
|
|
|
Do you want to detect or send signals? If the former, then there's a function signal analogous to UNIX. I've used it in the past to signal some appropriate event with SetEvent , which is then processed by routines in the main thread of execution.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello all,
I know this is not a C list but maybe you can give me some help.
Here is my problem :
I have this structure defined in file aaa.h
typedef struct _my_struct{
char str1[100];
char str2[100];
} my_struct;
in the file bbb.c I have a function like this :
void my_function(int x, my_struct *p_my_struct)
{
... /* doing something*/
}
in the coresponding header bbb.h I have the declaration of thefunction :
void my_function(int x, my_struct *p_my_struct);
how can I declare my_struct in bbb.h as being external ?
I've used "external struct my_struct" but it's not compiling. Later I've tried out all the possible combinations but still not compiling. I don't want to include aaa.h in bbb.h
TIA,
Thomas
|
|
|
|
|
Simply write:
extern struct _my_struct;
Maxwell Chen
People say "No news is good news". Then, no bug is good bug!?
|
|
|
|
|
Hi,
you probebly want to construct my_struct in one .c file and then use it in another .c file.
So if I correct the Wright way to do this:
1. First construct your my_struct in one .c file (lets say it will be call "TheStruct”).
Example :
my_struct TheStruct;
2. Now after you know you construct you my_struct go to other .c file
And declare on top of it "extern my_struct TheStruct;"
TheStruct is the same my_struct you construct in 1.
No Need To do that in .h files
Aizik Yair
Software Engineer
|
|
|
|
|
Hello Aizik,
Thank you for your answer. Unofrtunatelly it's still not working. Here is the code :
/* Main.c */
extern struct my_struct *TheStruct;
void main()
{
}
int my_function(int x, my_struct *p_my_struct){
printf("inside my_function\n");
}
/* Main.h */
int my_function(int x, my_struct *p_my_struct);
/* Second.c */
#include "Second.h"
my_struct *TheStruct;
/* Second.h */
typedef struct _my_struct{
char str1[100];
char str2[100];
} my_struct;
Thank you very much,
Thomas
|
|
|
|
|
Since you used a typedef you need not define that struct external in a function declaration. Only make sure you include the corresponding header file.
external refers to objects, not to types.
Best regards,
Alexandru Savescu
|
|
|
|
|
Alexandru Savescu wrote:
Only make sure you include the corresponding header file
Problem is that I don't want to include the header in order to avoid some circular references.
Thank you,
Thomas
|
|
|
|
|
In order to avoid ciruclar reference you must use the #ifdef declarations
[code]
#ifndef __HEADER_I_DONT_WANT_TO_BE_CIRCULAR
#define __HEADER_I_DONT_WANT_TO_BE_CIRCULAR
.... // all this header declarations
#endif
[/code]
Best regards,
Alexandru Savescu
|
|
|
|
|
You're perfectlly right Alexandru; this is the way I always do; yet my problem is not solved.
When using a pointer to the structure compilation is failling.
TIA,
Thomas
|
|
|
|
|
I have a need to have a single dialog containing a variant number of sub windows (sections). Each of these sections contains a number of controls such as scrollbars, edit boxes, etc. etc..
What would be the best way of doing this? My first thoughts suggested having the sections part as a frameless dialog class, but how can I then nest this dialog (or serveral of them) in my main dialog? Or am I going about this in the wrong way - should I be creating an ActiveX control for the sections or another method?
Dylan Kenneally
London, UK
|
|
|
|
|
CPropertySheet could do the job for you, if you do not require to see all the sub widows in one time.
|
|
|
|
|
Martin Ziacek wrote:
if you do not require to see all the sub widows in one time
I do need to see them all at once....
Dylan Kenneally
London, UK
|
|
|
|
|
This is just a suggestion. But I think your requirements can be handled by a frame window split into various views where each view is a CFormView derived class.
Regards
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
This sounds good to me, do you know of an appropraite CP / external articles on the subject Nish?
Dylan Kenneally
London, UK
|
|
|
|
|
Create some dialogs of property = "Child", and use
SetWindowPos(...)
to paste them onto your main dialog.
If you still don't understand, mail me and I will send you my sample code.
Maxwell Chen
People say "No news is good news". Then, no bug is good bug!?
|
|
|
|
|
Yes, this is how I have done it. Also set the Control property of the child dialogs.
|
|
|
|
|
there are several classes on this site that do something similar. my own is here. it's a dialog with sub-dialogs controlled by a tree.
-c
ABSURDITY:
A statement or belief manifestly inconsistent with one's own opinion.
|
|
|
|
|
I have a COM object which runs on IIS server. From within, I can't access files on another computers in Local network. But I needed to. So I thought about a workaround and created a thread with specified Scurity Attributes. That worked. Now (dunno why) I tried to create a usuall thread (using AfxBeginThread(&Test, NULL) ) and ..... inside this thread I could access files on other computers also!
Now here comes a question. Why it is so? And is this a security hole, or a feature that I can use in my programs?
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
How I understand you simply delegate security attributes from your workaround thread.
If windows security give you access to files on nearby computers then IIS thread also can do that.
Solution:
try to run IIS extensions by special user, which have special security settings in domain, then IIS will only have access to folders and computers were special security for such user is set.
Good Luck
|
|
|
|
|
Well, I think so too. But look, the main thread of COM object is also one of the threads of IIS (inetinfo.exe), but there I can't access files over network. And user settings for IIS are usual, IUSR_ComputerName, which has rights like Guest account (e.g. - no rights ). But a simple thread, opened from this COM object, looks like it has much more permissions... Dunno why. All I want to know right now, if I can use this feature, or maybe it will be fixed as security hole, lol
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
I have been having problems with visual studio being unable to save files correctly (keeps coming up with 'Another application is using the file') and have found the problem seems to be due to having Norton Utilities installed.
I have tried disabling NAVs auto protect, but nothing short of uninstalling Norton Utilities seems to help.
Has anyone got any ideas how to resolve this?
(I'm running Windows 2000, VS6 and Norton Systemworks 2002, on my WinXP system this seems to be less of a problem, but still occurs occasionally).
Thanks...
Blade[DMS]
|
|
|
|