|
Hi everyone.
I need to globally monitor the entire system for the message WM_SETFOCUS (to notify when the user change the parent/child window focus on any process of the system)
Any idia what type of hook should i use ? (WH_KEYBOARD, WH_SYSMSGFILTER or WH_MSGFILTER...)
and how the hook procedure should be:
should I cast the LPARAM to CWPSTRUCT, like this:
<br />
CWPSTRUCT *cwpStruct = (CWPSTRUCT *)&lParam;<br />
if (cwpStruct->Message == WM_SETFOCUS)<br />
....<br />
Is that right ?
Any help would be appreciated.
|
|
|
|
|
I'm having an annoying link error:
Linking...
Source.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in DataInput.obj
cCrypt.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in DataInput.obj
Debug/Student Data.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
Student Data.exe - 3 error(s), 0 warning(s)
Before anybody states the obvious yes I do know what it means. I have char Password[50]; defined in cCrypt.h as a global variable. It is referenced as extern char Password[50]; in DataInput.h, and not even mentioned in Source.h. All my header files have the appropriate #ifdef #endif blocks, yet the compiler will not let me build.
I have had this error in the past, the only fix I could find was to rename the variable, try to compile (still with the errors) then rename it back. The link errors magicaly went away, but it is not working this time. Strange thing this time, if I declare it in Source.h and refrence it in the other files, it gives me no problems. But there is no need for it to be in the Source.h.
Is this a common problem? Bug in Visual Studio? how to get rid of it?
|
|
|
|
|
|
Yes I read this quite some time ago, along with all the other reports on this error. I managed to rid the link error by declaring it as static. But now I am having problems initialising it.
I'm using a dialog box for the user input of a password. I pass this Password viariable in a SendMessage to an edit box, get the password, then call EndDialog passing the string length as the return val. Strange thing is, even though there is now text in the variable, the Dialog box returns 0. To make things even more confusing, on checking the Password variable, immediatly after the dialog has ended, it has no memory address.
I have had enough of VS6, I seem to spend more time trying to find the cause of stupid errors than I do coding.
|
|
|
|
|
Linking...
cParse.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in cCrypt.obj
DataInput.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in cCrypt.obj
Print.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in cCrypt.obj
Source.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in cCrypt.obj
cParse.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in cCrypt.obj
DataInput.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in cCrypt.obj
Print.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in cCrypt.obj
Source.obj : error LNK2005: "char * Password" (?Password@@3PADA) already defined in cCrypt.obj
Debug/Student Data.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
Student Data.exe - 9 error(s), 0 warning(s)
@$^* MS *^$%#& VS **(%^ Bill ^& Gates $^%
|
|
|
|
|
Hi waldermort,
Nothing better than is in MSDN(more symbols)
Do you test /FORCE or /FORCE:MULTIPLE ?
(I had this problem but I can't find this problem in my program excatly like you)
I dont find so I created this error!!
ppp error LNK2005: "int a" (?a@@3HA) already defined in ppp.obj
I insert /FORCE then in (property)
ppp warning LNK4006: "int a" (?a@@3HA) already defined in ppp.obj; second definition ignored
Now this program is run
--------------------------------------------------------
I created a program and I declare a variable in header program(ppp.h)
then I insert a file cpp(exmplae test) and insert include from main program(ppp.h) and I get this error.
maybe it is some helpful to you
|
|
|
|
|
I remember trying it last time to no effect, and to be honest I have made too many changes to try it again now. I had to add the variable as a class member instead of in the global scope. It's not really what i wanted but at least it's working.
|
|
|
|
|
waldermort
if you can change to another way I suggestion that you change to it and compelete your program quickly,
But (again I suggestion) that you back and see how to solve this error
|
|
|
|
|
If you #include cCrypt.h in more than one place, you're duplicating the global definition of the variable Password . That's probably causing the multiple definition errors.
As a rule, if you are using global variables, always make them extern in your header files. Then place a definition, without the extern keyword, in the appropriate .cpp file.
Software Zen: delete this;
|
|
|
|
|
Thanks for the info, I never realised that this was wrong. I thought since I was using #ifndef #endif blocks then it would only be defined once. Everything makes sense now.
|
|
|
|
|
waldermort wrote: I have char Password[50]; defined in cCrypt.h as a global variable.
You cannot do that. It most probably violates the ODR (One Definition Rule). Therefore you get the linker error.
|
|
|
|
|
hi guys
I'm new to MFC and been tryin' to use the tile view in the CListCtrl. You know like the one in the windows explorer(WinXP).
I know that there are CListCtrl::SetTileInfo and CListCtrl::GetTileInfo member functions in the ClistCtrl class, but i have no idea on how to use it. So if someone could help me or direct me somewhere apropriate(I found one in codeproject but it was implemented in c#) it will be a great help. Thanks in advance
|
|
|
|
|
there are many samples in ur VC CD, which are best teachers for newbie.
A special image tool for C++ programmers, don't miss it!
The world unique Software Label Maker is here for you and me ...
A nice hyper tool for optimizing your MS html-help contents.
|
|
|
|
|
thanks for the reply , I'll take another look
regards, fajaronly
|
|
|
|
|
My project:
[x]
-[Src]
--x.cpp
--x.h
-x.sln
But when i check in or check out:
[x]
-[x]
--[Src]
---x.cpp
---x.h
--x.sln
-[Src]
--x.cpp
--x.h
-x.sln
why?
|
|
|
|
|
FlyWithYou wrote: why?
Why not? What is your question exactly?
|
|
|
|
|
umm, my project path is e:\x, but when i check in or check out it create project in e:\x\x, so recurrence.
why?
|
|
|
|
|
Check the working folders in the VSS application for your project. Visual Studio has a bad habit of changing them for you.
Software Zen: delete this;
|
|
|
|
|
$/x -> e:\x
$/x/src -> e:\x\src
right?
1.i create a project, and add to VSS, check out project write code, close the project, next time load project from VSS(<-- right?).
2.How to in VS.NET modification vss comment or lable?
|
|
|
|
|
hai all
i have a problem.when ever i resize the dialog,i would like to have the controls to be resized in respect to the size of the dialog
|
|
|
|
|
This[^] and This[^] will help you to do what you want.
Regards,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
keerthikaaa wrote: have a problem.when ever i resize the dialog,i would like to have the controls to be resized in respect to the size of the dialog
Handle WM_SIZE message or OnSize(...) message in your Dialog Class
|
|
|
|
|
Hi keerthikaaa,
Do you want to keep previous size?
|
|
|
|
|
hai
when ever i resize the dialog,the controls which are placed on that are to be resized so that no change in the appearence of the dialog will be there.
otherwise the controls will be placed at one side of the dialog and the rest of the diaolgs space looks empty which doesnt give a nice look
|
|
|
|
|
keerthikaaa,
oh yes,
well (ThatsAlok wrote WM_SIZE) yes this is a way.
you can declare this event and then use variable of controls with movewinodw in function
|
|
|
|