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

How to make tabbed document view to float like visual studio 2012?

$
0
0

Hi all,

       I want to make a tabbed document view to float like visual studio 2012, is there any suggestion or example by using MFC of VS 2012?

       The expected result should be similar as following descripton:

Step 1:

use visual C++ of Visual studio 2012 to create/open a project, it will look as follows, the source file *.cpp is in tabbed mode, and then right click the tabbed head, it will show the menu "Float", click "Float", the result will be as step 2:

DocumentView in tabbed mode

Step 2:

      Following picture is the expected result that I want(result after click "Float"), as you see, the ClassView.cpp is in a floating window, not in tabbed mode, and in this case, you could also drag the window back to the tabbed view.

Step 3:

   using spy++ to see the result, it will be as follows, it seems the VS 2012 had changed a lot comparing to VS 2008

  So how to implement with MFC in visual studio 2012 to make a tabbed document view to float just  like VS 2012?

  Currently we could use VS 2012 to create a default multi-document project with style VS 2008(like VS sample in VS2008 MFC Feature Pack ), but currently it had not support to float a tabbed document view(Using CMFCTabCtrl and so on). it could only float a window which inherit CDockablePane.

   Any suggestion is welcome, and it will be more helpful if you could give some sample project.

 



PC says: file mcf71.dll is missing

$
0
0

 I installed CCleaner, and later understood I cant manage with files, what CCleaner offered me to delete.. Because i'm not techi.... So, I think I deleted mcf71.dll. But sometimes before I had this error and I resolved the problem using Windows update..

Now I used everything what recommended me different forums, but it does not help me..

 I cant open my pictures and install the pictures from my camera to my PC. I was going to download  Microsoft Visual Studio .NET 2003 program, but cant choose a file before installation..Please Help.

 I'm sure  my PC hasn't got viruses, because I bought NOD 32 and use it. I use Windows 10.

Look forward to get your reply

Mrs. Loosemore

Why CLSID_SampleGrabber is undefined ? How can i resolve it ?

$
0
0

The error:

Severity Code Description Project File Line Suppression State
Error (active)  identifier "CLSID_SampleGrabber" is undefined VideoCaptureFilterSample

I set in the project include directory to C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1\Samples\multimedia\directshow\baseclasses

There after install directx sdk 2007 I copied to there the file dxtrans.h

But still the CLSID_SampleGrabber not exist undefined.

I did as they did in this solution: https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/ed097d2c-3d68-4f48-8448-277eaaf68252/dxtransh-missing-in-microsoft-directx-sdk-november-2007?forum=windowssdk

But it's not working.

Migrating MSXML4 to MSXML6 in C++ project

$
0
0

Hello everybody,

In my C++ project, I am using MSXML4 to validate and transform XML document using Schemas and XSLT.
I would like to upgrate to MSXML6 but I don't know how to proceede.

Could any one help me?

Hereafter is the part of code I am using :

---------------------------------------------------

 BOOL bResult = FALSE;
 IXMLDOMDocument2 *pXslDocument  = NULL;
 IXMLDOMDocument2 *pXmlDocument  = NULL;
 IXSLTemplate     *pXslTemplate  = NULL;
 IXSLProcessor    *pXslProcessor = NULL;
 IXMLDOMSchemaCollection *pXMLDOMSchemaCollection = NULL; 
 HRESULT hr;


 try
 {

  hr = CoInitialize( NULL );
  SUCCEEDED( hr ) ? 0 :throw _com_error( hr );
  
  hr = CoCreateInstance(CLSID_XSLTemplate40,
       NULL,
       CLSCTX_SERVER,
       IID_IXSLTemplate,
       (LPVOID*)(&pXslTemplate));

  SUCCEEDED(hr) ? 0 : throw _com_error( hr );  
  if(!pXslTemplate)
  {
   sprintf(buffer,"Unexpected error <%d> during  CoCreateInstance. pXslTemplate is NULL", errno);
   RS_DEBUG0(buffer);
   *ErrorMsg = strdup(buffer);
   goto Exit;
  }

  hr = CoCreateInstance(CLSID_FreeThreadedDOMDocument40,
       NULL,
       CLSCTX_SERVER,
       IID_IXMLDOMDocument2,
       (LPVOID*)(&pXslDocument));

.....

--------------------------------------------------

Is there a memory leak in CSimpleArray SetAtIndex?

$
0
0

Is there a memory leak in CSimpleArray SetAtIndex? It's probably my fault, but I don't know how.

I have this type definition:

typedef CSimpleArray<CLumTypeData> ListOfLumTypeDatas_t;

and this declaration in the main MFC app class:

    ListOfLumTypeDatas_t m_GlobalLumCatalog;

The program wants to replace objects in the list with newer versions so I use:

        m_GlobalLumCatalog.SetAtIndex(ikLum, kNewData);

But that gives me a memory leak. Is my use of CSimpleArray incorrect?

Should I RemoveAt and Add instead?



http://www.ransen.com Cad and Graphics software

CLI button datagridview right click event.

$
0
0
Hi!

I hope someone can help me with this problem. I am working with CLI in visual studio 2013.
I have a DataGridView with button columns, the buttons are generated dynamically, therefore i can't define an event handler for each of them individually, also there are a lot of buttons so it wouldn't be a good approach.

I have an event handler for the DataGridView that is called every time a cell is clicked. However, i want it to do something different if the cell is right-clicked. Is there anyway I could do that with the DataGridView event handler?

Thank you for your help!

Upgrading C++ Project from VS2003 to 2010

$
0
0

I'm inheriting a large set of C++ projects at work and there is one in particular I need to figure out.

So far, I'm able to compile the dependency libraries but the main project fails due to the XSD.

When I open the code for the two .xsd files in my main project, the XML looks fine and intellisense doesn't bark at me. I can compile the .xsd files to create .h files (and .xss/xsx files) just fine. No errors.

When I compile the main project (or the solution) the compilation dies while trying to compile the header files generated from the .xsd files.

The compiler seems to be creating false positive errors..hits the 100 error max and quits on me.

For example, this is the first error, line 14:

Error2error C2144: syntax error : 'dsEXT' should be preceded by ';'

Here are the first 14 lines of that file:

#pragma once#using <mscorlib.dll>#using <System.dll>#using <System.Data.dll>#using <System.Xml.dll>using namespace System::Security::Permissions;[assembly:SecurityPermissionAttribute(SecurityAction::RequestMinimum, SkipVerification=false)];// // This source code was auto-generated by xsd, Version=4.0.30319.1.// using namespace System;ref class dsEXT;  //this is line 14...KABOOM and tons of errors afterward

....Another example, here are the first few errors:

Error   2   error C2144: syntax error : 'dsEXT' should be preceded by ';'  
Error   3   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int  
Error   4   error C2059: syntax error : 'public'   
Error   5   error C2059: syntax error : 'public'   
Error   6   error C2143: syntax error : missing ';' before '{' 
Error   7   error C2447: '{' : missing function header (old-style formal list?)
Error   8   error C2039: '{ctor}' : is not a member of 'dsEXT' 
Error   9   error C2059: syntax error : ')'
Error   10  error C2143: syntax error : missing ';' before '{' 
Error   11  error C2447: '{' : missing function header (old-style formal list?)
Error   12  error C2039: '{ctor}' : is not a member of 'dsEXT' 
Error   13  error C2143: syntax error : missing ')' before '^' 
Error   14  error C2143: syntax error : missing ';' before '^' 


I'm happy to provide more info..


Could not find a part of the path 'D:\c\vs2015\kbrd\Keyboard Input WDF Filter Driver(Kbfiltr)\C++\test2\ReadMe.txt'

$
0
0

I have always stayed away from spaces in directory names, but considering this was a sample solution that I was adding to and modifying, I left the directory structure the way it was. Now when I try to access anything in test2 with the full path string as in

sfin = "D:\\c\\vs2015\\kbrd\\Keyboard Input WDF Filter Driver(Kbfiltr)\\C++\\test2\\ReadMe.txt";

I get "Could not find a part of the path...." Using 8.1 pro, VS2015, .net 4.5.2, path/files exist. I tried enclosing quotes, no luck. Many unanswered successfully posts on this. What am I missing on this? There must be a way to specify files with spaces in the directory path in .net. When I get individual directory strings for Directory::GetDirectories its all good as in

array <String^> ^as0= Directory::GetDirectories("D:\\c\\vs2015\\kbrd\\");
		array <String^> ^as1 = Directory::GetDirectories(as0[6]);
		array <String^> ^as2 = Directory::GetDirectories(as1[0]);
		array <String^> ^as3 = Directory::GetDirectories(as2[9]);

 

CMFCMaskedEdit OnPaste problem when no mask is enabled

$
0
0
Hello,

I have a problem with the CMFCMaskedEdit with no masked enabled but with
SetValidChars(_T("0123456789-+"))
set. When in the editor the number "12345" is shown and I select all "12345" and paste "678" the "678" is added to the front of "12345" -> "67812345" instead of replacing the text that would be the expected behavior of an edit control.

You can verify the problem in the "NewControls" sample of the "Visual C++ 2008 Feature Pack" from the Visual Studio 2010 samples. In the Page4.cpp file disable the call to EnableMask of the m_wndMaskEdit5 and add the call m_wndMaskEdit5.SetValidChars(_T("+-0123456789")); Build and start the application and change to the "Masked Edit" page and select the whole text of Mask 5: digits only edit control and paste e.g. "678".

Andreas

New VS 2015 - Cannot find or open the PDB file

$
0
0

Hi Folks:

   Developing on VS 2015, Windows 8.1.

   I'm moving from VS 2010 to VS 2015 Community. 

   I was unable to compile, or do much with VS 2015 when I installed it the first time, it couldn't even find Windows.h. 

   So I wiped my C: drive and re-installed everything to provide a clean environment for VS 2015. 

   Before I ask the most important question, I don't have a desktop icon for VS 2015.  I can run it by searching for it, but I'd like to know where I can find the VS 2015 executable or launcher so I can create a shortcut for it. 

   Anyway...

   The compiles seem to work on the very simple code I wrote to test it. 

   When I try to debug the application, I get the following errors. 

'first_simple_code_from_empty.exe' (Win32): Loaded 'E:\learn\visual_studio_2015\02_first_simple_code_from_empty\first_simple_code_from_empty\Debug\first_simple_code_from_empty.exe'. Symbols loaded.
'first_simple_code_from_empty.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'first_simple_code_from_empty.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'first_simple_code_from_empty.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'first_simple_code_from_empty.exe' (Win32): Loaded 'C:\Windows\SysWOW64\WRusr.dll'. Cannot find or open the PDB file.

                              .
                              .
                              .

'first_simple_code_from_empty.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file.
'first_simple_code_from_empty.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. Cannot find or open the PDB file.
'first_simple_code_from_empty.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. Cannot find or open the PDB file.
The program '[11312] first_simple_code_from_empty.exe' has exited with code -1 (0xffffffff).

   I install all of Visual Studio 2015's components. 

   What am I doing wrong?

      Thanks
      Larry

ctoolbar to cmfctoolbar

$
0
0

Hello,

I'm changing my ctoolbar to cmfctoolbar. I've got two promblems.

First of all, i cannot see icons.

Second problem is that my icons are in many bitmaps, with my ctoolbar I can use  GetToolBarInterface().AddBitmap to declare them, but there is no addbitmap with cmfctoolbar. how can I do ?

Thanks

Yan

Issue with MDIGetActive in Visual Studio 2013

$
0
0

I'm currently upgrading my project from Visual Studio 2008 to 2013. Currently when I call MDIDestroy() to close the active CMDIChildWnd that I got from MDIGetActive(), it crashes. When I look at the object in the debugger, it looks like it isn't fully instantiated or something:

0x0590b4b0 {hWnd=0x00091218 {unused=??? }} CMDIChildWnd *

I don't have any problems with it in Visual Studio 2008. Does anyone have any ideas what might be happening or what to look for?

how can i call a .net webservice in mfc for device

$
0
0
how can i call a .net webservice in mfc for device

Are the COM samples Locclien/Locserve still available, if so where can i find them ?

$
0
0

Hi

I was looking for tutorials and samples about how to write an out-of-process COM server. I found a few answers here and there at stackoverflow, but all of them point to this website :

https://msdn.microsoft.com/en-us/library/aa230606(v=vs.60).aspx

It is exactly what i was searching for. I need these samples from that SDK :

https://msdn.microsoft.com/en-us/library/aa230606(v=vs.60).aspx

https://msdn.microsoft.com/en-us/library/aa230607(v=vs.60).aspx

https://msdn.microsoft.com/en-us/library/aa230619(v=vs.60).aspx

The MSDN documentation about COM is simply not enough. Well, there is this site for downloads :

https://blogs.msdn.microsoft.com/codefx/2010/11/25/all-in-one-com-code-samples/

What i need is to write an out-of-process COM server to be able to talk across bit boundaries, means i need to marshal function calls. To be precisely i want to have a single app ( client ) that installs and communicates with 2 servers, one 32 and the other 64 bit. The Locclien/Locserve sample is telling exactly my scenario in the description and it is mentioned in nearly all good answers out there in web, but there are no download links anylonger on Microsoft's websites....

Any idea where i can get them ?

Regards,

co0Kie

cmfctoolbar and user bitmap

$
0
0

Hi,

I would like to use an image collection, and button and only this in my toolbar.

I'm trying to use SetUserImages and InsertButton from my CMFCToolBar, but ... nothing is displayed

I'm thinking I've made something wrong, no call to loadbitmap nor loadtoolbar, but OnPaint test pImage validity which is avery times wrong.

could anyone help me please ?

Thanks

Yan


GattDeviceService::FromIdAsync won't create the service

$
0
0

I'm working from the Heart Rate Monitor example presented in

https://code.msdn.microsoft.com/windowsapps/Bluetooth-Generic-5a99ef95#content I only have changed the UUID so it connects to the generic access (0x1800) service on my own BLE device. The device does appear but when I click on it, the service is not created. As far as I understand, the operation

return create_task(GattDeviceService::FromIdAsync(device->Id))
            .then([this, device] (GattDeviceService^ service)

doesn't work or at least the access is not granted, so the verification

if (service != nullptr)
            {
                this->service = service;
                IsServiceInitialized = true;
                return ConfigureServiceForNotificationsAsync();
            }
            else
            {
				MainPage::Current->NotifyUser(device->Id, NotifyType::StatusMessage);
            }

is false and the program stops.

The device is well paired, otherwise it would be found by the code.

I managed to get the Device ID  returned by windows, which is this:
\\?\BTHLEDevice#{00001800-0000-1000-8000-00805f9b34fb}_d2f28afd324a#&&1a50d254&9&001#{6e3bbb679-4372-40c8-9eaa-4509df2-60cd8}

What am I doing wrong?


How to close a DirectX 11 UWP app ?

$
0
0

Hi everybody,

I'm playing with a directX 11 UWP template and try ( not very successful ) to close the application via a "Close" Button I have implemented with Direct2D.

I tried with bing and with MSDN ..

Seems as if this problem is too easy or so - can anyone of the experts tell me if there is a valid way to close my app while it is in full screen mode for example ??

Thanks,

Charlie

'winsdkver.h': No such file or directory

$
0
0

Help!!!!!

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppBuild.targets(344,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
1>  stdafx.cpp
1>c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\afxv_w32.h(25): fatal error C1083:  'winsdkver.h': No such file or directory

  •  I had no problem with the debug , Please help me !!!

I Try Microsoft SDK for Windows 7 and NET Framework 4  but I have a problem message  'winsdkver.h': No such file or directory

Type library #import without registration

$
0
0

In a Visual C++ application, the compiler is able to locate type libraries referenced by #import on disk (via search paths) without registration. However, if that type library contains any references (importlib), the compiler will fail to find that reference without registration, even if the *.tlb file is located in a directory that is present in the appropriate search paths.

This poses a problem for our build environment, since we use registration-free COM and would like to avoid registration during the build. How can we achieve a registration-free build in this situation?

Resource Name Not Found In Image File

$
0
0

Hi Folks:

   Developing in VS 2015 Community, Win 8.1, C++, WIN32 not MFC.

   I'm trying to get my first simple program through VS 2015.  As I find with so many new tech toys and tools, I'm an idiot when I first confront what usually turns into something useful. 

   I did a full install of VS 2015, all of the pieces I could get from that one "everything" button. 

   A quick question first.  Where is the executable?  VS 2015's install didn't leave an icon on my desktop so I want to  create a shortcut. 

   Anyway...

   A call to DialogBox() is returning error code 1814, The specified resource name cannot be found in the image file.

   Here is the call:

    dialogbox_return = DialogBox(hinstance,"IDD_SIMPLE_PROGRAM_DIALOG_BOX",
                            NULL,
                            (DLGPROC)simple_program_dialog_box);

  And here is the .rc file:

//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Resource.rc
//
#define IDD_DIALOG1                     101
#define IDD_SIMPLE_PROGRAM_DIALOG_BOX   101

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        103
#define _APS_NEXT_COMMAND_VALUE         40001
#define _APS_NEXT_CONTROL_VALUE         1001
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif

   The only resource I can think of is the dialog identified by "IDD_SIMPLE_PROGRAM_DIALOG_BOX".  It's referenced in the call and is identified in resource.h. 

  This is an multibyte project.

  Here is the entire program:

#include <windows.h>
#include <iostream>
#include <string>
#include "resource.h"

const int COMMON_ERROR_TEXT_BUFFER_SIZE = 1000;

INT_PTR CALLBACK simple_program_dialog_box(HWND hdlg,
    UINT message,
    WPARAM wParam,
    LPARAM lParam);

std::string *error_code_to_stringA(DWORD error_number, std::string *string_ptr);

int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance,
    PSTR szCmdLine, int iCmdShow)
{
    INT_PTR dialogbox_return = 0;
    DWORD error_code = 0;
    std::string error_string;

    SetLastError(0);

    dialogbox_return = DialogBox(hinstance,
                            "IDD_SIMPLE_PROGRAM_DIALOG_BOX",
                            NULL,
                            (DLGPROC)simple_program_dialog_box);

    if (dialogbox_return == -1)
    {
        error_code = GetLastError();

        if (error_code != 0)
        {
            error_code_to_stringA(error_code, &error_string);
        }
    }
}

INT_PTR CALLBACK simple_program_dialog_box(HWND hdlg,
    UINT message,
    WPARAM wParam,
    LPARAM lParam)
{
    switch (message)
    {
    case WM_INITDIALOG:

#ifdef _DEBUG
    {
        int test_x = 0;
    }
#endif

    return FALSE;
    }

    return 0;
}

std::string *error_code_to_stringA(DWORD error_number, std::string *string_ptr)
{
    std::string *return_val = string_ptr;
    DWORD format_return = 0;
    char message_buffer[COMMON_ERROR_TEXT_BUFFER_SIZE];

    if (string_ptr != NULL)
    {
        *message_buffer = 0;

        // This function returns the number of TCHARs formated.
        FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM,
            NULL,
            error_number,
            0,
            message_buffer,
            COMMON_ERROR_TEXT_BUFFER_SIZE,
            NULL);

        *string_ptr = message_buffer;
    }

    return return_val;
}

   My goal right now is to hit a break point in the WM_INITDIALOG clause.

  Suggestions?

      Thanks
      Larry




Viewing all 15302 articles
Browse latest View live


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