|
Fernando,
if you want to ship a library, then you must allow clients to connect to that library. One technique is to use static linkage. To do that, you will ship a .lib file and a header file. Another technique is dynamic linkage, for which you will ship a .DLL and a header file. Finally, you could ship COM controls, which come in the physical form of .DLL or .OCX files. You don't need to include header files because COM provides query mechanisms, but essentially in any case you cannot just ship something without letting your user's compiler know what it is.
You seek the impossible unless you don't wish your DLL to be of any use - in which case you could just ship a DLL without a header file
Bernd
|
|
|
|
|
... oh, and in order to get this clarified: you do not ship source code (except header files), unless you wish to. None of the three techniques I listed requires distribution of .cpp files, no whatsoever.
B.
|
|
|
|
|
First of all, thanks a lot for your soon answer .
I have to ship .DLL + .h file if I want to use Dynamic linking (as you wrote earlier) but... am I able to use classes from this .DLL? I mean without using COM.
Another question: Must I ship the whole .h file? I mean, do I have to ship private, protected and public zones? I'd like to hide private data at least.
Thanks in advance.
__________________________
Fernando de Francisco Cano
__________________________
|
|
|
|
|
I used extended style LVS_EX_HEADERDRAGDROP.
So, I can drag-drop a header.
How to get notification of drag-drop of headers in CListCtrl
whenever it was changed?
Thanks.
|
|
|
|
|
Derive a class from CListCtrl and handle the notifications in the derived class.
|
|
|
|
|
Hi,
Did any one know how to get a message in Visual C++ when a smart card was inserted or removed ?
Thanks Very much
|
|
|
|
|
The CPropertyPage constructor looks like this
CPropertyPage( UINT nIDTemplate, UINT nIDCaption = 0 );
Now the second argument (the UINT nIDCaption) comes from the string table. What if I wanna create multiple tabs from code without knowing how many I'm gonna open. I can't make a string table entry for every tab I wanna make cause I don't know how many I'm going to create. So how can I modify the string that I give to an ID from code ???? Is that possible ?
|
|
|
|
|
It is 0 by default, so only use the first parameter, and the dialog name will be used.
Then, once you have created the property page, do :
CPropertyPage mypage;
mypage.pszTitle="My Title";
And you're done.
~RaGE();
|
|
|
|
|
You don't have to specify a value for the second argument (default will be 0). In this case, the title will be taken from the dialog template title!
|
|
|
|
|
Hi all, does anyone know how can i test(by code of course) if the computer supports the Power-off (ATX board) feature, or only the Shutdown ("Its now safe to turn off your computer") Feature?
|
|
|
|
|
I would like to write a dll that can be used with VC, VB, Delphi, and Java. The thing is that I can write the source code only with VC or Win32 API, and I don't know how these other languages work. Could I get some feedback on this topic?
By the way, I do know that MFC based dlls work only for MFC based programs.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
You probably want to write a COM DLL. COM is the standard way of letting any language talk to a software component. Depending on what you need to do you might get away with writing a C# assembly (? I think)
For better information on COM check out that message board or check out Mike Dunn's article "Introduction to COM - What It Is and How to Use It.".
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
|
|
|
|
|
Thank you very much for your quick reply. I was hoping that I didn't have to write a COM DLL but if there is no other way to do it then COM DLL it is.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
It depends also of what kind of stuff you want the Dll to do! If you need the dll to generate classes, then you have to write a COM dll. But if the dll just hold some functions, you can use a normal dll (and you can also use MFC dll). It works with Visual Basic but I'm not sure for the other language (I suppose that works too). You have to be aware of calling conventions !!
|
|
|
|
|
Actually I just want to use some normal functions. Is there a website where I can read about the calling conventions?
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Hmmmm, yes, it must probably exist some but I don't know where ! Perhaps make a search on this site and on google!
In fact, the calling convention (stdcall, cdecl, ...) is the way the stack is cleared (by the client or by the dll). If you call a function from an executable that has not the same calling convention from the function inside the dll, you will have some problems! But you can change this calling convention within the client program (or within the dll) so they can match.
|
|
|
|
|
thank you Cedric.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
I was wondering what would be the best way to implement the following:
I have many types of objects that have a similar function the same. I want a main Messaging class to route commands to each respective object to do something when something specific happen related to the object. A use for this would be to have multiple graphs that would be plotting different thing with the same data. However the main difference is that I could change things at runtime by attaching this graph to this and that graph to that.
Any ideas? Anything I can read to do what I would like?
Appreciate any help.
Thanks.
|
|
|
|
|
I am not quite sure if it is what you want, but have a look at the 'signals and slots' library from boost[^].
Boost is a repository for libraries and tools that faciliate modern C++-programming, especially STL and templates. Many of the people at boost are activly participating at the C++ standardisation comitee.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
I was going to suggest Signals & Slots as well. Besides Boost there is also LibSigC++ which I'm using in ED. I tried to use Boost 'signals & slots' recently to compare it with LibSigC++ but had to give up because the signal was in a DLL and the slot in the Exe. LibSigC++ handles this without any problems.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
The best way to implement this is to use the OBSERVER pattern described in "Design Patterns" book.
You can find here some example for that:
http://www.codeproject.com/cpp/observer.asp
http://www.codeproject.com/useritems/Observer_with_templates.asp
http://www.codeproject.com/gen/design/ObserverPattern.asp
|
|
|
|
|
One question:
I'm try to get the folder name with SHBrowseFolder() and want to create a new folder on folder-browsing dialog
by clicking right button(popup menu) or clicking 'new folder' button I have made if possible.
On MSDN, 'ulFlags' field in BROWSEINFO structure includes a flag following.
BIF_NONEWFOLDERBUTTON
Version 6.0. Do not include the New Folder button in the browse dialog box
I suppose SHBrowseFolder() has a 'Create new folder' button as a default according to that flag.
But when SHBrowseFolder() runs, there is no 'Create new folder'.
And to my suprise, not only BIF_NONEWFOLDERBUTTON flag but also half of flags in 'uiFlags' field are not defined in 'shlobj.h'.
Of course, I'm using Visual Studio 6.0.
In short, I hope to create new folder on folder-browsing dialog by all means.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
The other question:
After a format dialog is created by running SHFormatDrive(), pressing a 'Start' button progresses formatting.
Though formatting was completed, the format dialog never disappear.
Only the format dialog don't disappear until 'Close' button is pressed.
That is, a blocking happens until 'Close' button is pressed.
I wanted to progress my routine for copying files immediately, after formatting is completed.
So I coded like this.
void CSetDlg::OnButtonMakeDisk()
{
.
.
.
if( AfxMessageBox("Not a sufficient space in a diskette.\n\nDo you want to format a diskette?", MB_YESNO) == IDYES)
{
if( SHFormatDrive(this->GetSafeHwnd(), m_ComboDrive.GetCurSel(), SHFMT_ID_DEFAULT, 1) != SHFMT_ID_DEFAULT )
return;
}
else
return;
.
.
Here is my routine for copying files...
.
.
}
However, though I press 'Start' button for diskette formatting,
I should press 'Close' button for ending of format dialog.
So, SHFormatDrive() always returns SHFMT_CANCEL and OnButtonMakeDisk() terminate.
How can I progress my routine for copying files immediately, after formatting is completed ?
Subclassing? Message hooking?
I cannot get the ID or Message of 'Start' button on a format dialog.
Please advise me... help me...
I'll wait your good advices.
|
|
|
|
|
To your first question:
Did you install the latest Platform-SDK? It updates any number of headers to support API-functions in current Windows versions.
You can download it from Microsoft for free, or you get it with the MSDN-CDs.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
guys.. .i need a help.
Can anyone tell me how to load a MFC DLL explicitly so that I can load the appropriate version and also unload it? Please note that I am exporting a class from DLL.
thanks
Bhaskar
___________________________
"Think big, think fast, think ahead. Ideas are no one's monopoly"
|
|
|
|
|
::LoadLibrary()
::ReleaseLibrary()
|
|
|
|