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

%(RelativeDir) not working with Shared Projects in Visual Studio 2015?

$
0
0

Hi there,

I am getting errors like the following:

2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppBuild.targets(838,5): error MSB3191: Unable to create directory "D:\SnapGames\Work\PC\SnapEdit\SnapEditEXE\Debug\D:\SnapGames\Work\PC\SnapEdit\SnapEdit\SnapEditCore......\SnapCore\SnapCore\Code\Collision". The given path's format is not supported.

My Object File Name is set to "$(IntDir)%(RelativeDir)/". My IntDir is properly being set as "D:\SnapGames\Work\PC\SnapEdit\SnapEditEXE\Debug\", however the RelativeDir is incorrectly returning a full path.

I found and read the following:

https://github.com/Microsoft/TypeScript/issues/5894

http://stackoverflow.com/questions/34048228/tfs-build-error-after-installing-visual-studio-2015-update-1

http://stackoverflow.com/questions/34100740/error-copying-typescript-files-when-packaging-azure-project-visual-studio-2015

I have installed the TypeScript 1.7.6 referred to in the posts, but that didn't solve anything. I wasn't sure if it actually would, because I am not directly using TypeScript, but just in case I did.

I have other solutions that are not using Visual Studio 2015 Shared Projects, and they are getting proper results from $(IntDir)%(RelativeDir)/. Therefore, I suspect this is related to using a Shared Project. However, I have not been able to find anything on this matter.

I took a 2015 solution that was building correctly. It has the same format of Outupt File Names that I described above. I re-implemented one of it's projects as a Shared Project, and it now fails with the same type of errors.

Any help would be appreciated


programs and features

$
0
0
I would like to create a file containing the list that appears in the "programs and features". What is the easiest way to get this file?

clyde 0magna



HEAP[AppName.exe] Invalid address specified to RtlSizeHeap: Trying to debug with "Application Verifier"

$
0
0

Can someone point me to a reasonable plan for debugging this problem:

I have a C++ CLI based application that I "ported" from Win32 to x64. It uses a third party API that moved from Win32 to x64 based. This was the root cause for my port.  This HEAP issue started with the "port" from Win32 to x64.

On load (while Debugging app), page heap says "Page heap: pid 0x205C: page heap enabled with flags 0x3.

AVRF: AppName.exe pid: 0x205C: flags 0x80643027: application verifier enabled.

When I exit my app, after "successfully" launching it, a breakpoint is triggered. I do not invoke any of AppName.exe features (e.g. open any modules, preform any functions).

"Application verifier triggers a breakpoint in AppName.exe.

This is an error in AppName.exe or any of the DLLs it has loaded."

The breakpoint occurs in crtexe.c at: if (has _cctor == 0)

_cexit();

How can I debug this?

Thank you.


Jesse Johnson

Reference document for Visual Styles

$
0
0

I am looking for a reference guide about the structure of the GUI elements when using and enhancing Visual Style themes.

I know already, that there is the description of the UxTheme API somewhere in the MSDN.

But, the most of these functions are kept very generic. They can be used for various parts and states - but I don´t know, which parts and states are supported by some concrete controls.

Specially I have two questions at the moment:

  • I have an edit control and I see there is a little bit of space between the left/right border and the text.How can I determinethesize of thesemargins?
  • I wish to make the width of the drop down button of combo boxes a little bit narrower. I found a way to resize the button while the combo box is not focused. But when the list is opened, the button is shown in its default style. Thus, how can I change the size of the button in this state of the combo box?

You see, these are questions about how are the GUI elements composed or which properties are provided by these GUI elements. I don´t find answers to these questions in the API documentation.

Thanks, regards
Friedbert Widmann


Jar Dependencies in Visual C++ Development in Visual Studio 2015

$
0
0

I'm attempting to add fmod to a cross-platform project.

I need to reference fmod.jar in my project, but I'm not sure how.

I've added it into a folder I've called lib, and I've updated my project.properties to include jar.libs.dir=lib, but when I attempt to call System.loadLibrary("fmod"); in my activity, it says it cannot find fmod.so.

I know it's aware of the fmod.so files during build (they are in each of the sub-folders in lib: arm64-v8a, armeabi, armeabi-v7a, and x86) because it complains if I move/remove any of them.

Any help would be greatly appreciated.

vs 2015 update 2 breaks build: fatal error C1083: Cannot open include file: 'winsdkver.h': No such file or directory

$
0
0

As in the title, after installed vs 2015 update 2 rtm, I cannot build any vs c++ solution:

In debug I get

fatal error C1083: Cannot open include file: 'winsdkver.h': No such file or directory

In release:

TRACKER : error TRK0005: Failed to locate: "midl.exe". The system cannot find the file specified.

So the update 2 (installed over a working update1) messed up my system.

How can we fix this?

VSL_COMMAND_MAP_ENTRY how to use it?

$
0
0

Hi

I'm trying to create a VSPackage in C++. Now... if I want to switch a menu item from visible to invisible. How can I do this? I did set the DynamicVisibility in the vsct (and by the way, it works in my C# samples, but this time as I sayed, I want to use C++ because I need a lot of C++ code inside this project that I don't want to port to C# and because I need only 5 menu items, I thought it's easier to create those 5 items than porting the code).

So, what I did was adding a a QueryStatusHandler like this:

    VSL_COMMAND_MAP_ENTRY(CLSID_VSPackage2CmdSet, cmdidMyCommand, CommandHandler::QueryStatusHandler(&OnMyStatusHandler), CommandHandler::ExecHandler(&OnMyCommand))

Then in the "OnMyStatusHandler" I tryed to do this:

the first parameter (CommandHandler*) is named pSender and I call pSender->SetVisible(false);

... now, I do get calls to this function. But for some reason nothing happens when I set it to invisible. Can someone give me a hint, why this could be??

thanks a lot

Rudolf

oh and by the way... I found out why it's so hard to write VSpackages in C++ compared to C# ... simple. The documentation is much worse. That's all...


[UWP] how to use C# collection in C++/cx

$
0
0

Hi 

   General Question, there is C# namespace available as UWP, which means the namespace I can also use in C++/CX.  

The namespace providing a object with Collection property this kind of object how can I suppose to use in C++/CX  ?

 Object i m looking for to convert :

  manifestObject.SelectedStreams    (C#)

   

   IVector <IManifestTrack> mySelectedStreams = mainfestObject->SelectedStreams , will it work ?

Thanks

-Gnash

  


Adding a drop-down menu button to a CMFCToolbar, not seeing menu, why?

$
0
0

I tried following all the examples I could find but I'm missing something so I will put all the pieces here for others to view. FYI - I'm modifying the MFC Feature Pack example Slider.

I see the layer button (not a string or down arrow) if I select the button (click) I see the depress motion and get to the OnLayers() function with the ID of the button. I almost looks like the ReplaceButton() is doing nothing.

Any ideas?

Thanks

For the toolbar I've added ID_LAYERS_1

My toolbar

IDR_MAINFRAME TOOLBAR 16, 15
BEGIN
    BUTTON      ID_FILE_NEW
    BUTTON      ID_FILE_OPEN
    BUTTON      ID_FILE_SAVE
    SEPARATOR
    BUTTON      ID_SLIDER
    SEPARATOR
    BUTTON      ID_EDIT_CUT
    BUTTON      ID_EDIT_COPY
    BUTTON      ID_EDIT_PASTE
    SEPARATOR
    BUTTON      ID_FILE_PRINT
    SEPARATOR
    BUTTON      ID_APP_ABOUT
    SEPARATOR
    BUTTON      ID_LAYERS_1
END


my menu is

IDR_LAYERS MENU
BEGIN
    POPUP "Layers"
    BEGIN
        MENUITEM "0",                           ID_LAYERS_1
        MENUITEM "1",                           ID_LAYERS_2
        MENUITEM "2",                           ID_LAYERS_3
    END
END



and the code

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWndEx)
   ON_WM_CREATE()
   ON_WM_CLOSE()
   ON_COMMAND(ID_SLIDER, OnSlider)
   ON_COMMAND(ID_VIEW_CUSTOMIZE, OnViewCustomize)
   ON_REGISTERED_MESSAGE(AFX_WM_RESETTOOLBAR, OnToolbarReset)
   ON_REGISTERED_MESSAGE(AFX_WM_TOOLBARMENU, OnToolbarContextMenu)
   ON_UPDATE_COMMAND_UI_RANGE(ID_LAYERS_1, ID_LAYERS_3, OnUpdateLayers)
   ON_COMMAND_RANGE(ID_LAYERS_1, ID_LAYERS_3, OnLayers)
END_MESSAGE_MAP()

CMFCToolBarMenuButton* CreateLayerButton()
{
   CMenu menu;
   VERIFY(menu.LoadMenu(IDR_LAYERS));

   CMFCToolBarMenuButton* pLayerButton = NULL;
   CMenu* pPopup = menu.GetSubMenu(0);
   ASSERT(pPopup != NULL);
   if (pPopup != NULL)
   {
      HMENU hMenu = pPopup->GetSafeHmenu();
      pLayerButton = new CMFCToolBarMenuButton(ID_LAYERS_1, hMenu, -1, NULL, FALSE);
   }

   return pLayerButton;
}

afx_msg LRESULT CMainFrame::OnToolbarReset(WPARAM wp, LPARAM)
{
   UINT uiToolBarId = (UINT)wp;
   if (uiToolBarId == IDR_MAINFRAME)
   {
      CSliderButton btnSlider(ID_SLIDER);
      btnSlider.SetRange(0, 100);
      m_wndToolBar.ReplaceButton(ID_SLIDER, btnSlider);

      // layer button/menu
      CMFCToolBarMenuButton* pLayerButton = CreateLayerButton();
      m_wndToolBar.ReplaceButton(ID_LAYERS_1, *pLayerButton);
      delete pLayerButton;
   }

   return 0;
}

void CMainFrame::OnUpdateLayers(CCmdUI* pCmdUI)
{
   //pCmdUI->SetCheck(true);
}

void CMainFrame::OnLayers(UINT id)
{
}

MSB6006: "CL" exited with code -1073471701

$
0
0

I rebuilt a C++ app in vs 2015 (64 bit) with uodate1 installed that had been building fine in vs 2012 in both release and debug modes. When I build the exact same app in vs 2015, the release mode builds but the debug mode fails with the above mentioned error. Can someone shed some light on this issue ?


clyde 0magna


Global Header Directory?

$
0
0

Hello Again:

   Last question of the day.

   I have a couple of directories I'd like to have searched for headers by every one of my C++ projects, before I specify headers each individual piece of code will need to search. 

   How can I specify these directories in a single place?  I expect that I'll have to give individual attention to the VS 2010 to VS 2015 conversion of each of the several hundred projects that make up this application and I'd like to minimize my workload. 

   Going in through <Properties - Configuration Properties - VC++ Directories - Include Directories> only seems to let me set include directories for a single project. 

   When I try to set environmental the INCLUDE environmental variable I go through the <Control Panel - Advanced system settings (Where I have to log in on an admin account) - System Properties - Advanced - Environmental Variables>. 

   Here I have an opportunity to set user variables for the admin account I log in as.  I believe I need to set them for the non-admin account I use to develop software.  How do I specify user variables for an account that's different that the admin account I log in as?

   I continue to appreciate your help, so much that I won't ask any more questions today.

      Thanks
      Larry

Clean install of VS2013 fails to build C++ project. Error: Could not find WindowsSDKDir variable from the registry.

$
0
0

I initially installed Visual Studio 2013 Professional on an internet-connected computer and had no problems. Recently, I have had to move to an offline system (still running Windows 7) and had to install everything from scratch.

Now I am getting the dreaded "Could not find WindowsSdkDir variable from the registry. TargetFrameworkVersion or Platform Toolset may be set to an invalid version number" warning, followed by errors along the lines of "Cannot open 'windows.h': No such file or directory".

I have spent all day trawling the internet for a solution and it seems that this is quite a common problem, but with no definite fix.

Following the suggestion here <links not allowed>, I have updated to the latest version (VS2013.5). This made no difference.

I have tried countless tweaks to the project settings and to Windows registry keys as suggested, for example, here <links not allowed> and here <links not allowed> and here <links not allowed>. However, none of these have worked.

Looking at the macros in my VS2013 project settings, I can see that $(WindowsSdkDir) does indeed have a blank value, but I simply cannot see how to fix it.

Any help would be greatly appreciated, as I'm really tearing my hair out over this...

How to convert CImage to ID2D1Bitmap

$
0
0

Title says everything. I have CImage and I want to have ID2D1Bitmap. I have code: 

ID2D1Bitmap* bitmap; // Create a pixel format and initial its format // and alphaMode fields. D2D1_PIXEL_FORMAT pixelFormat = D2D1::PixelFormat( DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE ); D2D1_BITMAP_PROPERTIES bitmap_props{ pixelFormat,480,480 }; m_pRenderTarget->CreateBitmap(size, bitmap_props, &bitmap);

======>>>>> How to fill the data from CImage, into this newly created bitmap?

So as can be seen from the above code bitmap is created. Now I need to get the data from CImage (which has info about png in it) in order to be able to do this:

m_pRenderTarget->DrawBitmap(bitmap, rectangle);

Any help really appreciated.

Thank you

What are the pros and cons of this sort function and how to call it

$
0
0
int unnamed_sort_function(int* a, int s)
{
	if (a == NULL || s <= 1)
		return 0; //fail! invalid arguments or parameters!
	int min = a[0], max = a[0];
	for (int i = 1; i < s; i++)
	{
		if (min > a[i])
			min = a[i];
		if (max < a[i])
			max = a[i];
	}
	int l = max - min + 1, *t = calloc(l, sizeof(int));
	if (t == NULL)
		return 0; //calloc failed!
	for (int i = 0; i < s; i++)
		t[a[i] - min]++;
	for (int i = 0, j = 0; i < l; i++)
		while (t[i]--)
			a[j++] = i + min;
	free(t);
	return 1; //success! the array has been sorted!
}
It really does the job and works like a charm, and I think that it's complexity is simply justO(n) only!

Low level write to 50+ flash drives using VDS, C++?

$
0
0

I'm wring a flash drive (USB fob) duplication program for Windows 7, and the goal is to write to 50+ flash drives at once.  I think I see a way, but I'm stuck on 2 issues.  

To get 50 drives mounted, we can mount them to empty NTFS folders (instead of using drive letters).  Using theVirtual Disk Service (VDS) Microsoft sample code found here I can see the mounted volumes and format them.  BUT here's where I'm stuck:  

  1. Using VDS, how do I differentiate between removable USB flash drives, and physical hard disks
  2. How do I low-level write, sector by sector, to these flash drives using VDS

I'm experienced with C++, but newish to COM and brand new to VDS and I seem to be stuck.  Is what I want to do even possible with VDS?  Any advice or guidance would be greatly appreciated! 






Getting Around Circular DLL Project References

$
0
0

Here’s the problem:
DLL Project A contains Function A1 that calls Function B1 in Project B.
DLL Project B contains Function B2 that calls Function A2 in Project A.
Neither project will link cleanly because it needs information about the other project in order to resolve external symbols. There are no C++ classes or object instantiations here to muddy the water - just procedural function calls.

These conflicting project pairs occur 33 times in code I’ve inherited from previous developers, who used Visual Studio 6 where I’ve heard that this kind of thing was allowed. I happened upon the following really clunky pseudo-solution and I’d like to know if there’s a better way:

  1. Tell each project about the xyz.lib files needed to resolve its external references (in the project’s “Linker | Input | Additional Dependencies“ parameter). Note that the linker will fail if these lib files are not available. SO …
  2. Create a DummyLibFile directory on your system and copy ANY small lib file into that directory. Copy it, paste a copy of it, and rename the copy to an actual lib file name that the linker will be looking for. Repeat this for every lib file name you listed in step 1.
  3. In the “Linker | General | Additional Library Directories” parameter, ensure the REAL library locations are listed first, and add the DummyLibFile location as the last location in the list.
  4. Set the “Linker | General | Force File Output” parameter to Undefined Symbol Only.

If you “Clean” the solution, then the first time you “Build” it, you can expect “unresolved external symbol” error messages, but the projects will still create lib files. The second time you “Build” the solution, the linker will see the real lib files and will resolve the references.

Like I said – really clunky. But it is much faster than refactoring 50+ projects for a clean rebuild every time. Are there any Visual Studio parameter settings that would make this job easier?

_mm_empty no looker work in visual studio 2015 update2

$
0
0

since in mmintrin.h with _WIN64 

it is

#if defined(_M_IX86)
/* General support intrinsics */
void  _m_empty(void);

but the header is 

#if !defined _M_IX86 && !defined _M_X64
    #error This header is specific to X86 and X64 targets
#endif

It is work with update1

Why is std::regex_match so slow?

$
0
0
I've tested performance of regex implementation in VS2015 and I found it unusable. The performance difference from the very old Microsoft regular library Greta is huge.

How to use GSL in C# with P/Invoke

$
0
0

Hi,

I want to use the GSL libraries in my C# application. How do I use P/Invoke to do that?

Regards,

Rahul

Different ways to get the "current" device context

$
0
0

Hi folks,

I noticed that if I call

    auto mSysWindow = GetActiveWindow();
    auto mSysDC = GetDC( mSysWindow );

I get a different value back than I would if I called

    auto mSysDC = wglGetCurrentDC();

Both give me some non-null value. Seems like the bottom one is correct, i.e., if I call GetPixelFormat( mSysDC ) with the result of the second one, it works fine. With the top one, it always returns a pixel format of 0.

So, why do I get two different values here?

Cheers,

Dave



Viewing all 15302 articles
Browse latest View live


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