|
I have a 'Table' object (reads a text file to create a table and return table picks). I have moved the code into it's own class library project, and I wish to call the code in the .dll from the main app. The class library project compiles to a .dll, but I don't know how to add it to the main project. I have addded the header file to the main project, and put the .dll in the source directory and debug directories.
How do I add a reference to the .dll? Do I use '#include' or '#using'? How do I declare / instantiate the object, etc. (my attempts broke the build).
What are the basic steps to do this? Can I put both projects in the same solution? Both are in C++ / VS2005. THe main app is from the DirectX SDK April 2007.
Thanks,
Steve
|
|
|
|
|
|
|
I have read the article 'DLLs are simple: Part 2' and have successfully moved the code for my Table class into it's own project / .dll.
The example was for VC++ 6.0, whereas my application is in VS 2005. The main difference was the 'Project > Settings > Link (tab)' -- this doesn't exist in VS2005. To add the .lib file to the project, I put it in the main project directory and right-clicked on the solution and added an existing item, for file type I had to select 'all file types *.*', and added the .lib file to the project. I put the .dll in the debug folder, where the .exe gets put after a build.
What I haven't done yet is to add my .dll project to the main project. I plan to add a new class library to the main application project, and copy and paste the code from the .dll project into it, and hope that it creates a .dll file, a .lib file, and a .exe file. The hope is that I would then be able to take the .dll, .lib, and .h file and use it in other projects.
The purpose of this was to create a fast distance function, which does not call the sqrt function. It takes two or three parameters and returns length of the 'hypotenuse' without using sqrt. With a lookup table of only three points, I get an accuracy of within 1.5%, more than good enough for my level of detail calculations. It will be interesting to see if my function is actually faster or not.
Steve
|
|
|
|
|
TheGeneral69 wrote: The main difference was the 'Project > Settings > Link (tab)' -- this doesn't exist in VS2005. To add the .lib file to the project, I put it in the main project directory and added the .lib file to the project
projectproperty->linker->input->Additional Dependencies = <libname>
projectproperty->linker->General->Additional Library Directories = <path to libfile>
TheGeneral69 wrote: What I haven't done yet is to add my .dll project to the main project.
TheGeneral69 wrote: copy and paste the code from the .dll project into it, and hope that it creates a .dll file, a .lib file, and a .exe file
just add your dll project to your main project solution.
TheGeneral69 wrote: The hope is that I would then be able to take the .dll, .lib, and .h file and use it in other projects.
yes. you can.
|
|
|
|
|
ahh, I saw that linker dialogue, but didn't know how to set it up.
thanks again!
|
|
|
|
|
Hi friends.
i have some queries about ...constructor and destructor
Why to we need these two?and whats the difference between these two.
plz explain some small examples....
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
Object lifetime[^]
may be useful
modified to not to refer little OOP Book Friday, February 22, 2008 8:52 AM
And go for some big OOP book, otherwise u learn only little (initialisation & cleanup).
|
|
|
|
|
Initialization and Cleanup.
BTW What about a little OOP book?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: BTW What about a little OOP book?
Not bad.
|
|
|
|
|
rowdy_vc++ wrote: Why to we need these two?
Actually, I believe one is required while the other is optional. It's implementation-dependent, of course.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The compile error message I get is this:
compiling...
MyVariable01Dlg.cpp
c:\MFC_Todays_Work\Tree_Prop_Sheet_Project_20Feb08_pm\MyVariable01Dlg.h(15) : error C2065: 'IDD_PROPPAGE_MyVariable01' : undeclared identifier
Build log was saved at "file://c:\MFC_Todays_Work\Tree_Prop_Sheet_Project_20Feb08_pm\Debug\BuildLog.htm"
TreePropSheet - 1 error(s), 0 warning(s)
Yet, I have defined IDD_PROPPAGE_MyVariable01 in my code as shown and the name in the property sheet is OK
<red>enum { IDD = IDD_PROPPAGE_MyVariable01 };</red>
I am running Visual Studio.net version 2003 on a current Win XP workstation
I'm new at this, so it is probably something very simple. The problem occured when I added a fourth sheet to a module that contained three sheets and worked OK.
Any help much appreciated.
Response 26 Feb 08
Thanks for your feedback. I hadn't thought of a failure brought about by not recompiling the PCH file, which I did and no luck.
I agree the variable was not defined, so I restarted from scratch and second time round worked OK.
I'm learning that MFC can be a handful.
modified on Tuesday, February 26, 2008 12:23 AM
|
|
|
|
|
doorprize wrote: Yet, I have defined IDD_PROPPAGE_MyVariable01 in my code as shown and the name in the property sheet is OK
enum { IDD = IDD_PROPPAGE_MyVariable01 };
here u defined IDD and initialized to IDD_PROPPAGE_MyVariable01 which is undeclared.
may be u changed the ID of the property page to some new value or the resource.h is not including in the compilation path of MyVariable01Dlg.cpp.
|
|
|
|
|
doorprize wrote: Yet, I have defined IDD_PROPPAGE_MyVariable01 in my code as shown and the name in the property sheet is OK
enum { IDD = IDD_PROPPAGE_MyVariable01 };
No, you've neither declared nor defined IDD_PROPPAGE_MyVariable01 , only referenced it.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
is it possible to have a standalone system tray icon without an exe ?
Typically an exe exposes a System tray icon .
However my requirement is such that I would want to launch an app after the user selects an element from the system tray. Is this feasible ?
For some of the icons (such as the LAN/Network status ) , I do not see a corresponding application in the taskbar. How are these implemented ?
Engineering is the effort !
|
|
|
|
|
act_x wrote: is it possible to have a standalone system tray icon without an exe ?
Typically an exe exposes a System tray icon .
No. If you wanted to do something like this you should make a small launcher application which manages the tray icon and launches the main application when needed.
Steve
|
|
|
|
|
There is quite a large amount of data that can be stored in an exe under the Version Info resource. Can I retrieve that data( if so how) at a later stage, even if the file is running.
Regards,
Bram van Kampen
|
|
|
|
|
See the GetFileVersionInfo[^] function and friends. You may also want to search this site for this function to find some examples.
Steve
|
|
|
|
|
Bram van Kampen wrote: Can I retrieve that data( if so how) at a later stage, even if the file is running.
Like this?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
This , I thought would be simple. I have spent close to half a day figuring this out .
So I am working on a MFC dialog app that has a CPropertySheet object. I am using the property sheet in Non Wizard mode.
MyDlg::OnInitDialog(.)<br />
{<br />
<br />
..<br />
CPropPage1 *pPage = new CPropPage1() ; <br />
m_sheet.AddPage(pPage);<br />
if(!m_sheet.Create(this,WS_CHILD | WS_VISIBLE |WS_BORDER)) <br />
return FALSE ; <br />
<br />
m_bInitialized = true ; <br />
}
I am unable to size the propertyPage to fit the dimensions of the main dialog window.
What should I be doing to ensure that the current active page in the PropertySheet is contained within the bounds of the Main dialog .
This is how my dialog looks at this point ( awful !
http://i25.tinypic.com/2mhiob8.jpg
Help is appreciated
Engineering is the effort !
|
|
|
|
|
Your example is a CPropertyView on a CFrameDialog?
So, your CPropertyView has to handle WM_SIZE and resize itself appropriatly.
Also, the View has to relay the message to the active page.
In addition to look at a few of the solution here on CodeProject, there is an article form a very interesting series):
Control Resizing[^]
Also, MS has a step-by-step walktrough[^].
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
act_x wrote:
I am unable to size the propertyPage to fit the dimensions of the main dialog window.
So the main dialog window is not the property sheet itself?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
dear all
i am really very sorry to ask such question, but no any friend around me,
how to generate the a mask by Gaussion function(2D) when sigma is changed? why its sum of all value in mask is fixed when sigma is changed? and how to produce a mask by c++? thanks a lot.
Li Zhiyuan
|
|
|
|
|
hi ....really i cant understand ..plz explain detail
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|