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

Missing "shared.vcxproj"

$
0
0
When I attempt to create a universal c++ store app I am prompted with this is error - "A problem was encountered creating subproject 'BlankAppsUniversal.Shared'. Could not find file 'C:\Programs\Program Files (x86)\Microsoft Visual Studio 12.0\VC\VCWizards\shared.vcxproj'." I looked and sure enough there was not file with that name in that location. I uninstall VS and reinstalled and still I still get this problem all other languages work for universal apps. I am totally lost. Please help if anything if someone could either solve this or evening upload that file. I was thinking about copy the file from my laptop but the hdd crashed.

High-resolution timer-based code execution on separate thread

$
0
0

Hello,

So I am working on a Windows CLR Project in Visual Studio that acts as a GUI, and this GUI is going to be used to manipulate variables which then need to be written over USB to an Arduino, but I'm running into an issue with the time resolution. I tried implementing both a System::Windows::Forms::Timer and a System::Timers::Timer, and in both cases I incremented a variable each tick of the timer and then sent the value of that variable to be displayed every Tick of a Windows forms timer. So both ticks were tied to a single variable, but only the System::Timers::Timer actually modified the variable. The Forms timer displayed it. I tried setting the interval to a value of 1ms, but the rate of incrementing is much slower (qualitatively the timer seems to run at <100Hz). Does anyone know how to implement a faster timer, ideally one running on a separate thread? I ran across the QueryPerformanceCounter which seems like a high-resolution timing solution, but I don't know how to execute code repeatedly using it. If someone could point me in the right direction I would much appreciate it.

Thank you,

Jordan

How to make the recv function in winsock2 stop after a specific time..?

$
0
0

In an developing a Windows Desktop Console Application in c++ in Visual Studio 3013 for Windows Desktop, which acts as a client and tries to connect to a server. Once the Connection with the server is successful, it sends a handshaking signal to the server and waits for a response from the server. Iam using winsocks2 in this application. The receive function I am using is a blocking call

iResult = recv(ConnectSocket, recvbuf, recvbuflen,0);

So until my server sends a response, the client is blocked. What I need is the client to check for response only for a certain time (say 10 sec). If there is no response within this time frame ,I want the client to disconnect from the server. How to achieve this?

Guidelines for handling a neat looking and bug free MFC dialog?

$
0
0

Hello

   I would like to know the recommended design aspects and programming aspects to be taken care while design a simple MFC dialog. The dialog shall contain some standard edit boxes, list boxes, drop downs etc. 

Thanks in advance


Sharing is profitable only if it happens with knowledge.

Invoking fire event to manage layer

$
0
0

Hello,

We are working on COM project and we are sending custom structure to managed component through fire event. We noticed that many time the IDispatch::Invoke call is taking quite a long time (20 ms/60 ms 120 ms). We have changed the mechanism and now we are using function pointers to raise events to managed component(Marshal::GetFunctionPointerForDelegate) but still it is taking time.  The Event is raise continuously  from our high priority thread in native component .

What could be reason for Invoke call taking that much time ?

Custom structure used :

 struct stPreRenderInfo
    {
      ULONGLONG ullTime;
      ULONGLONG ullTick;
      int nSZ;
      int i;
      int j;
      int k;
      int l;
      BSTR bstr1;
      BSTR bstr2;
      BSTR bstr3;
      BSTR bstr4;
    }

Regards

Manish Narang



Problem with MFC application

$
0
0
Hi,
I create

V C++ > MFC application

and then did no change to that. But when compiling that, I get


why?

Many Thanks & Best Regards, Hua Min

Connecting and Moving points

$
0
0
Hi I am new to MFC GDI. My task is quite simple. I have to set 4 points with the mouse click, once the fourth point is set, all the 4 points should get connected in sequential way(i.e, 1st point should get connected to 2nd, 2nd to 3rd and 3rd to 4thand 4th to 1st).Once I get the points connected, when I click and drag any of the 4 points and drag with the mouse, the point should move along with the mouse. I have no idea on how to do it. Kindly guide, Any sample codes pls. Pls help me.........

desktop sharing application using c++

$
0
0

I have downloaded the program from here http://www.tightvnc.com version 2.7.10 and compiled successfully using visual studio 2013.

One is the tvn server and other is the viewer.

We connected successfully the server and viewer using my friend’s laptop pair with server and client interaction.

When the application runs all the control of the server computer goes to client. In other words the viewer computer can even hook the server, perform all   the actions that a user can do on a local or personal computer and even shutdown the remote or server computer using application that is even great in positive terms.

But we want to implement/modify the application in such a way that only server can share the screen not the hooking /controlling of entire application by the viewer.

In this regard it is need of removing some .h and .cpp files.

But we do not know what files to remove to achieve the desired goal.

Please tell a way or modify the application in such a way that control never goes to the viewer and always see the screen of the server computer.

Also please tell that when a wrong IP is added through the client/viewer side then the following error comes  http://wikisend.com/download/914120/error that we want to find out in the code where it is and want to modify it in some terms. 

Thanks


MFC DAO using ACEDAO

$
0
0

Hello!

 I'm trying to make MFC DAO use ACEDAO by changing the guids in dbdaoid.h to the ACEDAO guids instead (I also copy all necessary dao source files to my own application library and rename some of them to avoid duplicates ex. afxmydao.h).

So far it seems to work but only when I build for UNICODE. When I build for ANSI, the database still opens but when calling, for example, GetFieldInfo on my open recordset, I get a DAO exception that the item is not in the collection. However, if I replace the COleVariant in the GetFieldInfo source holding the field name with _variant_t, it seems to work.

The same thing with FindFirst (and all others taking a COleVariant(xxx,VT_BSTRT) as input), it does not work when the input string is stored as COleVariant var(lpszFilter, VT_BSTRT) but it works after change to _variant_t(lpszFilter). Does anyone have a clue whats wrong?

 I have also made other tries to use ACEDAO (without changing guids, I replaced the calls in daocore.cpp to use ACEDAO directly) but with the same result, it would only work when compiling for UNICODE. 

 I know DAO is deprecated and we are working on a new version targeting another database but it's still far away. The problem we have with DAO now is the Jet database engine does not seem to work that well in a virtual environment and it contains confirmed bugs which won't be fixed by Microsoft. If we could somehow, with minimum source code change, target ACEDAO instead we would have access to a still supported database engine.

Regards,

Tobias 

unrsesolved external symbol __initterm from libcmtd.lib in VS 2015 CTP 6

$
0
0

I'm trying to update my codebase from VS2013 to VS2015.  I'm using version 14.0.22609.0 D14REL.  When I link I get various errors because of missing symbols...

1>libcmtd.lib(dll_dllmain.obj) : error LNK2001: unresolved external symbol __initterm
1>libcmtd.lib(dll_dllmain.obj) : error LNK2001: unresolved external symbol __initterm_e
1>libcmtd.lib(dll_dllmain.obj) : error LNK2001: unresolved external symbol __except_handler4
1>libcmtd.lib(utility.obj) : error LNK2001: unresolved external symbol __except_handler4
1>libcmtd.lib(utility_static.obj) : error LNK2001: unresolved external symbol ___vcrt_initialize
1>libcmtd.lib(utility_static.obj) : error LNK2001: unresolved external symbol ___vcrt_uninitialize
1>libcmtd.lib(utility_static.obj) : error LNK2001: unresolved external symbol ___vcrt_uninitialize_critical
1>libcmtd.lib(utility_static.obj) : error LNK2001: unresolved external symbol ___vcrt_thread_attach
1>libcmtd.lib(utility_static.obj) : error LNK2001: unresolved external symbol ___vcrt_thread_detach
1>libcmtd.lib(utility_static.obj) : error LNK2001: unresolved external symbol __seh_filter_dll
1>libcmtd.lib(utility_static.obj) : error LNK2001: unresolved external symbol __is_c_termination_complete
1>libcmtd.lib(utility_static.obj) : error LNK2001: unresolved external symbol __initialize_narrow_environment
1>libcmtd.lib(utility_static.obj) : error LNK2001: unresolved external symbol __crt_atexit
1>libcmtd.lib(utility_static.obj) : error LNK2001: unresolved external symbol __crt_at_quick_exit
1>libcmtd.lib(utility_static.obj) : error LNK2001: unresolved external symbol ___acrt_initialize
1>libcmtd.lib(utility_static.obj) : error LNK2001: unresolved external symbol ___acrt_uninitialize
1>libcmtd.lib(utility_static.obj) : error LNK2001: unresolved external symbol ___acrt_uninitialize_critical
1>libcmtd.lib(utility_static.obj) : error LNK2001: unresolved external symbol ___acrt_thread_attach
1>libcmtd.lib(utility_static.obj) : error LNK2001: unresolved external symbol ___acrt_thread_detach
1>libcmtd.lib(utility_static.obj) : error LNK2001: unresolved external symbol __cexit
1>libcmtd.lib(tncleanup.obj) : error LNK2001: unresolved external symbol ___std_type_info_destroy_list
1>libcmtd.lib(utility_desktop.obj) : error LNK2001: unresolved external symbol _terminate
1>libcmtd.lib(utility_desktop.obj) : error LNK2001: unresolved external symbol _memset

The project c++ Code Generation setting for Runtime Library is /MTd and the linker input Additional Dependencies specify libcmtd.lib.  I'm building a DLL.  Anyone know why libcmtd can't find these functions?

I have installed VS 2015 on a machine with a 2013 and 2010 install if it matters.  I'm on Windows 8.1.

Thanks,

Phil

CreateProcessAsUser failed in Windows 2003 service pack 1, 64 bit OS

$
0
0

Hi All,

I am trying to create one instance of my exe ( It was created with VC++, MFC support ) in Windows 2003, 64 bit OS. But the API "CreateProcessAsUser" failed and the error code returned is 6, means "The handle is invalid". My exe is in "SysWOW64" folder, and creating the instance based on the user login. The code I'm using is as follows:

//////////////////////////////////////

WTSQUERYUSERTOKEN fnWtsQueryUserToken;
PROCESS_INFORMATION pi;
STARTUPINFO si;
HANDLE hUserToken, hUserTokenDup;
DWORD dwCreationFlags;
BOOL bReturn = FALSE;
//
try
{
HMODULE hWTSMod = LoadLibrary("wtsapi32.dll");
if(hWTSMod)
{
fnWtsQueryUserToken = (WTSQUERYUSERTOKEN)GetProcAddress( hWTSMod, "WTSQueryUserToken");
if(fnWtsQueryUserToken)
{
if(!fnWtsQueryUserToken(dwSessionId, &hUserToken))
{
// WTSQueryUserToken value Error.
}
}
}
CloseHandle(hWTSMod);
//////////////////////////////////////////
if(!DuplicateTokenEx(hUserToken,MAXIMUM_ALLOWED,NULL,SecurityIdentification,TokenPrimary,&hUserTokenDup))
{
// DuplicateTokenEx value Error.
}
dwCreationFlags = NORMAL_PRIORITY_CLASS|CREATE_NEW_CONSOLE;
ZeroMemory(&si, sizeof(STARTUPINFO));
si.cb= sizeof(STARTUPINFO);
si.lpDesktop =(true)?NULL:(hUserTokenDup!=INVALID_HANDLE_VALUE && (m_GrantDesktopAccess(hUserTokenDup))==S_OK)?NULL:"";//"winsta0\\default";
si.dwFlags = STARTF_USESHOWWINDOW;//
si.wShowWindow = SW_NORMAL;//
ZeroMemory(&pi, sizeof(pi));
//Adjust Token privilege
if(!SetTokenInformation(hUserTokenDup,TokenSessionId,(void*)dwSessionId,sizeof(DWORD)))
{
 // SetTokenInformation value Error.
}
LPVOID pEnv = NULL;
HMODULE hModule = LoadLibrary("Userenv.dll");
if(hModule )
{
LPFN_CreateEnvironmentBlock lpfnCreateEnvironmentBlock = (LPFN_CreateEnvironmentBlock)GetProcAddress( hModule, "CreateEnvironmentBlock" );
if( lpfnCreateEnvironmentBlock != NULL )
{
if(lpfnCreateEnvironmentBlock(&pEnv, hUserTokenDup, TRUE))
{
dwCreationFlags|=CREATE_UNICODE_ENVIRONMENT;   
}
else
{
pEnv = NULL;
}
}
}
//Launch the process in the client's logon session.
charszPath[_MAX_PATH];
DWORDdwSize = _MAX_PATH;
GetModuleFileName(NULL, szPath, dwSize);
*strrchr(szPath,'\\') = 0;
lstrcat(szPath,"\\MyUser.exe");
if(!CreateProcessAsUser(  hUserTokenDup,szPath,NULL,NULL,NULL,FALSE,dwCreationFlags,pEnv,NULL,&si,&pi))
{
// User instance creation failed
}
else
{
// User instance creation success
}
//Perform All the Close Handles tasks
if(hUserToken)
 CloseHandle(hUserToken);
if(hUserTokenDup)
 CloseHandle(hUserTokenDup);
if(hModule)
{
LPFN_DestroyEnvironmentBlock lpfnDestroyEnvironmentBlock = (LPFN_DestroyEnvironmentBlock)GetProcAddress( hModule, "DestroyEnvironmentBlock" );
if( lpfnDestroyEnvironmentBlock != NULL )
{
lpfnDestroyEnvironmentBlock(pEnv);
}
}
if(hModule)
FreeLibrary(hModule);
}
catch(...)
{
return bReturn;
}
return bReturn;

////////////////////////////////////////////

I hope your immediate response.

Thanks,

R-VR

internal compiler error while migrating from VS2012 to VS2013

$
0
0

Hi,

My existing application is running on VS2012. now we are migrating to VS2013. I am getting below compiler error.

1>c1xxast : fatal error C1001: An internal error has occurred in the compiler.
1>  (compiler file 'msc1ast.cpp', line 1325)
1xxast : fatal error C1001: An internal error has occurred in the compiler.
  (compiler file 'msc1ast.cpp', line 1325)
   To work around this problem, try simplifying or changing the program near the locations listed above.
  Please choose the Technical Support command on the Visual C++
   Help menu, or open the Technical Support help file for more information

Option that I have tried:
1. Based on the below MSDN solution I have updated the VS2013 with update 2 still I am getting the same internal compiler error.

"connect.microsoft.com/VisualStudio/feedback/details/806225/fatal-error-c1001-crash-when-running-code-analysis"

2. I have disabled the "Code Analysis warning" in the project properties, then I have given clean and build. This time I didn't get the internal compiler error.

Thanks

Selvi P

error LNK1104: cannot open file 'MSCOREE.lib'_In visual studio 2013

$
0
0

Hi,

I have upgrade the window application from vs 2008 to vs 2013 after upgradation, when i m trying to build madelineDll I am getting  this error LNK1104: cannot open file 'MSCOREE.lib'MadelineDLL

Can someone help me to resolve this ASAp.

Thanks in advance

Archana K.

Will ReportEvent to do the right thing with lpUserSid parameter and not modify it?

$
0
0

Hi all,

this function has a parameter documented as "__In__ PSID lpUserSid". I have aconst SID*  on my hands.

Can I safely const_cast the constness away here? Doing that seems to work, but I am trying to get additional assurance.

I am also pointing a finger at ReportEvent function, as it really looks like this parameter should be "const" ;-).

TIA,

Goran.

Hi, I'm getting errors Error C4700: uninitialized local variable 'y' & Error C4700: uninitialized local variable 'Y' used on the code i have below.

$
0
0
#include "stdafx.h"
#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
 double n, area, perimeter, r, x;
 float y, Y;
 do
  {
    system("cls");
     cout << ("What do you want to find out :-\n1.Area of the Circle\n2.Perimeter of the Circle");
    cout << ("Enter 1.(Area) OR 2.(Perimeter)");
    cin >> n;
    if (n = 1)
    {
        cout << ("\n===================================================================\n");
        cout << ("\nAREA OF THE CIRCLE\n");
        cout << ("Enter radius of the circle :-\n");
        cin >> r;
        cout << "Area of the circle having radius " << r << " = "; area = 3.14159*r*r;
        cout << ("=====================================================================\n");
    }
    else
    {
        cout << ("\n===================================================================\n");
        cout << ("\nPERIMETER OF THE CIRCLE\n");
        cout << ("Enter radius of the circle :-\n");
        cin >> r;
        cout << "Perimeter of the circle having radius " << r << " = "; perimeter = 2 * 3.14159*r;
        cout << ("=====================================================================\n");
    }
    cout << "Want to countinue yes or no(y/n)";
    cin >> x;
  } while ( x ==y||x==Y);
    {
        cout << "\n*Thank you for using Program*\n";
        cout << "\n#####################################################################\n";
    }
    return 0;
}

How to solve Attempted an unsupported operation Error in VC++ MFC

$
0
0

i add one ddx_contol on DoDataExchange(pDX)

DDX_Control(pDX, IDC_COMBO1, m_combo1);


the IDC_COMBO1 is in another dialog. i tried to get that combo selected item from Main Dialog.

In main dialog have a menu option. one of the menu item have to open that dialog (IDC_COMBO1). 

now i need to get that combo selected item when OK button is pressed.

m_combo1.GetWindowTextW(m_combotext);

MessageBox(m_combotext);

whenever i run the application with the DDX_Contol it shows Attempted An unsupported operation .

without DDX_Control does not get selected value. it shows empty message box.

how can i achieve this?

help me.


How does CryptVerifyTimeStampSignature verifies the timestamp signature without TSA certificate?

$
0
0

Hi we are developing Win 7 VC++ app using Crypto APIs. Here we time stamp data usingCryptVerifyTimeStampSignature() method. We observed thatCryptVerifyTimeStampSignature() does not accept TSA certificate for timestamp verification. And still verifies timestamp signature successfully. Thus we wanted to know from where TSA certificate is referred for verification.

We are using “http://timestamp.comodoca.com/rfc3161” URL as TSA while time stamping data. And we do not have any TSA certificates (from http://timestamp.comodoca.com/rfc3161 ) installed on system where we verify timestamp signature. With this environment CryptVerifyTimeStampSignature() verifies signature successfully.

Please let us know from where TSA certificate is referred for timestamp verification.

Any help/hint is highly appreciated.

Dragging points to change the shapes.

$
0
0

Hi

    I have managed to connect 4 points where the mouse click is made using the following code.

void CChildView::OnLButtonDown(UINT nFlags,CPoint point)
{    
    if(m_LastPoint.x!=-1 && m_iPointAmount<6)
    {
        CDC* pDC= GetDC();
        pDC->MoveTo(m_LastPoint.x,m_LastPoint.y);
        pDC->LineTo(point.x,point.y);
    }
    m_LastPoint=point;
    m_iPointAmount++;
}

The variables are initialized in the constructor as follows.

m_LastPoint.x=-1;
m_LastPoint.y=-1;
m_iPointAmount=1;

I want to do the following now.

1.Whenever the mouse click is made on one of the points and dragged, the point should relocate to the new position.(so the shape is changed).

2.This should be applicable for all the four points.

Pls guide me on how to achieve this.


ATL COM server error (0x800706C6 The array bounds are invalid) in Windows 2012 server

$
0
0

Hi,

We have a ATL  COM server application which was developed using Visual Studio 6.0. This was ported to Visual Studio 2003 later.

The application was running without any problems on Windows 2008 server. When we installed it on Windows 2012 server the services would not start at all. On contacting MS support we can to know that the code needs to be built using Visual Studio 2013. The same was done wherein we ported the application to be built using Visual Studio 2013.

The application is still failing. On debugging I could trace it to CoResumeClassObjects() call. This call returns error "0x800706C6 The array bounds are invalid.". The same works perfectly fine on windows 2008. 

Does anyone know what has changed between 2008 server and 2012 R2 server with respect to COM implementation.

Convert char * to LPCTSTR

$
0
0

How I can convert char * to LPCTSTR.

I reading msdn but I don't know nothing sensible to do.

 

Thx for all hepl.

Viewing all 15302 articles
Browse latest View live


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