visual-studio-languages-forums,windows-desktop-development-forums,visual-cRelated issues-Collection of common programming errors


  • msdn

  • msdn
    visual-studio-languages-forums windows-desktop-development-forums c-standards-extensions-and-interop
    I am trying to connect to an SQL database using the SQLDriverConnect function in native c.  I successfully connect to the database, when I call the SQLDriverConnect function using the syntax:SQLDriverConnect(handleConnection, NULL, (SQLWCHAR*)TEXT(“DRIVER={SQL Native Client};SERVER=MyServer;DATABASE=DB;Trusted_Connection=yes;”), SQL_NTS, NULL, 0, NULL, SQL_DRIVER_NOPROMPT);However, the server and database that I connect to will often change.  Instead of using a fixed quote co

  • msdn
    visual-studio-languages-forums windows-desktop-development-forums visual-c
    We actually use P/Invoke and marshalling to interoperate between our C# assemblies and old native C++ libraries, wrapped in a native C++ DLL (unmanaged). Everything is fine when proceeding this way, but we need now to improve performance, so that we tried to implement a C++ managed DLL.When debugging this new component, I found out twice the same problem when using classes that embed CRITICAL_SECTION object, that are never initialized through InitializeCriticalSection whereas this is made indeed

  • msdn
    visual-studio-languages-forums net-framework-forums visual-basic
    I’m using Visual Basic Express 2010 and SQL Express 2008 in Windows XP.I created a database on my local PC HDD. At first I couldn’t add a datasource (the .mdf file for the database) because of a “Operating system error 32” which I seemed to have resolved by giving myself full permissions for .mdf file (by right clicking on the file and going into properties and thenSecurity) and restarting the SQL SERVER (SQLEXPRESS) service.The dataset for the database is in my solution explorer but w

  • msdn
    visual-studio-languages-forums windows-desktop-development-forums visual-c
    I’ll try to make my question simple. The text file is similar to this (values beiing x,y,z, Amplitude)1.00 1.00 1.00 0.811.00 2.00 1.00 0.821.00 3.00 1.00 0.761.00 4.00 1.00 0.00…The files are going to be over 60 mb (so more than 2.5 millions line). In my program, i need to send the values to two GLfloat arrays : g_vertices[] and g_colors[]. I have a working solution, but it is not fast. Right now it takes around 9100 milisecondsto execute this code :int lineCount=0;ifstream loadData(“dat

  • msdn
    visual-studio-languages-forums net-framework-forums visual-basic
    A poster recently commented that the “As” clause went away 5 years ago. While that is true, a Dim statement without the “As” call is always treated as a Reference Type, even if the variable is set to a Value Type.In this code:Dim introw introw = 1introw is boxed and placed on the managed heap instead of the stack.  Anytime introw is referenced, it must be unboxed. The IL code:IL_0001:  ldc.14.1IL_0002:  box     [mscorlib]System.Int32IL_0003:

  • msdn
    visual-studio-languages-forums net-framework-forums visual-basic
    Hello Microsoft Community,I notice that the topic of Option Strict often becomes a debatable subject among some of the contributors.I am creating this thread in hopes of redirecting any debates on the subject here, in hopes to help keep other forum threads as short as possible and on topic.Your Opinion On Option Strict, Why or Why not?”If you want something you’ve never had, you need to do something you’ve never done.”Don’t forget to mark helpful posts and answers! Answer an interesting que

  • msdn
    visual-studio-languages-forums windows-desktop-development-forums visual-c
     Hello, I have a group assignment that I have to do.  We have to write a Tic Tac Toe game.  One person in my group has managed to write the code for a multiplayer (human -vs- human) game and I managed to write a code for a single player (human -vs- computer) game.  My problem is, now we want to merge the two games with options to pick which game you would like to play.  However, the games were written totally different styles and I can’t get them to work, so I am turning to you for help.Here is

  • msdn
    visual-studio-languages-forums net-framework-forums visual-c-
    Hello,First off, I’m am pretty certain I’m posting in the wrong place, so I hope you can help me get to the right place.  This was my best guess after doing some searching here and reading “What forum do I…”… thank you in advance for your patience and assistance.I am using a C# .NET program written by someone else.  I have experienced what the author and I both feel may be actual bugs, and not fault with the application, we’d like to get that confirmed AND reported if they ARE bugs

  • msdn
    visual-studio-languages-forums windows-desktop-development-forums visual-c
    I have a long time C/C Thread class that has worked fine for 14 years, but now I am seeing what appears OS duplicated event leaks intermittently and it seems to only on multi-core machines.  I have exhausted all I do to track this, including changingthe class, but its randomness eludes me.   I was able to isolate the all code to a simple console program to repeat the issue.  Can someone explain what i need to do here?   The issue is that process total handles count increase b

  • msdn
    windows-desktop-development-forums windows-hardware-development-forums windows-hardware-testing-and-certification
    Hi,Single Computer Display Object test fail with below error.——————————–Start Test3/15/2013 5:44:16.452 PMSystemFund-0200: Computers must be represented by one icon in Device Center.Message3/15/2013 5:44:16.452 PMUsage: ComputerSingleDDOtest.exe -<Computer.Desktop | Computer.Laptop>Error3/15/2013 5:44:16.452 PMReceived invalid parameter for form factor: .File: Line: 0Error Type: Error Code: 0x80070057Error Text: Error 0x80070057End Test3/15/2013 5:44:16.452 PMSystemFun

  • msdn

  • msdn
    windows-desktop-development-forums windows-hardware-development-forums windows-hardware-testing-and-certification
    Hello, we’ve been having a lot of trouble learning the ropes on the new HCK for Windows 8 hardware testing. We were managing to get products tested and submitted regularly for Windows 7 and earlier, but even though this new suite is much simpler-lookingit’s proving difficult to pull all of the information together. I hope someone can give me some advice.We have some peripherals which are consistently failing on x86 and x64 tests for Webcam BasicPerf base (Manual) and Webcam UsageIndicator base (

  • msdn

  • msdn
    windows-desktop-development-forums general-windows-desktop-development-issues
    Hi All, I need to calculate the cluster size using my program. Windows provides API – GetDiskFreeSpace, to serve the purpose. But the API fails on windows 2000 host giving the following error- ——————– ERROR_DIR_NOT_ROOT 144 (0x90) :The directory is not a subdirectory of the root directory. ——————– The same program runs successfully on windows 2003 and above. Do anyone knows the solution of this problem? Or Is there any other way to get cluster size on windows? Here i

  • msdn
    windows-desktop-development-forums general-windows-desktop-development-issues
    Calling SHGetKnownFolderPath with the parameter of FOLDERID_ProgramFilesX64 fails with ERROR_FILE_NOT_FOUND when I call it from a 32-bit app. This is contrary to the documentation in the remarks section of: http://msdn2.microsoft.com/en-us/library/bb762584(VS.85).aspx, which clearly states that it’s valid to call the function with that parameter from a 32-bit app on a 64-bit OS.Sample code:Code Snippet// Compile with: cl /EHsc knownfolder.cpp /link shell32.lib#include <shlobj.h>#include &l

  • msdn
    windows-desktop-development-forums windows-filtering-platform-wfp
    Hi, I’m writing a WFP driver that will  route all TCP traffic through a user app which inspects and/or modifies the data. So I added a filter to the stream layer with flag FWP_CALLOUT_FLAG_CONDITIONAL_ON_FLOW.As a first step, I’m just cloning the stream data every time my classifyFn is called, block the original data by returning FWP_ACTION_BLOCK and then I inject the cloned data back from within a worker thread. Everything works fine except of one little thing:I’m testing my driv

  • msdn
    windows-desktop-development-forums windows-desktop-sdk
    We have a problem where our application uses installhinfsection to install a driver. During the install, we call installhinfsection to register the driver with windows. Obviously the void function does not return a value, but the install fails with a user presented “installation failed” dialog. We look at the setup log windows generated for the driver install, and all log results show success. At this point I’m not sure how to troubleshoot this issue futher. We have a customer in

  • msdn
    windows-desktop-development-forums general-windows-desktop-development-issues
    I have an application which was developed in Visual Studio 6.0 C.  I am trying to run it under Windows 2008 Server and have encountered 2 issues.  The application has two requirements: 1) Open the Service Control Manager using OpenSCManager()and 2) Use CreateFile() to get the handle to a shared memory mapped file.  If I run it under a local account, which is part of the administrators group, the call to OpenSCManager fails and (access denied) CreateFile succeeds.  If I select

  • msdn
    windows-desktop-development-forums windows-hardware-development-forums windows-hardware-testing-and-certification
    Run “System – Sleep with IO Before and After” test and it is failed. Below is an error listed in the log file under “Run Test”WDTF_SIMPLE_IO: -PerformIO(Atheros AR9485WB-EG Wireless Network Adapter PCI\VEN_168C&DEV_0032&SUBSYS_660811AD&REV_01\4&2EEAE01&0&00E1)Failed: WirelessPlugin: ExerciseWLANDevices() – WlanScan() indicated failure in notification HRESULT=0x80004005 Count 94Does Anyone know how to resolve this? Thank you.

  • msdn

  • msdn
    visual-studio-languages-forums windows-desktop-development-forums visual-c
    We actually use P/Invoke and marshalling to interoperate between our C# assemblies and old native C++ libraries, wrapped in a native C++ DLL (unmanaged). Everything is fine when proceeding this way, but we need now to improve performance, so that we tried to implement a C++ managed DLL.When debugging this new component, I found out twice the same problem when using classes that embed CRITICAL_SECTION object, that are never initialized through InitializeCriticalSection whereas this is made indeed

  • msdn
    visual-studio-languages-forums windows-desktop-development-forums visual-c
    I’ll try to make my question simple. The text file is similar to this (values beiing x,y,z, Amplitude)1.00 1.00 1.00 0.811.00 2.00 1.00 0.821.00 3.00 1.00 0.761.00 4.00 1.00 0.00…The files are going to be over 60 mb (so more than 2.5 millions line). In my program, i need to send the values to two GLfloat arrays : g_vertices[] and g_colors[]. I have a working solution, but it is not fast. Right now it takes around 9100 milisecondsto execute this code :int lineCount=0;ifstream loadData(“dat

  • msdn
    visual-studio-languages-forums windows-desktop-development-forums visual-c
     Hello, I have a group assignment that I have to do.  We have to write a Tic Tac Toe game.  One person in my group has managed to write the code for a multiplayer (human -vs- human) game and I managed to write a code for a single player (human -vs- computer) game.  My problem is, now we want to merge the two games with options to pick which game you would like to play.  However, the games were written totally different styles and I can’t get them to work, so I am turning to you for help.Here is

  • msdn
    visual-studio-languages-forums windows-desktop-development-forums visual-c
    I have a long time C/C Thread class that has worked fine for 14 years, but now I am seeing what appears OS duplicated event leaks intermittently and it seems to only on multi-core machines.  I have exhausted all I do to track this, including changingthe class, but its randomness eludes me.   I was able to isolate the all code to a simple console program to repeat the issue.  Can someone explain what i need to do here?   The issue is that process total handles count increase b

  • msdn
    visual-studio-languages-forums windows-desktop-development-forums visual-c
    In a C MFC feature pack UI solution (using the Visual Studio style UI template), my CMFCPropertyGridCtrl “properties” style pane in the CDockablePane is not being painted in “Release” mode only i.e. everything works perfectlyin “Debug” mode. I understand the general differences between a debug and release build but have not been able to identify the specific problem yet. For example, there appear to be no unexpected exceptions changing the callflow. Before breaking

  • msdn
    visual-studio-languages-forums windows-desktop-development-forums visual-c
    Hi all!Here’s my question :)I need to use a function (glutMouseFunc) which accepts as parameter a function pointer (it’s a callback). The problem is that glutMouseFunc is an “old” C function, so I can’t pass a C++ member function pointer (C function pointers are addresses, but C++ member functions pointers are offsets from “this” object).Looking for an answer, I found a possible C++ solution using global functions. This is a well known solution, but in my VC++ project I get &

  • msdn
    visual-studio-languages-forums windows-desktop-development-forums visual-c
    I recently did a clean install of Windows (XP) and VS2010 (Ultimate). I have since not been able to get Intellisense to work in vc (I don’t really use other languages so much and thus have not tested them). Every time it should show Intellisense suggestions,either automatically or by pressing ctrlspace or whatever) it says in the bottom bar “Intellisense: ‘no additional information available'”.I have tried everything here http://msdn.microsoft.com/en-us/library/ms235519.aspx and here h

  • msdn
    visual-studio-languages-forums windows-desktop-development-forums visual-c
    Hi, I am working on a class for RS232 communication, and I use threads for different COM ports. In the thread, WaitForMultipleObjects is used for event detecting as below.Event = WaitForMultipleObjects(3, m_hEventArray, FALSE, INFINITE);where m_hEventArray is defined as m_hEventArray[0] = m_hClosePort;m_hEventArray[1] = m_ov.hEvent; m_hEventArray[2] = m_hWrite2Port;My first question is why SetCommMask(hCom, EV_RXCHAR | EV_CTS) can cause the wait function to return? From the SetCommMask online do

  • msdn
    visual-studio-languages-forums windows-desktop-development-forums visual-c
    I am having difficulties in converting a VS 6.0 / MFC project to VS 2005. There are 5 projects under one solution and I am trying to compile the most basic project. After a lot of corrections below is what I get as compile output. Does someone have an idea about the errors I am getting ?Code Snippet—— Build started: Project: util, Configuration: Debug Win32 ——Compiling…l_univ.cxxl_uni2.cxxl_array.cxxi_var_gl.cxxi_util.cxxi_trace.cxxi_timer.cxxi_thread.cxxi_tempor.cxxi_tbindex.cxxi_sock

Web site is in building