Quantcast
Channel: Visual C forum
Viewing all 15302 articles
Browse latest View live

MSPDB120 error incorrect version

$
0
0

Hello,

trying to build a dll results in error message:

Error    48    error LNK1101: incorrect MSPDB120.DLL version; recheck installation of this product    C:\Projekte\tools\VisionDLL\V1.4\vsVision\LINK    vsVision

Even uninstallaling and reinstallation VS2013 did not help.

Some days ago this error occured from time to time. Sometimes I could get around by changeing the project settings of toolset (and rebuild)

Best regards

JS_Finetech


Run post-debug executable file

$
0
0

Hi,

I made a project solution in vc++ 2010 and would like to know how to run an executable file after i'm finished debugging the code (F5). 

In the code, when debug is finished, a text file is generated (report) and i want the executable file parse this text for readability.

Thanks.

In mixed application, loading mfcm110ud.dll calling AfxInitialize initializing AFX_MODULE_STATE m_bDLL to false in vc14, wasn't in vc11

$
0
0

Our application mixes native and managed code, with a bit of MFC thrown in.

After switching to VS2015, we started getting an ASSERT being hit in _AfxActivationWndProc:

LRESULT CALLBACK
_AfxActivationWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
       WNDPROC oldWndProc = (WNDPROC)::GetProp(hWnd, _afxOldWndProc);
       ASSERT(oldWndProc != NULL);

We tracked the problem down to AFX_MODULE_STATE's m_bDLL being false, which resulting in AfxUnhookWindowCreate() not unhooking _AfxCbtFilterHook, which resulted in the AfxWndProc being registered on windows it should not have been.  Due to some poor coding on our side, this resulted in the AfxWndProc being called on non-CWnd windows.
 
We then finally tracked down the cause of AFX_MODULE_STATE's m_bDLL being false. When mfcm140ud.dll is loaded, the following is run (from src\mfc\appmodul.cpp):
char _afxInitAppState = (char)(AfxInitialize(FALSE, _MFC_VER));

Pruned down, the call stack is:

mfcm140ud.dll!`dynamic initializer for '_afxInitAppState''() Line 67 C++
ucrtbased.dll!000007fede848efd()
mfcm140ud.dll!dllmain_crt_process_attach(HINSTANCE__ * const instance=0x000007fee0e10000, void * const reserved=0x0000000000000000)
mfcm140ud.dll!dllmain_crt_dispatch(HINSTANCE__ * const instance=0x000007fee0e10000, const unsigned long reason=0x00000001, void * const reserved=0x0000000000000000)
mfcm140ud.dll!dllmain_dispatch(HINSTANCE__ * const instance=0x000007fee0e10000, const unsigned long reason=0x00000001, void * const reserved=0x0000000000000000)
mfcm140ud.dll!_DllMainCRTStartup(HINSTANCE__ * const instance=0x000007fee0e10000, const unsigned long reason=0x00000001, void * const reserved=0x0000000000000000)
mscoreei.dll!_CorDllMain()
mscoree.dll!ShellShim__CorDllMain()
..
clr.dll!CLRLoadLibraryExWorker()
...
clr.dll!AppDomain::LoadDomainAssemblyInternal()
..
clr.dll!AssemblyNative::Load()
...
clr.dll!UMThunkStub()

AfxInitialize ended up working on _afxBaseModuleState's AFX_MODULE_STATE instance.

All of the above was not happening in vc11. Looking at the code it seems it should have, but 'char _afxInitAppState =' isn't hit when mfcm140ud.dll is loaded.

I had seen another post about a similar problem with the ASSERT (which I can no longer find), which had talked about using a hack fix of saying:

AfxGetModuleState()->m_bDLL = true;

What is also needed in some cases is:

AfxGetAppModuleState()->m_bDLL = true;

So, anyhow, this is sort of inbetween a 'why is this now happening in vc14) and a 'lesson's learned'....

Larry

Handle leaks in CDHTMLDialog

$
0
0

Hello,

We are using a DHTMLDialog(Dialog derived from CDHTMLDialog) in a MFC dialog based application using Visual Studio 2008.

This is done in the following way

  1.       Create a MFC dialog based application.
  2.       Add a button in this dialog
  3.       On Click of this button, open DHTMLDialog  as a modal dialog.

But, when the DHTMLDialog is closed, it is observed that there are some handle leaks.

Most of these handles are registry handles.

Please note, there is no custom implementation added  to the default DHTMLDialog.

We see the same behavior in VS2010 also.

Is there any way to avoid these leaks (OR) do we have any other ways to show HTML pages in MFC applications other than this one.

Thanks,

Sara

Very strange phenomenon: output file filled or truncated with binary zeros. What could cause that?

$
0
0

Very strange phenomenon: output file filled or truncated with binary zeros

I have recently encountered a very strange phenomenon which I'm at a loss to account for.  I have had reports in the last few weeks from 4 users who say that they have lost data from the file that my application writes to.  I have been able to see two of the files.  One of them is about 34KB and viewed in a binary editor it contains nothing but binary zeros.  The other is about 40MB and if I view it in a binary editor, it is fine up to offset 02600000 (hex), but from 02600000 onwards it contains nothing but binary zeros.

I don't know for sure that all 4 have experienced the same thing, but it sounds as if 3 of them have had very similar truncation, and the 4th has lost everything.

The way my app saves is like this: the app writes to a temporary file.  If any error occurs, the save is aborted. If the save succeeds, the original file is deleted and the temporary file is renamed to replace it.  None of the users reported any problems when they saved.  The problem occurred the next time they tried to view their data.

I estimate the chance that this was caused by a bug in my code as approaching zero.  I am a very experienced coder and I have checked it meticulously and can find no way that my code could have done this.  The code uses CFile::Write to write to the file.  The truncated file actually split a keyword that was being written out.  Low-level buffering code might conceivably have done that, and my code does do its own buffering, but this part of the code has not been changed in over 10 years, and has behaved faultlessly throughout that time.  If an error did occur, I can think of no way that it would result in binary zeros being output.  Also, why do zeros start at hex 02600000?  Surely it can't be a coincidence that it starts at a round number that ends in 5 zeros?  But this is a round number only in hex terms, and my code doesn't use hex for buffer sizes (or any sizes). All sizes are specified in decimal values.

So I ask myself - Why after years of working fine have I had 4 reports like this in a window of less than 3 weeks? Why binary zeros?  Why in the truncation case I say did they start on a (hex) round number?

I have not been able to confirm that they're all using the same version of my software, but it looks like that.  That version has been around for just under a year.  Why problems now?  I only know the Windows versions for two of them.  One had Windows 7 and another had Windows 10.  One user said they hard recently run a defrag on their hard drive.  Could that be relevant?  An attempt to defrag an SSD maybe? (I don't know if they have SSDs).  A virus?  A weird new fault in a service patch, miraculously affecting both Windows 7 and Windows 10?

Any ideas anyone?


Simon

ntdll.dll Trigger a breakpoint when ::malloc() but allocate successfully and ::free also success.

$
0
0

Hello,

I'm developing an application under visual studio Community 2013 in C++.

I'm loading a DLL at the beginning of the program like this:

void* ModuleHandle = ::LoadLibraryW(DLLName);
if (ModuleHandle)
{
    void* InitFunc = (void*)::GetProcAddress((HMODULE)ModuleHandle, "Initialize");
    if (InitFunc)
    {
        ModuleInterface* Interface = InitFunc();
	if (Interface)
	{
            Interface->InitializeModule();
        }
}


In the function InitializeModule(), I'm using directly ::malloc() or new(). When debugging I always trigger a breakpoint in ntdll.exe with this call-stack:

ntdll.dll!_RtlpBreakPointHeap@4()	Unknown
ntdll.dll!@RtlpAllocateHeap@24()	Unknown
ntdll.dll!_RtlAllocateHeap@12()	Unknown
ntdll.dll!_RtlDebugAllocateHeap@12()	Unknown
ntdll.dll!@RtlpAllocateHeap@24()	Unknown
ntdll.dll!_RtlAllocateHeap@12()	Unknown
msvcr120d.dll!58ecc6e1()	Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for msvcr120d.dll]

If I continue (F5), the allocation always success, no problem appear in the program after. Memory is correctly free with ::free() after.


The application is separate between 2 dlls (Core.dll and Test.dll )and 1 exe with the same Runtime Library (MTD).

- Exe depend of Core.dll

- Test.dll depend of Core.dll

- Exe initialize Test.dll  by calling the ModuleInterface::InitializeModule()

- In ModuleInterface::InitializeModule() Test.dll directly call Core.dll function that just return new Object() to Test.dll

- This new break!

Is this a known issues?

Thank you


VS2008, VC++, unordered_map and unordered_set are not colour coded. Why not?

$
0
0
Using Visual Studio 2008, VC++.

When I open the headers 
<unordered_map>
<unordered_set>

which are in namespace tr1, I notice that it is all in black-on-white. It is not colour coded.
That is different from

<map>
<set>

There must be a master list of what VC++ colour codes.

How do I change this?

Thanks

IdentityWrapper

IdentityWrapper

Call a function of a class from another class without instance it.

$
0
0

Hello!

I have been making a game in VB.net for a long time now and decided to try moving to C++ instead. So i'm a beginner. One of the many parts in that code structure was to be able to make variables and functions in external classes and then call them from the main class. Is this possible with C++? Because it was really neat. Here's a really quick example of what i mean:

External Class & CPP file;

class A {
public:
	int GetYear = 2016;
	int CalculateYear(int in_years)
	{
		return 2016 + in_years;
	};
};

Main Class:

#include <iostream>
using namespace std;

int main()
{
	cout << A.GetYear << endl;
	cout << A.CalculateYear(10) << endl;
	system("pause");
	return 0;
}
This seems to be working inside the same file, but not across different cpp files. It would be so efficient to just grab values out of a external class that handles everything for you. And you don't have to make a object/instance of it.



visual studio community installation problem

$
0
0

i installed vs 2015 community and uninstalled it as there were some problems.

Now i am not able to reinstall it as it is showing some installation error. Please help.

visual studio community installation and trying to run cpp project

$
0
0

cannot open ucrtd.lib  getting this error while trying to compile c++ file.

Please let me know

C1083 error -- header file not found

$
0
0

I am using VS 2015 on a workstation running Win 7 Professional.

I have recently encountered a C1083 link error -- "Can't find file GenericGUI.h" --  for the first time.  The problem is repeatable.  

I consulted the MSDN website for information on this error and eliminate all of the possible causes for the error cited there.  

I also consulted the postings on this website which relate to C1083, but to no avail.  The closest thing I saw to a solution was "I recreated the file and the problem disappeared."  Spooky.  Those threads are now closed; hence, this new topic.  

For my current project, that for which this problem occurred, header file GenericGUI.h is in a directory other than the project directory.  
I had added the full pathspec for this directory under                                                          Properties -> Configuration Properties -> VC++ Directories.  
I verified use of ";" as a delimiter.  
All of my *.cpp files lead off with #include "stdafx.h".  I have "Ignore standard directories" set to NO.
I have configured both the Debug version and the Release version with these same settings.  

I have configured everything for this project with exactly the same settings I have used for other VS 2015 projects, and the Debug and Release versions for those other projects all build without error.  

The kicker is that, for the current project, the C1083 error does NOT occur for the Debug version.  It occurs only for the Release version and is repeatable.  
And yes, I went back and verified all configuration settings multiple times to ensure that I hadn't made a mistake somewhere.  

In an attempt to clear the error, I tried reboot of my PC and reinstall of VS 2015, but to no avail.  

Can anyone shed any light on this issue?  

Thank you in advance for attending to this.



rwh


Background processes affected during drag n drop operation in Clistctrl

$
0
0
I am implementing drag and drop feature to move elements within a clistctrl derived class. The process works well but during the operation the CPU usage goes down and the background processes got effected ( slowed down ). After the operation is completed , the CPU usage goes back to where it was. I can't figure out why. My application is heavily multi-threaded and the CPU utilization is typically 85% , memory usage is less than 75%.

can upgrade driver????

$
0
0
I have an external device in pci e and also a driver software from the manufacturer. But now they does not provide driver for windows 8 or 10 is there any method to upgrade driver software ....????

"Disable Performance Counters" for 15 mins issue

$
0
0

Hi,

I  have a problem , my program sometimes reading "Disable Performance Counters"for a long time , but most time it will just try to read about 10 times. I am not very understand why this registry blocked the program.

And also I am not sure , which caused this problem .

c1xx : fatal error C1027: Inconsistent values for /Ym between creation and use of precompiled header

$
0
0
I'm trying to port C++ applications that built with VS 2005 to VS 2008.  I'm using a build procedure that invokes VS from the command line many times using the devenv command.  On my own computer, I get the C1027 error building a project.  The same project works properly on other machines and works OK on my machine if I build it from inside the IDE.  Any suggestions for a fix or workaround?

Second, what does this error message mean?  I can't find any documentation on the /Ym command line switch for the C++ compiler.

I got this compilation error "cl : Command line error D8038 : invalid argument '-I.. -I../.. -I. -I../../ etc" and it was working normally with same command little bit ealier

$
0
0

I got this compilation error "cl : Command line error D8038 : invalid argument '-I.. -I../.. -I. -I../../ etc" and it was working normally with same command little bit ealier.

I am compiling on windows xp

i think its bug in cl


The package cannot be updated, the correlation or conflict verification

$
0
0

I create a windows phone project using the vc2015 and build it successfully.

Then I generate the application store package and pass the windows app verification. 

I start the windows phone application deployment v8.1, select the emulator 8.1 WVGA 4 inch 512MB, and select the .appx,

run it, the windows phone start correctly, but the .appx can't run and the  windows phone application deployment v8.1 reports:

The package cannot be updated, the correlation or conflict verification.

c and cpp projects

$
0
0

I need to work on visual studio. Looking for IDE to work on C and CPP. which version of visual syudio to download for windows 2010

visual studio community installation problem

$
0
0

I am trying to reinstall visual studio community. 



i get the following message. Did i delete something by mistake? Mine is a new pc with windows 10

Setup Engine : The system cannot find the file specified.
Microsoft Visual Studio Preparation : The system cannot find the file specified.
Microsoft Visual Studio Enterprise 2015 : The system cannot find the file specified.
Microsoft Visual Studio 2015 Pre-Clean Tool : The system cannot find the file specified.
Microsoft Visual C++ 2013 Redistributable (x86) - 12.0.21005 : The system cannot find the file specified.
Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.21005 : The system cannot find the file specified.
Microsoft Visual C++ 2012 Redistributable (x86) - 11.0.60610 : The system cannot find the file specified.
Microsoft Visual C++ 2012 Redistributable (x64) - 11.0.60610 : The system cannot find the file specified.
Microsoft Visual C++ 2015 x86 Debug Runtime - 14.0.23506 : The system cannot find the file specified.
Microsoft Visual C++ 2015 x64 Debug Runtime - 14.0.23506 : The system cannot find the file specified.
Microsoft .NET Framework 4.6.1 Developer Pack : The system cannot find the file specified.

How to suppress Visual studio breaking change error

$
0
0

I have installed visual studio 2015 update 1 recently and some of the project in my solution showing this build error

Error    C2323    'operator new': non-member operator new or delete functions may not be 
declared static or in a namespace other than the global namespace
That error cause by update 1 as mention in breaking changes web page https://msdn.microsoft.com/en-us/library/mt612856.aspx

I understand there is a risk because of the way I coded, but at this moment I'm not comfortable to do all the corrections. So is there  a way to suppress  this error temporally?





Viewing all 15302 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>