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

WebSocket and C++

$
0
0

What is the best way to add WebSocket (client) support to an MFC based project?

I would just be interested in people opinions and reasonings.

Thanks.


vs-2015-snapshot-recordset-not-updatable

$
0
0

I have upgraded my project from VS 6.0 to VS 2015 after the conversion when i tried to run the code it is giving me warning "Driver does not support requested concurrency. Setting Record set read only." I have opened recordset with default options.Same was working with VS 6.0 I have opened database connection with useCursorLib option true. 


Version details:
AppMsg - DBMS: Microsoft SQL Server
AppMsg - Version: 12.00.4213
AppMsg - ODBC Driver Manager Version: 03.80.0000

When I did research on this I found a resolution on stack overflow which suggest to override AllocConnect function, please find the code of the same below:

void MyCDatabase::AllocConnect(DWORD dwOptions)
{
CDatabase::AllocConnect(dwOptions);

dwOptions = dwOptions | CDatabase::useCursorLib;

// Turn on cursor lib support
if (dwOptions & useCursorLib)
{
    ::SQLSetConnectAttr(m_hdbc, SQL_ATTR_ODBC_CURSORS, (SQLPOINTER)SQL_CUR_USE_ODBC, 0);
    // With cursor library added records immediately in result set
    m_bIncRecordCountOnAdd = TRUE;
}
}

Is it OK if I go ahead with this resolution or is there another way to fix this issue.

GDI and GDI+ lines draw differently in Print

$
0
0

I have a VC++ MFC program that draws a box by GDI lines and GDI+ lines. I give the same coordinates to both, and both draw OK on the screen. However, when I call the same code to do paper printing, the GDI box is correctly printed, but the GDI+ box is far bigger.

Do I have to make some adjustment?


VS 2013 linker error - v4.0\V120\Microsoft.CppCommon.targets(607,5): error MSB6006: "link.exe" exited with code -1073741819

$
0
0

Get erratic linker error building a large solution containing several projects. Specific error is:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(607,5): error MSB6006: "link.exe" exited with code -1073741819

This does not seem to happen for the same project each time. After this link failure, if I run "Build Solution" once again, it proceeds further and succeeds on second attempt. When I clean the entire solution and start the Build a fresh, it fails in one or more projects with the above error.

screen capture of UI failed when minimized or other window overlaps

$
0
0

Hello,

  The following problem happens to my program on WinXP, and seems not in Win7. I want to solve it so the problem goes on WinXP.

  My target is to capture an image of my user interface, and I "assembled" the following codes with what I found on web. However, it works only when my UI is showing on top of the screen (i.e. nothing else overlaps, and it is not minimized). Is there a way that I can guarantee a capture in all circumstances (i.e. other windows overlaps, minimized, etc)? 

    CDC * pDC = GetDC();

    HDC hScreenDC = pDC->GetSafeHdc();
    HDC hMyDC= CreateCompatibleDC(hScreenDC);

    RECT rect;
    GetWindowRect(&rect);
    int iScreenWidth = rect.right - rect.left + 1 - 2*GetSystemMetrics(SM_CYFIXEDFRAME);
    int iScreenHeight = rect.bottom - rect.top + 1 - GetSystemMetrics(SM_CYSIZE)- 2*GetSystemMetrics(SM_CXFIXEDFRAME)- GetSystemMetrics(SM_CYMENU);

    int iBpi= GetDeviceCaps(hScreenDC ,BITSPIXEL);


    BITMAPINFO info_bitmap;
    BITMAPFILEHEADER Header;
    memset(&info_bitmap, 0, sizeof(info_bitmap));
    memset(&Header, 0, sizeof(Header));
    info_bitmap.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
    info_bitmap.bmiHeader.biWidth = iScreenWidth;
    info_bitmap.bmiHeader.biHeight = iScreenHeight ;
    info_bitmap.bmiHeader.biPlanes = 1;
    info_bitmap.bmiHeader.biBitCount  = iBpi;
    info_bitmap.bmiHeader.biCompression = BI_RGB;
    Header.bfType = 0x4D42;
    Header.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);

    void *data;
    HBITMAP hBitmap = CreateDIBSection(hMyDC,&info_bitmap,DIB_RGB_COLORS,(void**)&data,0,0);
    // Select it into your DC
    SelectObject(hMyDC,hBitmap);

    // Copy image from screen
    BitBlt(hMyDC, 0, 0, iScreenWidth, iScreenHeight, hScreenDC , 0, 0, SRCCOPY);

    CString tmp = path.Get_result_image_filepath(info);
    std::fstream hFile(path.Get_result_image_filepath(info), std::ios::out | std::ios::binary);
    if (hFile.is_open())
    {
	hFile.write((char*)&Header, sizeof(Header));
        hFile.write((char*)&info_bitmap.bmiHeader, sizeof(info_bitmap.bmiHeader));
        hFile.write((char*) data, (((iBpi * iScreenWidth + 31) & ~31) / 8) * iScreenHeight);
        hFile.close();
        DeleteObject(hBitmap);
    }
    hFile.close();
    ReleaseDC(pDC);


QueryInterface for IUnknown fails for instance of IDXGIOutputDuplication

$
0
0

In the Windows 10 Anniversary Update (final bits), querying for IUnknown for a returned instance of IDXGIOutputDuplication seems to cause an access violation.

It is necessary to query for IUnknown to use this stuff with .NET, as the RCW (runtime callable wrapper) makes this call to determine the identity of the underlying object.

This can be reproduced in your sample available here:

https://code.msdn.microsoft.com/windowsdesktop/Desktop-Duplication-Sample-da4c696a

In file DuplicationManager.cpp, add these two lines after the call to DuplicateOutput succeeds:

	void* unknown;
	DWORD result = m_DeskDupl->QueryInterface(IID_IUnknown, &unknown);

Context:

    hr = DxgiOutput1->DuplicateOutput(m_Device, &m_DeskDupl);
    DxgiOutput1->Release();
    DxgiOutput1 = nullptr;
    if (FAILED(hr))
    {
        if (hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE)
        {
            MessageBoxW(nullptr, L"There is already the maximum number of applications using the Desktop Duplication API running, please close one of those applications and then try again.", L"Error", MB_OK);
            return DUPL_RETURN_ERROR_UNEXPECTED;
        }
        return ProcessFailure(m_Device, L"Failed to get duplicate output in DUPLICATIONMANAGER", L"Error", hr, CreateDuplicationExpectedErrors);
    }

	void* unknown;
	DWORD result = m_DeskDupl->QueryInterface(IID_IUnknown, &unknown);

    return DUPL_RETURN_SUCCESS;

Please advise!

What does CWinApp::LoadStdProfileSettings do?

$
0
0

Hello,

I have a C++ MFC program in Visual Studio 2015.  It has a LoadStdProfileSettings(); in it.

If I right click on it and select Go To Definition, it shows this line void LoadStdProfileSettings(UINT nMaxMRU = _AFX_MRU_COUNT); in afxwin.h.  If I right click on that and select Go To Definition, it does nothing.

Does anybody know what CWinApp::LoadStdProfileSettings does or how to use it?

This article does not say very much about it and I can't find any document that explains what it does.

Any help would be gratefully appreciated.

Thanks,
Tony


Stop The World, I want To Get Off! ........... Life Isn't About Waiting For The Storm To Pass ... It's About Learning To Dance In The Rain.

White Board Implementation Using WM_POINTER??

$
0
0

I want to implement white board for touch desktop using WM_POINTER and interaction context ??

can any one provide me some samples of white board implementation on touch desktop??

Regards,

shiva110

 


C++ CLI Listview

$
0
0

hi.

im using c++ CLI  trying to add controls like labels and progressbars and buttons and stuff into subitems... and apparently this doesn't work:

Button^ Subbtn;
Subbtn->ForeColor = System::Drawing::Color::Red;
Subbtn->Text = "'Create file'";
ListViewItem^ MyListItem  = gcnew ListViewItem("File Url");
MyListItem->SubItems->Add (SubLabel);

MyList->Items->Add(MyListItem);

i get error at the  "SubItems->ADD (SubLabel);"

can anyone help me pleasy please :-)

How to detect which network interface received UDP packet using c++ in windows 7?

$
0
0

Hi,

I have a windows 7 machine with 3 Ethernet interfaces.

I created a UDP Socket and bound to INADDR_ANY.When the socket receives broadcasted UDP packet how to know which network interface received it?

I need to get IP address corresponding to the network interface also?

Please anyone help me.



Convert SDI window into MDI child

$
0
0

In an existing MDI application one of the option opens a SDI window which is in the DLL. I have to make that SDI window to open in the tab beside other MDI child windows keeping it in the DLL itself. To achieve that I tried converting the SDI window to MDI child window by deriving CMainFrame from CMDIChildWnd which was derived from CFrameWnd earlier. Beside that, in the initialization I changed CSingleDocTemplate to CMultiDocTemplate

m_pDocTemplate = new CMultiDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CEditDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CEditView));

AddDocTemplate(m_pDocTemplate);
m_pMainWnd = dynamic_cast<CMDIFrameWnd*> (CWnd::FromHandle(pMainWnd)); // pMainWnd is AfxGetMainWnd()->m_hWnd passed from MDI application 
m_pFrame = (CMainFrame *)(m_pDocTemplate->CreateNewFrame((CEditDoc *)hDocHandle, NULL));

In CreateNewFrame() it trips an assert() at ASSERT_KINDOF(CMDIFrameWnd, pMainWnd); and crashes with access violation.

I have not done anything of this kind before. Is it the right way to do it? Any better way of doing it?

Thanks in advance.

what is dxguid.lib?

$
0
0
when I build a project,
the error is 
error 1 fatal error LNK1104:  could not open file “dxguid.lib” MpegToWav MpegToWav
How should I do?
Thanks.

How to monitor(get notified about)network interface status in windows (xp, vista,7) using c++?

$
0
0

Hi,

Using C++ how to monitor(get notified about)  below network interface status details.

1.whether new network interface adapter is added

2.Network interface is connected/disconnected

3.Any changes in network interface( for e.g ip change)

Thanks in advance.

Class with deleted copy constructor and implemented move constructor does not work when passed from managed C++ to native C++

$
0
0

Managed(pseudocode):

System::String^ serverName = "Hello!";

std::string serverNameNative = marshal_as<std::string>(serverName);
CString serverNameTransfer(serverNameNative.c_str(), serverNameNative.length());//CString native C++ class with deleted copy constructor in native dll

Server::Initialize(std::move(serverNameTransfer));//static method in native dll

Native

class __declspec(dllexport) CString
{
private:
char* _ptr;
size_t _length;
CString(const CString& other) = delete;
CString& operator=(const CString&) = delete;
public:
CString(CString&& other);
CString& operator=(CString&& other);
CString(const char* s, size_t len);
CString();
~CString();
size_t length() const;
const char* c_str() const;
};

The problem that appears to happen is(call stack):

Common.dll!CString::~CString() Line 45C++
 [Managed to Native Transition]
 Managed.dll!CString.<MarshalDestroy>(CString* A_0)Unknown

that my object gets deleted in the marshalling step and the resulting object in

static void Initialize(CString nodeName); //in class Server

is a shallow copy of serverNameTransfer with the memory at serverNameTransfer._ptr deleted by.<MarshalDestroy>

How can I fix this?

unresolved external symbol __GSHandlerCheck and /GS- switch

$
0
0

I'm trying to build an executable which is not linking to Microsoft's C Standard Library, but it looks like the '/GS-' switch of CL.EXE is ignored (same goes for '/sdl-').

Linking with 'bufferoverflowU.lib' removes a few linker errors for the security cookies, but leaves the __GSHandlerCheck undefined. I could not find the symbol in any of the CRT's source files, and neither could I find it in any of the compiled libraries. It's always defined as an external symbol in any of Microsoft's CRT libraries.

However, I found it in LINK.EXE: http://puu.sh/qz4QL/77eb840cc0.png

Any ideas how to get this working, without copying the sources from LINK.EXE into mine?


Unable to correctly generate a C++ project template of projects with a property sheet attached

$
0
0

I'm trying to create a C++ project template out of an empty project with some custom property sheets (.props) attached to the project and it has been very unsuccessful so far. Here are the problems I encountered:

First of all, if the property sheet file is added only from the Property Manager, it does not get included in the template export and thus a "file not found" error will occur while trying to instantiate the template. Adding the property sheet into the project as a resource file solves this problem.

What got me is that even after the property sheet file is included, the "file not found" error still appears upon loading the project file. After some inspection, it seems that when instantiating a project template, the project file is created and loaded before any other project item is copied into the folder. This process will not affect source files and resource files, as their presence is not required to load the project file. But a missing property sheet, on the other hand, causes a "file-not-found" error and breaks the whole process.

I love property sheets and I use them extensively to modulize build settings and library dependencies. Is there anyway I can create a project template with property sheets attached?

* Using Visual Studio 2015 Update 2

Compile Error Report: VC++ 2005 Office Automation using TypeLib

$
0
0

following the instruction of kb 307473<How to use a type library for Office Automation from Visual C++ .NET>

 http://support.microsoft.com/kb/307473/

I do following step:

1. Create a new dialog-based application using MFC AppWizard.

2. Add MFC class from typelib, I choose "Microsoft Word 11.0 Object Library<8.3>", because I have Office2003 installed on my machine. Select interface "_Application", then I get a new file "CApplication.h".

3.Add "#include "CApplication.h" into the first line of file "XXXDlg.cpp", compile! Then I get a pile of errors and warnings:

Build Log
  

Rebuild started: Project: AutoProject, Configuration: Debug|Win32

Command Lines
  
Creating temporary file "e:\temp\AutoProject\AutoProject\Debug\RSP0000029203284.rsp" with contents
[
/Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_AFXDLL" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Yu"stdafx.h" /Fp"Debug\AutoProject.pch" /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /c /Wp64 /ZI /TP .\AutoProjectDlg.cpp

.\AutoProject.cpp
]
Creating command line "cl.exe @e:\temp\AutoProject\AutoProject\Debug\RSP0000029203284.rsp /nologo /errorReport:prompt"
Creating temporary file "e:\temp\AutoProject\AutoProject\Debug\RSP0000039203284.rsp" with contents
[
/Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_AFXDLL" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Yc"stdafx.h" /Fp"Debug\AutoProject.pch" /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /c /Wp64 /ZI /TP .\stdafx.cpp
]
Creating command line "cl.exe @e:\temp\AutoProject\AutoProject\Debug\RSP0000039203284.rsp /nologo /errorReport:prompt"
Output Window
  
Compiling...
stdafx.cpp
Compiling...
AutoProject.cpp
AutoProjectDlg.cpp
e:\temp\autoproject\autoproject\debug\msword.tlh(13450) : error C2146: syntax error : missing ';' before identifier 'Fonts'
e:\temp\autoproject\autoproject\debug\msword.tlh(13450) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(13450) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(13505) : error C2146: syntax error : missing ';' before identifier 'GetFonts'
e:\temp\autoproject\autoproject\debug\msword.tlh(13505) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(13505) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(13505) : warning C4183: 'GetFonts': missing return type; assumed to be a member function returning 'int'
e:\temp\autoproject\autoproject\debug\msword.tlh(18687) : error C2146: syntax error : missing ';' before identifier 'Assistant'
e:\temp\autoproject\autoproject\debug\msword.tlh(18687) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18687) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18727) : error C2146: syntax error : missing ';' before identifier 'LanguageSettings'
e:\temp\autoproject\autoproject\debug\msword.tlh(18727) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18727) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18735) : error C2146: syntax error : missing ';' before identifier 'AnswerWizard'
e:\temp\autoproject\autoproject\debug\msword.tlh(18735) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18735) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18747) : error C2146: syntax error : missing ';' before identifier 'FileDialog'
e:\temp\autoproject\autoproject\debug\msword.tlh(18747) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18747) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18761) : error C2146: syntax error : missing ';' before identifier 'CommandBars'
e:\temp\autoproject\autoproject\debug\msword.tlh(18761) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18761) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18765) : error C2146: syntax error : missing ';' before identifier 'VBE'
e:\temp\autoproject\autoproject\debug\msword.tlh(18765) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18765) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18783) : error C2146: syntax error : missing ';' before identifier 'NewDocument'
e:\temp\autoproject\autoproject\debug\msword.tlh(18783) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18783) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18843) : error C2146: syntax error : missing ';' before identifier 'FileSearch'
e:\temp\autoproject\autoproject\debug\msword.tlh(18843) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18843) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18857) : error C2146: syntax error : missing ';' before identifier 'COMAddIns'
e:\temp\autoproject\autoproject\debug\msword.tlh(18857) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18857) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18891) : error C2146: syntax error : missing ';' before identifier 'GetAssistant'
e:\temp\autoproject\autoproject\debug\msword.tlh(18891) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18891) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18891) : warning C4183: 'GetAssistant': missing return type; assumed to be a member function returning 'int'
e:\temp\autoproject\autoproject\debug\msword.tlh(18936) : error C2146: syntax error : missing ';' before identifier 'GetCommandBars'
e:\temp\autoproject\autoproject\debug\msword.tlh(18936) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18936) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18936) : warning C4183: 'GetCommandBars': missing return type; assumed to be a member function returning 'int'
e:\temp\autoproject\autoproject\debug\msword.tlh(18940) : error C2146: syntax error : missing ';' before identifier 'GetVBE'
e:\temp\autoproject\autoproject\debug\msword.tlh(18940) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18940) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(18940) : warning C4183: 'GetVBE': missing return type; assumed to be a member function returning 'int'
e:\temp\autoproject\autoproject\debug\msword.tlh(19006) : error C2146: syntax error : missing ';' before identifier 'GetFileSearch'
e:\temp\autoproject\autoproject\debug\msword.tlh(19006) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(19006) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(19006) : warning C4183: 'GetFileSearch': missing return type; assumed to be a member function returning 'int'
e:\temp\autoproject\autoproject\debug\msword.tlh(19213) : error C2146: syntax error : missing ';' before identifier 'GetCOMAddIns'
e:\temp\autoproject\autoproject\debug\msword.tlh(19213) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(19213) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(19213) : warning C4183: 'GetCOMAddIns': missing return type; assumed to be a member function returning 'int'
e:\temp\autoproject\autoproject\debug\msword.tlh(19217) : error C2146: syntax error : missing ';' before identifier 'GetLanguageSettings'
e:\temp\autoproject\autoproject\debug\msword.tlh(19217) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(19217) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(19217) : warning C4183: 'GetLanguageSettings': missing return type; assumed to be a member function returning 'int'
e:\temp\autoproject\autoproject\debug\msword.tlh(19219) : error C2146: syntax error : missing ';' before identifier 'GetAnswerWizard'
e:\temp\autoproject\autoproject\debug\msword.tlh(19219) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(19219) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(19219) : warning C4183: 'GetAnswerWizard': missing return type; assumed to be a member function returning 'int'
e:\temp\autoproject\autoproject\debug\msword.tlh(19298) : error C2146: syntax error : missing ';' before identifier 'GetFileDialog'
e:\temp\autoproject\autoproject\debug\msword.tlh(19298) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(19299) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(19299) : warning C4183: 'GetFileDialog': missing return type; assumed to be a member function returning 'int'
e:\temp\autoproject\autoproject\debug\msword.tlh(19306) : error C2146: syntax error : missing ';' before identifier 'GetNewDocument'
e:\temp\autoproject\autoproject\debug\msword.tlh(19306) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(19306) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(19306) : warning C4183: 'GetNewDocument': missing return type; assumed to be a member function returning 'int'
e:\temp\autoproject\autoproject\debug\msword.tlh(19951) : error C2146: syntax error : missing ';' before identifier 'Assistant'
e:\temp\autoproject\autoproject\debug\msword.tlh(19951) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\temp\autoproject\autoproject\debug\msword.tlh(19951) : error C2208: 'MSWord2003::Assistant' : no members defined using this type
e:\temp\autoproject\autoproject\debug\msword.tlh(19951) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Generating Code...
Results
  
Build log was saved at "file://e:\temp\AutoProject\AutoProject\Debug\BuildLog.htm"
AutoProject - 64 error(s), 10 warning(s)

My environment:

MS Windows Server 2003

VS2005

MSOffice2003sp2

 

My questions are :

1. does any one has clue to solve these errors??

2. what does IDE do when vs2005 compiler automatically generating file "CApplicaiton.h" and "msword.tlh"? How can I generate them manually.

 

 

how to use scanf_s in this sample?

$
0
0

Hello i am trying to run this code

	char name[15];
	printf("your name?");
	scanf("%s", name );
	printf("you are %s\n, ", name);

	 return (0);

it appears an error and tells me to use scanf_s instead, how can i use it?

scanf is deprecated or is only in teh case of windows where i can not use scan ?

Thank you in advance

Is there something I am missing that you cannot use modulus with type float in VS community 2015?

$
0
0

I have little experience in programming and had taken a few classes years ago about programming and used c++ and used visual studio 2008. Currently I have been taking another shot at programming on my free time and had been using VS community. I had created a program that lets the user input two numbers and lets them pick a math operator to get an answer. If i use type int I do not get an error but if i use type float I get an error where the programs modulus equation is.

Heres the code.

#include "stdafx.h"
#include <iostream>
using namespace std;



int main()
{

char mathOp, answer;
float Num1, Num2, Num3;

cout << "This program computes a sipmle math problem \n";
cout << "when you input an operand.\n";
cout << "Would you like to run the program, 'y' or 'n'? ";
cin >> answer;

while (answer == 'y')
{
cout << "Input a number. ";
cin >> Num1;
cout << "\nInput another number. ";
cin >> Num2;
cout << "\nInput an operand '+,-,*,/,%' . ";
cin >> mathOp;
if (mathOp == '+')
{
Num3 = Num1 + Num2;
}
else if (mathOp == '-')
{
Num3 = Num1 - Num2;
}
else if (mathOp == '*')
{
Num3 = Num1 * Num2;
}
else if (mathOp == '/')
{
Num3 = Num1 / Num2;
}
else if (mathOp == '%')
{
Num3 = Num1 % Num2;
}
cout << "\nYour answer is " << Num3 << ".";
cout << "\nDo you want to run the program again 'y' or 'n'? ";
cin >> answer;
}

cin.get();
cin.get();

    return 0;
}

Error.

SeverityCode DescriptionProjectFileLineSuppression State
Error (active)expression must have integral or unscoped enum typeProject1c:\Users\crash\Documents\Visual Studio 2015\Projects\Project1Solution\Project1\Project1.cpp47
Error (active)expression must have integral or unscoped enum typeProject1c:\Users\crash\Documents\Visual Studio 2015\Projects\Project1Solution\Project1\Project1.cpp47
ErrorC2296 '%': illegal, left operand has type 'float' Project1c:\users\crash\documents\visual studio 2015\projects\project1solution\project1\project1.cpp47
ErrorC2297 '%': illegal, right operand has type 'float' Project1c:\users\crash\documents\visual studio 2015\projects\project1solution\project1\project1.cpp47

If i change float to int it runs. 

I have never had an issue with this before and I was wondering if it was that is how it has always been or it has changed with VS community?

External Dependencies not interacting with Visual Studio 2015

$
0
0

I am running Visual Studios 2015 Community with SDK 10.0.14393 (installed with VS and update 3), and WDK 10.0.14393. I am working with a C++ project for a kernel-mode driver that I was able to build using the previous version of development kits (10.0.10586) which I have now uninstalled (as I have read 14393 and 10586 do not work side-by-side). I cannot reinstall 10586, as it is not available anywhere that I can find, so all of my software is running 14393 and only 14393.

Previously, I was able to compile my project without wrapping my #include statements in an extern "C" statement, but now I get the long list of errors with or without the wrapper. 

Now, trying to build using the new kit, I am getting 2204 total errors (that's quantity, not an error ID, both syntax and compiler errors). All of these errors relate to external dependencies, mostly in the wdf and wdm families of header files. These errors are largely missing definitions for identifiers, leading me to believe that the dependencies are not being read/linked properly. For instance, I have a number of errors including, but not exclusive to,

identifier "UNICODE_STRING" is undefined (in wdmsec.h)

identifier "VOID" is undefined (in wdf.h)

identifier "ULONG" is undefined (in wdfchildlist.h)

identifier "WDFDEVICE" is undefined (in wdfchildlist.h)

I have tried reinstalling all parts of the program (VS, SDK and WDK), I have created the project as an empty kernel-mode driver as well as the basic template for a kernel-mode driver. I always end up with the same result.

In my project properties, I have the macro for the latest target platform version, and have tried selecting explicitly 10.0.14393. The platform toolset is WindowsKernelModeDriver10.0 with Driver for my configuration type. My target framework is v4.5. I have tried compiling explicitly with the C++ compiler. My 'Include Directories' are accurately including directories for 14393 and have 10.0.14393.0\km, 10.0.14393.0\km\crt, 10.0.14393.0\shared, and wdf\kmdf\1.19. I have gone an extra step and included these in the 'Additional Include Directories'. For my 'Type of driver' (under Driver Model settings), I have KMDF, Version Major is 1, and Version Minor is 19 (And I have tried 11 and 15, as those were building for me on 10.0.10586, with the same results).

Any help getting rid of my 2204 errors would be much appreciated. I believe that getting rid of one would get rid of all of them, as they seem to be stemming from a big-picture issue.


Viewing all 15302 articles
Browse latest View live


Latest Images

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