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

how to distribute msdatasrc.dll

$
0
0

I have an application that requires msdatasrc.dll, this dll is part of Office 2003/2007 Primary Interop Assemblies (PIAs). The PIAs are installed under C:\Program Files(x86)\Microsoft.NET\Primary Interop Assemblies.

Can I distribute msdatasrc.dll with my application? Or is there a redistributable package that I can use (the Office Primary Interop Assemblies redistributable package needs office, but I need to be able to install without Office)? Thanks.

WJ


Customizing ID_WINDOW_NEW

$
0
0

I am building a MDI application using MFC. The wizard generates a menu which includes a submenu named "&Window". In this submenu there is a menu item with the id ID_WINDOW_NEW. It is responsible for managing the several docs loaded by the application. I am trying to customize this behavior. I mean: whenever a certain doc is made visible, I want the application to retrieve a certain value of a variable, that is attached to it. Can anyone help me? Thanks.


Jorge Teixeira

Visual C++ 2005 Redistributable (x64) install error

$
0
0

I am trying to install a management product's agent for package distribution. I have worked with the vendor and they are stating its a Microsoft issue with the OS.

Here is the error:

Product: Microsoft Visual C++ 2005 Redistributable (x64) -- Error 1935.An error occurred during the installation of assembly 'Microsoft.VC80.CRT,type="win32",version="8.0.50727.4053",publicKeyToken="1fc8b3b9a1e18e3b",processorArchitecture="amd64"'. Please refer to Help and Support for more information. HRESULT: 0x80073715. assembly interface: IAssemblyCacheItem, function: Commit, component: {844EFBA7-1C24-93B2-A01F-C8B3B9A1E18E}

I can install other versions of the Visual C++ redist without issue. I cannot find an install for the version listed in the error message. From what I have gathered the server (Windows Server 2008 SP2) is missing assemblies in the winsxs folder. Is it possible to copy these assemblies from another server and create the associated registry keys? Can someone point me to the correct folders and registry values if this is possible?

I have tried installing from an elevated command prompt using the agent install file supplied by the vendor. I have exported the version of C++ redist from install package and tried installing it from an elevated command prompt.

I also ran an sfc /scannow and it found corruption that it cannot repair. I can post the log if needed. If shows a lot of transactions with the following output:

0000000c Call to uninstall failed, the TLC is not currently installed by that installer

I have tried using the .net framework repair tool as well. I have also tried reinstalling .net framework 3.5 sp1.

Suggestions and thoughts? This server cannot be rebuilt as it is highly utilized.

Exiting MFC program after destroying UI thread causes crash

$
0
0

I have written a small MFC program. It only does one thing: create a UI thread and destroys that thread again upon exit. Here is the program:

https://onedrive.live.com/redir?resid=BFFE74371A9E182C!31462&authkey=!APIYS6RwSanQEeA&ithint=file%2czip

Basically, in CMainFrame::OnCreate, I start the UI thread up by calling my uiThread.CreateThread(). Then in my app's ExitIntance() do these steps:

1) PostThreadMessage( DESTROY_UITHREAD, 0, 0 );

2) in that handler I do a PostQuitMessage which posts a WM_QUIT msg on the UI thread queue.

3) which causes that thread's ExitInstance to run. In that handler I call AfxEndThread(0) which does a thread delete.

It is here the program fails.

Here is the output stack at the crash:

  ntdll.dll!_RtlpBreakPointHeap@4() Unknown
  ntdll.dll!RtlpValidateHeapEntry() Unknown
  ntdll.dll!RtlValidateHeap() Unknown
  KernelBase.dll!_HeapValidate@12() Unknown
  msvcr120d.dll!__CrtIsValidHeapPointer() Unknown
  msvcr120d.dll!__free_dbg_nolock() Unknown
  msvcr120d.dll!__free_dbg() Unknown
> mfc120ud.dll!CObject::operator delete(void * p) Line 33 C++
  DeletingUIThread.exe!UIThread::`scalar deleting destructor'(unsigned int) C++
  mfc120ud.dll!CWinThread::Delete() Line 590 C++
  mfc120ud.dll!AfxEndThread(unsigned int nExitCode, int bDelete) Line 380 C++
  DeletingUIThread.exe!UIThread::ExitInstance() Line 31 C++

Can anyone see an error in my delete procedure or see why 'scalar deleting destructor' is being called?

By the way, I wait for the UI thread handle to disappear just in case.


RT

Console output while debugging a windows form

$
0
0

I’m creating a windows form GUI for an existing C++ application which consists of thousands of C++ lines. I’m getting close to the final solution.

 

 I created an Initialize() entry point in the C++ code and call it from the form1(void) initialization process. All works fine and the data from the C++ initialization process is available to fill in the combo boxes in the form.

 

My problem now is basically a question!  When I wrote the C++ initialization code in a parallel project, I used a few printf(…) statements to trace its progress. When I added the code to the windows form application it compiles and runs properly, including the printf statements, but where can I see the output of the printfs?

 

I have the window open for “Output” and it is tagged as “Show output from: [Debug]”, but I only see lines there related to the loading of a few DLL files.

 

Does visual studio support standard out for non-console applications?

 

I know that an alternate way to do this is with a trace file (not as interactive!), but when you do that you have to flush every line or you can’t find the item in a huge loop when the software crashes. For Example, I am loading the data for 891 market symbols in a large loop. While debugging I added the trace to show which symbol I was working on and could then tell that the problem existed on symbol “SYM”, the 497<sup>th</sup> symbol to be processed. I guess another question is, is there a way to fopen a file for fprintf writing that will auto flush every fprintf statement?

Connecting to 64 bit Access Database

$
0
0

32 bit DB seems to work well with SQLDriverConnect(...) and for

64 bit DB  SQLConnect(...) seems to work better to me. 

1) I can't connect a 64 bit DB using  SQLDriverConnect(...) command. Whats wrong?

2) I can't connect unless I change User DNS  settings under windows in both cases. Why? Can I also skip this step normally ?



Does GetQueuedCompletionStatus() return the socket handle?

$
0
0
I am learning about IOCP, and what I know so far is if I make an IO operation (for example: WSARecv()), a completion packet will be placed in the completion port, and to retrieve this packet I must call GetQueuedCompletionStatus(). But how can I know what socket the receive operation is meant for? Should I extend the OVERLAPPED structure and add the socket handle to it?

VS2012 - Compatabiltiy with Windows 7 and 8.1

$
0
0

I have started to develop a native C/C++ application using VS2012 to run on both Windows 7 and 8.1.  The first test program that I wrote worked fine in both environments.  After continuing development, the application would not run on 8.1 though it works fine on several Windows 7 PCs.  Windows 8.1 indicates a compatability problem though nothing specific.  I've run Code Analysis as recommended for native C/C++ and fixed everything it reported.

Here is a copy of the stdafx.h file for both the successful test program and the one I'm having difficulty with.


// stdafx.h : include file for standard system include files,

// or project specific include files that are used frequently,

// but are changed infrequently



#pragma

once



#ifndef

VC_EXTRALEAN


#define

VC_EXTRALEAN           // Exclude rarely-used stuff from Windows headers


#endif



#include

"targetver.h"



#define

_ATL_CSTRING_EXPLICIT_CONSTRUCTORS     // some CString constructors will be explicit



// turns off MFC's hiding of some common and often safely ignored warning messages


#define

_AFX_ALL_WARNINGS


#define

_AFX_NO_MFC_CONTROLS_IN_DIALOGS// 1/15 - produces significantly reduced 'exe' size



#include

<afxwin.h>        // MFC core and standard components


#include

<afxext.h>        // MFC extensions


 

 

 

 


#ifndef

_AFX_NO_OLE_SUPPORT


#include

<afxdtctl.h>          // MFC support for Internet Explorer 4 Common Controls


#endif

#ifndef

_AFX_NO_AFXCMN_SUPPORT


#include

<afxcmn.h>            // MFC support for Windows Common Controls


#endif

// _AFX_NO_AFXCMN_SUPPORT



#include

<afxcontrolbars.h>    // MFC support for ribbons and control bars


 

Any help or suggestions would be appreciated.

Thanks,

Bob Nichols

bobn@benchmate.com

 

 

 

 

 

 


#ifdef

_UNICODE


#if

defined_M_IX86


#pragma

comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")


#elif

defined_M_X64


#pragma

comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")


#else

#pragma

comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")


#endif

#endif


 


Bob Nichols


Native C/C++ Applications for both Windows 7 and 8.1 using Visual Studio Professional 2013

$
0
0

I'm developing a program using native C/C++.  A basic test program with just the VS2013 code (e.g.: TestApp, MainFrm & ChildView runs just fine on both Win7 & 8.1.  But when I add my own code (which has run successfully on Win 7 & 8.1 using Visual C 6), the test program will run only on Win 7 but will not even start on Win 8.1.

I've run Code Analysis and made the recommended corrections.

Any useful suggestions would be appreciated.

Thanks,

Bob N 


Bob Nichols

How to deal with WSARecv() returning SOCKET_ERROR?

$
0
0

When calling WSARecv(), if the receive operation will not be initiated, a SOCKET_ERROR will be returned (excluding WSA_IO_PENDING).

But in my worker thread (the one that calls GetQueuedCompletionStatus()), I must always call WSARecv() to keep receiving data. So if only one call of WSARecv() fails then my entire receiving process is broken! So how should I call WSARecv(), should I enclosed it in a loop that does not exit until WSARecv() returns 0 (success)?

This is what I mean by the receiving process:

  1. Call WSARecv().
  2. Dequeue a completion notification indicating that data was received.
  3. Go back to step 1.

Now if WSARecv() fails at some point, then I will not get a completion notification, and so I will not be able to call WSARecv() again, and so I can't receive anything anymore.



Can CDHtmlDialog play swf file with audio component?

$
0
0

Hello, I'm using CDHtmlDialog in our application to play swf that shows user how to do a workflow. It works fine if swf does NOT have audio; if the swf has audio component, then it does not play.

Can CDHtmlDialog play swf with audio?

If not, any suggestion on how to implement playing swf file with audio?

Many thanks in davance.

MFC how to find an event code

$
0
0

Hello All,

MS VS2010 SP1

If we have a MFC project with a menu, it is very easy to assign a handler to any item of the menu just with right click > AddEventHandler. However, it is impossible to make reverse task: to find out where the handler's code is allocated. No double click, no repeated AddEvenHandler, no property sheet gives service "jump to target code".

If we have a WinForms project with a menu, it is very easy to find out the handler with just double click: it "brings" us to the target code.

Is there a trick how to jump to code using the MFC based project?

C++ CLR Text Box File Input/Output

$
0
0

I'm working on an encryption program that is complete except for 1 item. I have 2 Text Boxes which use String^:

//Property to access the text in the edit box

public: property String^ InTextString

{

String^ get() {return myInfileText->Text; }

void set(String^ inText) {myInfileText->Text = inText; }

}



//Property to access the text in the edit box

public: property String^ OutTextString

{

String^ get() {return myOutfileText->Text; }

void set(String^ outText) {myOutfileText->Text = outText; }

}

and my file input/output

ifstream myInfile ("ClearText1.txt");

ofstream myOutfile ("Enigma.cfr");

but I can't get the Text Box String to match my myInFile and myOutFile.

If anyone knows how to fix this, please answer.

This is the last thing stopping me from completion. Thank-you


VC++ directories Property Page

$
0
0

Installed Visual Studio VC++ 2013 professional, then downloaded and installed Windows Driver kit 8.1 Update 1.  Also downloaded "USB sample Generic USB Driver" code sample. When I compiled the code sample with 8 errors, all of them traced to header files that had been installed with WDK 8.1. Tried to update the Include directories in VC++ using Tools / Options / Projects and Solutions / VC++ Directories, only to get a directive to use a user property sheet instead.

When I clicked on "?" for more information, upon arriving at the VC++ Directories Property Page, I became mired. I followed the instructions and ran into a wall in the second sentence. I am able to expand “Configuration Properties”, but “VC++ Directories” is not visible to select. Under "configuration properties" is only "configuration" and the information table portrayed in the table is completely different. I am using Visual C++ 2013 Professional, and need to add the directories added from installing WDK 8.1 and SDK 7.1.

Any Ideas?

 Thanks,

file read and write operations

$
0
0

how do use file read and write operations?

can anyone give simple program?


winusb sample app

$
0
0

Hi

I am using below link as a reference  to write a sample app to communicate with usb device.

https://msdn.microsoft.com/en-us/library/windows/hardware/dn376872%28v=vs.85%29.aspx

But there seems to be problem with 

WinUsb_Initialize API which is failing with error ERROR_NOT_ENOUGH_MEMORY(error code 8)

Thanks

Converting existing VCL-based code to VS C++

$
0
0
Has anyone ever converted a Borland C++ project that includes any use of the Borland Visual Component Library (Delphi components written in either Pascal or C++) into a new Visual Studio project?

I would be interested if there are any tools around for this because I have a long-standing code base written using Borland C++ Builder (versions 1 - 6) and am interested in seeing if it would be possible to leverage this code, some of which is quite sophisticated and powerful.

API or Sample code to monitor the temperature of Intel processors

$
0
0

Is there any free(no license or trail) API or sample code for temperature monitoring which can able to monitor Intel single Core, dual Core and quad Core processors temperature ? 



http://tnvbalaji.com

http://in.linkedin.com/in/tnvbalaji

Fillrect behaves differently on 32 and 64 bit fWindows7 with MM_ANISOTROPIC mapping mode

$
0
0

Using Visual studio 2013(VC++)  . Binary created (mfc SDI application) with  x86 Configuration.

Application creates a BMP file from memory dc. (some 'fillrect' drawn)
Same application exec uted in Windows7 32 and 64 bit machines.
BMP file created in both machines are slightly different. 

'Fillrect' drawn on 64 bit machine has 1 pixel more height.width same.
Mapping mode used is MM_ANISOTROPIC. (height is scaled)

Source 

void CMFCApplication1View::OnDraw(CDC* pDC)

{
HDC hDc;
SIZE  TempSize;

// We have create bmp file with 800 * 600 pixels
m_MemoryBmp.DeleteObject();
if (m_MemoryDC)
m_MemoryDC.DeleteDC();
if (!m_DummyWnd)
m_DummyWnd.Create(NULL, _T("DummyWindow"));
CClientDC WindowDC(&m_DummyWnd);
m_MemoryDC.CreateCompatibleDC(&WindowDC);
m_MemoryBmp.CreateCompatibleBitmap(&WindowDC, 800, 600);
m_MemoryDC.SelectObject(&m_MemoryBmp);

// set background color white
CRect rTotal(0, 0, 800, 600);
hDc = m_MemoryDC.GetSafeHdc();
int TempMapMode = GetMapMode(hDc);
COLORREF bkColor;
bkColor = RGB(255, 255, 255);
HBRUSH            hBkgnd = NULL;
hBkgnd = CreateSolidBrush(bkColor);
SetBkColor(hDc, bkColor);
SetTextColor(hDc, RGB(0, 0, 0));
(HBRUSH)SelectObject(hDc, hBkgnd);
FillRect(hDc, &rTotal, hBkgnd);

// mapping mode set, height is scaled
CRect rLegend(632, 72, 792, 468);
GetWindowExtEx(hDc, &TempSize);
m_MemoryDC.SetMapMode(MM_ANISOTROPIC);
SetWindowExtEx(hDc, rLegend.Width(), 256, NULL);
        SetViewportExtEx(hDc, rLegend.Width(), rLegend.Height(), NULL);
SetViewportOrgEx(hDc, rLegend.left, rLegend.top, NULL);

CRect rShape(0, 0, 53, 21);
// Draw shape
HBRUSH brShape = CreateSolidBrush(RGB(0, 255, 0));
SelectObject(hDc, brShape);
FillRect(hDc, &rShape, brShape);  //green box
DeleteObject(brShape);

// Reset
SetWindowExtEx(hDc, TempSize.cx, TempSize.cy, NULL);
SetMapMode(hDc, TempMapMode);

// save bitmap
CImage TempImageObj;
WCHAR path[MAX_PATH];
TempImageObj.Attach((HBITMAP)m_MemoryBmp.Detach());
GetModuleFileName(NULL, path, MAX_PATH);
CString csPath(path);
int nIndex = csPath.ReverseFind(_T('\\'));
if (nIndex > 0) {
csPath = csPath.Left(nIndex);
csPath += _T("\\sample.bmp");
}
TempImageObj.Save(csPath);

// Release dc
::DeleteDC(hDc);
::DeleteObject(m_MemoryBmp.GetSafeHandle());
}

Following declared in .h file

CFrameWnd m_DummyWnd;
CBitmap m_MemoryBmp;
CDC m_MemoryDC;




Is there any MACRO or method to make that must write a function in derived class which is in the Base Class.

$
0
0

Hi All,

i am looking for help on how to tell compiler that if there is not all override function in derived class which is in base class the it show error or message .

Thanks in Advance.


Viewing all 15302 articles
Browse latest View live


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