|
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]
|
|
|
|
|
I have had compatibility problems between VS .NET and Zone Alarm firewall on an XP professional. And while I was searching the web for similar issues, I found that a lot of people have trouble with VS .NET and Norton Anti-Virus. I guess in your case it's VS 6 rather than VS .NET, but still the incopatibility might exist.
Regards
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Same here, but I don't much care. I can Ctrl-S again
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
Unfortunatly, on some occasions visual studio loses files when doing classwizard operations... (you have to dig into the temp directory to recover them)
and I get rather ...annoyed... when every time I hit build I get a requester saying 'unable to save file'...
(And our system admin is a little reluctant to allow us to run without a virus checker installed...)
Thanks for replying tho...
Blade[DMS]
|
|
|
|
|
I can't run Norton Or McAfee on my Visual Studio 6 PC. Norton keeps me from saving files all the time and blows up MSDev often. McAfee makes compiled so slow I can't stand it.
However, disabling the auto-protect works for me.
|
|
|
|
|
Matt Gullett wrote:
McAfee makes compiled so slow I can't stand it.
You might try to exclude your development directories from checking completely. That should (and back in NT4 and VC4.2/VC5 did for me) reduce the McAffe overhead to not noticable.
|
|
|
|
|
no solution, but... same here.
-c
ABSURDITY:
A statement or belief manifestly inconsistent with one's own opinion.
|
|
|
|
|
can anyone help me on how to use the stl qsort and if possible give me examples. i am try to use qsort so that i can sort out values from smaller value to higher values. how do i do that? anyways, thank you very much...
Thank you very much,
John
Aloha from Hawaii
|
|
|
|