|
sashoalm wrote: is C:\Documents and Settings\All Users\Application Data\ a good one for putting dlls?
Sure, why not?
But it's a strong recommendation that you create a folder below that path with your company name and place the files in that folder.
However, this only takes care of the issues regarding how to access those shared files and where to put them and since they are COM servers it doesn't matter where they're located.
You also have to consider how they will be installed and un-installed and whether or not you will have an installation wizard at your aid such as Wise or InstallShield.
To be able to know when to unregister the COM servers and remove those files, you should make DWORD-entries in the registry below the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDlls key where the value reflects the reference count. This means that the DWORD value tells how many installed applications will make use of the shared file. When you install you increase that number and consequently you decrease the value when you un-install. When the value reaches zero you unregister the COM server with RegSvr32, or similar, and remove the file and the registry entry.
This can be done automatically with a wizard, but if you're not using one you can do this by yourself.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi all,
Can someone explain what's the difference between the followings.
int freeLib = FreeLibrary(m_hwnd_Lib);
int freeLib = ::FreeLibrary(m_hwnd_Lib);
Thanks
I appreciate your help all the time...
CodingLover
|
|
|
|
|
int i=0;
{
int i=1;
std::cout<<i;
std::cout<<::i;
}
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: int i=0;{
int i=1;
you'd better say that the opening bracket is the start of the main() function. otherwise, that code could be anywhere, even nested in a function body, and then, your outter i would not be in the global scope, then, unreachable using the global scope operator :: ...
|
|
|
|
|
The :: operator is called the scope operator.
You use it to inform the compiler in what scope an identifier is declared, i.e what namespace and/or class.
Putting the scope operator in front of an identifier means that you explicitly refer to an identifier in the global namespace, thus even if an identifier in the current namespace or class is declared with the same name, the identifier declared in the global namespace is used.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Fine, that's the basis idea I have.
But one thing I've confused, in windows API some cases it's use and some cases it's not. Why is that?
I appreciate your help all the time...
CodingLover
|
|
|
|
|
CodingLover wrote: But one thing I've confused, in windows API some cases it's use and some cases it's not.
You have to clarify that.
When referring to the "windows API", it usually means functions that resides in e.g. Kernel32.dll that can be called from any language such as C, C++, VB, C#, Java and so on.
The scope operator is C++ specific so as I understand it your question doesn't make sense.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
It prevents a same-name and same-signature class member from being called by accident.
For example, if you are working in a class that has a member SetWindowText( HWND, LPCTSTR ) , but you want to call the Win32 (or global) version of it, you would use ::SetWindowText( hWnd, _T( "Your Text" ); . Otherwise, you would call the class' version of the function.
Calling API functions like that also protects you from future changes - if you have code in a class that calls SetWindowText(...) and in the future someone adds a member function to the class (or its base) with the same signature and recompiles your code, your older code would start calling the newer method. This may or may not be what you want, so you can "future-proof" your code by using the global namespace operator.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
You're probably talking about MFC? For example, if you call MessageBox, that would call the MessageBox function provided by MFC, whereas ::MessageBox would call the global version (WIN API).
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
CodingLover wrote: Why is that?
no need to use it when there is no ambiguity. unless you want to make the code perfectly readable.
If the compiler has many definitions of the same identifier, then if you don't use the scope operator, the identifier in the current scope will be used. if not found there, then it will search in the namespaces declared to be currently in use (using namespace directive).
To tell the compiler that you want to use the global scope identifier, then you have to prepend it with :: ...
|
|
|
|
|
CodingLover wrote: Can someone explain what's the difference between the followings.
int freeLib = FreeLibrary(m_hwnd_Lib);
int freeLib = ::FreeLibrary(m_hwnd_Lib);
Yes: I see two colons in the latter statement, missing in the former one.
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
[My articles]
|
|
|
|
|
It's called the scope resolution operator.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
It's usually useless. But you do need it when there happens to be another FreeLibrary function visible in the current scope that hides the ::FreeLibary API. This actually happens with CWindow API wrappers, which are named after the APIs being wrapped.
|
|
|
|
|
I am compliing the idl file with visual studion 2005 (c++), I am getting below error, Please advice
Please update.
7>IDL compiling...
7>idl: error: cmd line option not supported: -B
7>usage: "-flags" for details.
7> idl [-flags] [-?] [-Dname[=value]] [-Idir] [-N] [-Uname] [-3] [-V] [-u] [-v] [-w]
7> [-jbase] [-R] [-base] [-poa] [-xml] [-pss_r] [-wsdl] [-psdl] [-jpoa]
7> file [file]*
|
|
|
|
|
ptr_Electron wrote: I am getting below error, Please advice
....
idl: error: cmd line option not supported: -B
Ummm, I guess the command line option '-B' is not supported...
More seriously, what does your complete command line look like?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thank you very much for your responce.
I am trying to compile an IDL file in Visual Studio 2005, I havn,t set any command line option, I just did rebuild all thats all, after installing Inoa ORBIX 6.3.
How to check it out and set the correct one, please advice.
Thanks
|
|
|
|
|
ptr_Electron wrote: I am trying to compile an IDL file in Visual Studio 2005, I havn,t set any command line option, I just did rebuild all thats all, after installing Inoa ORBIX 6.3.
The above doesn't provide me with any information that can be used to help you.
The fact that you have not changed any settings is irrelevant.
I specifically asked for a piece of information that might be relevant, but you failed to provide it.
This means that at least I cannot help you until you answer my question.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I recall there's different versions of the IDL compiler out there.
I think there's a newer one in the windows SDK version 6.
Maybe you need that?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
Peter Weyzen wrote: I think there's a newer one in the windows SDK version 6.
Maybe you need that?
I guess you replied to the wrong post Peter...
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Good afternoon!
I'm trying to create a Dll file and i have a lot of .h and .c files to insert on it. I already saw MSDN article "how to create a dll file" but the sample presented is simple and only includes one source code file. How to create my Dll file? Anybody knows documentation about this subject with good samples?
Best Regards.
|
|
|
|
|
Are you using Visual Studio and its project/solution system or
building from the command line?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm using Visual Studio 2005.
|
|
|
|
|
Walkthrough: Creating and Using a Dynamic Link Library[^]
The section "To add a class to the dynamic link library" explains adding a new source/header
file combination to the project. To add existing files to the project, choose "Add Existing Item…"
instead of "Add New Item…".
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How about starting in the DLL section of CodeProject[^]?
At least so you can better explain what you want to do and more specifically what your problem is.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Essentialy, my problem is how to insert my .h and .c files in a project to build a .dll one.
|
|
|
|