|
Hello,
at the moment I'm working on a DLL (swlib.dll) at my company and I use the code very often at home. The problem is that the project paths are different:
The application called Renamer3 is in the path
f:\vc++\renamer3 <- at home
f:\programmieren\_code\renamer3 <- at work
so I had the ideo to configure the output path of the dll in the stdafx.h to prevent editing the project settings every day.
I put this code to the stdafx.h
#define HOME // --> when I'm not at home this line will be commented
#ifdef HOME
#define __SW_LIB_OUTPATH "\"f:\\vc++\\Renamer3\\"
#else
#define __SW_LIB_OUTPATH "\"f:\\programmieren\\_code\\Renamer3\\"
#endif
#ifdef _DEBUG
#define __SW_LIB_CONFIG "Debug\\"
#else
#define __SW_LIB_CONFIG "Release\\"
#endif
#pragma comment(linker, "/out:" __SW_LIB_OUTPATH __SW_LIB_CONFIG "SWLib.dll\"")
#pragma comment(linker, "/implib:" __SW_LIB_OUTPATH __SW_LIB_CONFIG "SWLib.lib\"")
#pragma comment(linker, "/pdb:" __SW_LIB_OUTPATH __SW_LIB_CONFIG "SWLib.pdb\"")
Well, but now I'm flooded by 49 Linker warnings and 1 Linker error (when I'm only trying to compile the DLL, not the Renamer3 which depends on it):
warning LNK4070: The directive /OUT:f:\vc++\Renamer3\Debug\SWLib.dll in .EXP does not match the output filename "f:\vc++\Renamer3\debug/SWLib.dll"; directive will be ignored
and
fatal error LNK1104: File "f:\vc++\Renamer3\Debug\SWLib.lib" can't be opened
(I tried to translate the linker messages to English because I'm from Germany, so they could defer from the correct messages )
What's wrong with this code? I think it might be correct...What's strange too is that the fatal error only appeared when I deleted the SWLib.lib in the Folder f:\vc++\renamer3\debug. Before that I was able to compile the Renamer3 but at startup I got a windows message box telling "The application or DLL "f:\vc++\Renamer3\Debug\SWLib.dll" is no valid Windows-File. Check this with the installation disk" ???
I really have no idea what this should mean, the dll ist definitely working!
|
|
|
|
|
I had the same issues, different paths to the project directory on different machines. The solution is used was to add the project directory to the list of include directories and then use #include <> notation.
e.g. (using VC6)
On home machine add 'f:\vc++' to list of include directories in Tools-Options-Directories-Include
On work machine add 'f:\programmieren\_code' to ...
Then in all your code use
#include <Renamer3\...> type sytax.
There shouldn't be any need to mess with the Debug/Release directories.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
great, that's the solution and it's fairly easy! i had another approach -> i used different configurations but that's more complicated...
thank you very much!
|
|
|
|
|
Glad to help.
It's also worth looking at the other directories to set as well i.e. executable, library and source.
For all directory settings make sure the order of the paths is correct, usually yours should be last.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
right, i forgot something: how can i say my main application (the exe) the path of the dll? when i build the program the dll will be placed in
f:\vc++\swlib\debug
and the exe is in
f:\vc++\renamer3\debug
the very issue is that i have more than one program which depend on the dll and the dll isn't complete so i edit one program and the dll, build it and everytime i changed the program i had to change the ouput folder of the dll as well...very annoying
|
|
|
|
|
What i do is have a bin directory where a copy all exe's lib's and dll's get copied when they are created. I also separate my binaries, from my build files, from my source files ... after much trial and error i have found this the most flexible setup.
For the common dll's or static lib's :
e:\lib32\bin\lib\[Release & Debug] - bin\lib gets copy of all static .lib
e:\lib32\bin\dll\[Release & Debug] - bin\dll gets copy of all .dll & .lib files
e:\lib32\bld\mod_1\dll - mod_1 being compiled as a dll, creates .dll & .lib
e:\lib32\bld\mod_1\lib - mod_1 being compiled as a static lib, creates .lib
e:\lib32\src\mod_1 - source for mod_1, #pragma's take care of lib/dll build diffs
As mentioned in previous post i then add e:\lib32\src to Tools-Options-Directories-Include Files and then use #include <mod_1/...> syntax.
I then add e:\lib32\bin\dll\Debug to my system PATH.
You could probably use it for Project-Settings-Debug-Working Directory instead.
Or maybe, Tools-Options-Directories-Executable Files.
For the project specific exe's dll's and static lib's :
e:\prj\prj_1\bin\[Release & Debug] - bin gets copy of all prj_1 .dll, .lib, .exe files
e:\prj\prj_1\bld\mod_2\dll
e:\prj\prj_1\bld\mod_2\lib
e:\prj\prj_1\bld\exe_1
e:\prj\prj_1\src\mod_2
e:\prj\prj_1\src\exe_1
Although it makes more sense to use e:\prj\src\prj_1, i wanted all project files together - up to you.
As for the common libraries, i have added e:\prj\prj_1\src to Tools-Options-Directories-Include Files and then use #include <exe_1/...> syntax.
Now becuase e:\lib32\bin\dll\Debug is in the path i can go into e:\prj\prj_1\bin\Debug and run my program and it finds both project specific dll's (with exe) and common dll's (through PATH).
For my common dll's or lib's i add to Project-Settings-Post-build Step (last page) the following for All Configurations :
copy .\$(OutDir)\$(TargetName).dll ..\..\..\bin\dll\$(OutDir)
copy .\$(OutDir)\$(TargetName).lib ..\..\..\bin\dll\$(OutDir)
or,
copy .\$(OutDir)\$(TargetName).lib ..\..\..\bin\lib\$(OutDir)
For my project specific exe/dll/lib settings it's similar.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
that was a great explanation, thank you very much! now i think i get away with this stuff
|
|
|
|
|
Well I've read several articles about timers and I still don't quite get how to use them. What I'm trying to do is hide(<-I can do this part) a dialog box for X minutes(<-I can't do this part). I don't understand what I need to do to get it to work. Thank you to any who helps and to those who have helped.
|
|
|
|
|
while using the timers after the particular time (ie in millisecends specifed in the triggering function ) Timer Function will be triggered.
In the OnInitDialog() function add the following ,
OnInitDialog()
{
CDialog::OnInitDialog();
.........
SetTimer(1000,5000,NULL);
ShowWindow(SW_HIDE);
return TRUE;
}
Implement the WM_TIMER using classWizard and add the following code
OnTimer(...)
{
ShowWindow(SW_SHOW);
KillTimer(1000); // 1000 is the Timer ID given in the SetTimer function
}
Here the OnTimer will be called after 5 seconds.
|
|
|
|
|
Hi Friends,
I want to know how to stretch the Icons like we do for the BItmap by using StretchBlt(...) function in MFC. and I also want to know how to Display the mouse cursor. and stretch the mouse cursor.
Salman
Live and Let live
|
|
|
|
|
For icons you can use ::DrawIconEx()
Roger Allen - Sonork 100.10016
Strong Sad:
Clever I am? Next to no one.
Undiscovered and soggy.
Look up. Look down. They're around.
Probably laughing. Still, bright, watery.
Listed among the top. Ten.
Nine. Late night. Early morn.
Early mourn. Now I sleep.
|
|
|
|
|
The DrawIcon(Ex) functions can also be used to draw cursors. If you want to stretch/scale them, then I recommend that you create a Memory DC, draw the icon/cursor onto the memdc, get the bitmap from the memdc and use StretchBlt to scale it onto the real DC.
onwards and upwards...
|
|
|
|
|
please have a look at my programm below:
BOOL CMy06aDialog::OnInitDialog()
{
CBrush m_redBrush(RGB(255,0,0));
CBrush m_yellowBrush(RGB(255,255,0));
.........
}
HBRUSH CMy06aDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{ if(nCtlColor==CTLCOLOR_DLG )
{pDC->SetBkColor(RGB(255,0,0));
return m_redBrush;
}
if(nCtlColor==CTLCOLOR_EDIT)
{pDC->SetBkColor(RGB(255,255,0));
return m_yellowBrush;
}
return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
}
but the result is :only the edit control ,their background color is yellw as i expected,but dialog background color is still gray,why?
|
|
|
|
|
Try it this way:
HBRUSH CMy06aDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor==CTLCOLOR_DLG )
hbr = m_redBrush;
if(nCtlColor==CTLCOLOR_EDIT)
hbr = m_yellowBrush;
return hbr;
}
Steve
|
|
|
|
|
hi:Steve,thank you,i try first according your advice,but dialog control have no color as i set
|
|
|
|
|
Hi,
Good morning, everyone here
I meet a trbouble, a client quited withour sending message to my server, when checking the connection, I remove the socket from the list and delete the memory, but here the trouble appered, the server quited immediately. I know it is because the delete operation, but i have no idea what should I do?
Any advice is appreciated ,
thank you!
|
|
|
|
|
is your serveur mono-client?
don't understand well where's your probleme...
TOXCCT >>> GEII power
|
|
|
|
|
My server is muti-client.
problem: When a client quits without notifying the server, now server fails to send message to client and fails to delete the socket too.
Thank you!
|
|
|
|
|
do you check errors ?
send() and recv() return -1 if they coould not have sent what they had to...
recv() also return 0 if the other side of the connection has closed the connection.
normally, you might be crash-free...!
TOXCCT >>> GEII power
|
|
|
|
|
I want to put together a small program which will go
to a server can check to see if an update exists and
if so, to go get that update and replace the current
file.
I can do a WebGrab and get txt information, but I
don't know how to get the executable file from the
server and make it replace the current file. By chance,
does a sample project exist somewhere that shows how
to do this online update?
Please, any response any one can give me will be greatly
appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
I'm certainly no expert, but it may be simpler to download a DLL, which you can then load dynamically and retrieve the addresses for your components from. Have a look at the documentation for:
FreeLibrary
LoadLibrary
GetProcAddress
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
If I've a CListBox derived class (say CListBoxEx ) that handles its own custom drawing messages, i.e. WM_MEASUREITEM and WM_DRAWITEM , is it possible for me to change the parent window of this window (using SetParent ) without the fear of not receiving the above specified messages? Actually, I need to change the parent window more than once.
I'm using VC++ 6.0 SP5 and MFC
Thanks in advance
Gurmeet S. Kochar If you believe in God, it's because of the Devil
My CodeProject Articles: HTML Reader C++ Class Library, Numeric Edit Control
|
|
|
|
|
I can only think that it may be possible to attach to a hidden window as a parent and therefore not get these messages. Though I am not 100% sure on this.
Ant.
|
|
|
|
|
How can i design application, can toggle like vc dialog?
|
|
|
|
|
I doubt anyone who reads this will have any idea what you mean. Do you mean a dialog box that has a section that can be shown or hidden ? The trick is just to use ::SetWindowPos to resize the dialog to hide/show the section you want to toggle, and set the text on the button you use to reflect the current state. If that's not what you mean, try to explain a bit better.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|