|
As I said, the AdditionalLibraryDirectories path is where it looks for the .LIB file at link time. At run time nothing in your project settings have any meaning to the Windows operating system. When the program loader starts your executable it looks for all the .DLL files that are required. It first looks in the directory where the executable is loaded from, and then in all the directories listed in your system's PATH environment variable. So you either copy your dll into the directory where the .exe file resides, or add its location to the PATH variable.
|
|
|
|
|
Windows 10, Visual Studio 2012, C++, DLL
I am working on understanding DLLs and reference this article:
http://www.codeproject.com/Articles/28969/HowTo-Export-C-classes-from-a-DLL?msg=5204076#xx5204076xx
In there I find the phrase:
typedef struct tagXYZHANDLE {} * XYZHANDLE;
I downloaded the code and found only that one instance. I understand tyepdef and struct, but those empty braces throw me. Especially since I found only that one instance. Please point me to something that provides an explanation for what this is doing. Is there a particular name for that type of declaration?
Thank you for your time
modified 28-Feb-16 9:18am.
|
|
|
|
|
The braces are simply representing a structure with no members. And the *XYZHANDLE means that XYZHANDLE is a pointer to a tagXYZHANDLE structure. It's the fact that they put both braces on the same line that makes it look confusing. Consider:
typedef struct tagXYZHANDLE
{
} *PXYZHANDLE;
In fact, this is how the Windows type HANDLE is declared, as a pointer to an empty structure.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
OK, I see that now. And I see why he did that. I often have a difficult time seeing the obvious. Thank you for pointing that out and taking the time to reply.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
|
|
|
|
|
Windows 10, Visual Studio 2012, C++
I have several utilities to put in a DLL and some questions about how to do it.
If the utilities put in a DLL are built without MFC and without ATL, can they be used by those types of projects?
Can the products of multiple projects, within a single solution, be put into a single DLL? So far, my limited experience indicates this is not the case.
Can Visual Studio show the contents of a DLL? I don’t want a reverse compiler/assembler, I just want to see the signatures of the functions contained by the DLL.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
|
|
|
|
|
bkelly13 wrote: If the utilities put in a DLL are built without MFC and without ATL, can they be used by those types of projects?
Yes.
bkelly13 wrote: Can the products of multiple projects, within a single solution, be put into a single DLL?
Only if you consolidate the source code into a single project.
bkelly13 wrote: I just want to see the signatures of the functions contained by the DLL.
Only source code or documentation can tell you the function signatures. But the DUMPBIN utility can show you the function names that are exported from the DLL.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
|
ILMerge is not relevant for unmanaged code.
|
|
|
|
|
1. Yes, MFC/ATL applications can make calls to C++ functions or class methods, and pure C functions.
2. Yes, but you would need a single project for the final DLL.
3. See Decorated Names[^].
|
|
|
|
|
1. I expected that and thank you for the confirmation
2. I suppose that is not a big problem, may make for a large project, but that will have to do.
3. I was hoping for something easier, but this also is what it is.
Thank you for taking the time to reply.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
|
|
|
|
|
On point 3 I am sure I once found a tool or some source code (years ago now) that decoded them for you. Try some Google foo.
|
|
|
|
|
|
|
I am following the example about setting up Direct3D rendering area on this link:
Tutorial 1: Direct3D 11 Basics[^]
All I did is just wrapped it in my own class and instantiated within MFC project.
However, my question is, why no matter what values I put as width/height in the DXGI_SWAP_CHAIN_DESC structure, I still get all window filled with blue?
shouldnt width/height in that structure or in the D3D11_VIEWPORT structure make difference at all?
|
|
|
|
|
Windows 10, Visual Studio 2012,C++
I need a version of FormatMessage() for Unicode, WCHAR. Google and MSDN deny all my searches for same. I want to call a function of my own that accepts a pointer to WCHAR and the error number, and puts the resultant string in the passed array.
Lacking that, I need a version of swprintf() that has an argument for a max number of characters to move into the string and accepts the LPSTR that is returned by FormatMessage().
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
|
|
|
|
|
I presume you mean something like:
void ShowError(DWORD dwError,
PWSTR pszMessage,
int maxMessageSize
)
{
if (dwError == 0)
{
dwError = GetLastError();
}
if (FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, dwError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), pszMessage, maxMessageSize, NULL ) == 0)
{
swprintf_s(pszMessage, maxMessageSize, L"Error code: %d (0x%X)", dwError, dwError);
}
}
Which you call by:
WCHAR szMessage[512];
ShowError(nErrorCode, szMessage, _countof(szMessage));
wcout << "Exception: " << szMessage << endl;
modified 31-Jan-16 8:59am.
|
|
|
|
|
Message Removed
modified 21-Jan-16 4:17am.
|
|
|
|
|
Message Removed
modified 21-Jan-16 3:54am.
|
|
|
|
|
The dot H file contains:
const WCHAR DEFAULT_DlRECTORY[ ] = L"C:\\LOG_FILES\\";
const WCHAR DEFAULT_FILENAME_PREFIX[] = L"Log_File_";
The dot CPP file contains
C_Log_Writer::C_Log_Writer(
const WCHAR *new_directory_name = &DEFAULT_DlRECTORY,
const WCHAR *new_name_prefix = &DEFAULT_FILENAME_PREFIX[0] )
{ ... }
The new_directory_name lines does not compile and produces the error:
Error 1 error C2440: 'default argument' : cannot convert from 'const WCHAR (*)[14]' to 'const WCHAR *' e:\code_tests\common_code_dll\c_log_writer\c_log_writer.cpp 73 1 C_Log_Writer
I thought new_directory_name would be a pointer that would by default point to the first character of the array. Why is that thinking wrong?
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
modified 15-Jan-16 17:58pm.
|
|
|
|
|
Because you're trying to assign a pointer-to-a-pointer to a pointer:
const WCHAR *new_directory_name = &DEFAULT_DlRECTORY
should be
const WCHAR *new_directory_name = DEFAULT_DlRECTORY
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
And that is because DEFAULT_DlRECTORY is an array and passing it as an argument means the address of the first character is passed. Ok, I must confess to being ate up with the dumb ass there.
Thank you for taking the time for a gentle kick in the butt.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
|
|
|
|
|
I had created an ATL Dialog based application in visual studio 2012,On Scrolling the mouse wheel I want my dialog to be scrolled.
What should i write inside:
LRESULT CUIWindowPage::OnMouseWheel(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
??
}
|
|
|
|
|
|
I am using Microsoft speech sdk v 11 (https://msdn.microsoft.com/en-us/library/jj127898.aspx[^]). the below call fails, when I check GetLastError, observed that it fails to message "Class not registered". visual studio 2008, windows 7
hr = cpVoice.CoCreateInstance(CLSID_SpVoice);
Please advise
modified 14-Dec-15 7:05am.
|
|
|
|
|
When using Windows 7 64-bit, check if you have installed the version of the Microsoft Speech Platform - Runtime that matches your project settings (32 or 64 bit), or just change your project to match the installed version.
|
|
|
|