Go Premium for a chance to win a PS4. Enter to Win

x

Visual C++.NET

Microsoft Visual C++ (often abbreviated as MSVC or VC++) is an integrated development environment (IDE) product from Microsoft for the C, C++, and C++/CLI programming languages. It features tools for developing and debugging C++ code, especially code written for the Microsoft Windows API, the DirectX API, and the Microsoft .NET Framework. Many applications require redistributable Visual C++ packages to function correctly and are often installed independently of applications, allowing multiple applications to make use of the package while only having to install it once

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi Experts,

I don't get this error when I run my code on my PC, either inside or outside the IDE.

I have created an installer to run in a clean Windows 7 setup on a Virtual PC.

But when I run the .exe in the Windows 7 setup I get this error:

Object reference not set to an instance of an object

No other information about the error is given.

How can I debug the error (without using lots of tracing information)?
Is there any way of configuring my code to output information about the error?

Regards,
Leigh
0
How to Use the Help Bell
LVL 11
How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Hi guys.

I'm using this code to read a text file locally and do the word search as needed but the problem is that the file which this app will be reading will be online on a web server and the problem is that the code I have now to read this text online I don't seem to figure out how I can split data so that I can still do word search just like how I do to a local file. Here is the code I use to read local file:

while(!in.eof() && getline(in, line, ','))
							 {
								if((offset = line.find(ID, 0)) == string::npos)
								{
									id = atoi(line.c_str());
									in >> dat;
									getline(in, NUMBER, ',');
									getline(in, line, '\n');
									
									KEY = (int)atof(line.c_str());
									
									if(ID ==id)
									{
										ID = id;
										//dst = dvs;
										va = KEY;
										
									}

Open in new window


Now this code part is the essential part of code as its what I want to be able to do in the following code which is the code that reads a file from the web.

    #include "stdafx.h"
    using namespace System;
    using namespace System::IO;
    using namespace System::Net;
    using namespace System::Text::RegularExpressions;
    int main(void)
    {
        Regex^ rxSubTitles = gcnew Regex("\\d.*>(?<subtitle>.*)<");
        String^ strFileIn = L"http://textfiles.com/adventure/221baker.txt";
        WebClient^ wc = gcnew WebClient();
        StreamReader^ fileWebIn = gcnew StreamReader(wc->OpenRead(strFileIn));
        String^ strData = "";
        while(!fileWebIn->EndOfStream)
        {
            strData = fileWebIn->ReadLine();
            if(rxSubTitles->IsMatch(strData))
            {
                // take ONLY the subtitle without additional decoration
                Console::WriteLine(rxSubTitles->Match(strData)->Groups["subtitle"]->Value->ToString());
            }
        }
        fileWebIn->Close();
        return 0;
    }

Open in new window

This code simply gets all the Titles.

Here is my text file structure:

111,7643876,2
324,254935,
730,021738248,1

Open in new window


As you can see each line has 3 data fields and
,

Open in new window

is the data separator and as you can also see that the 3rd field can sometimes be empty. I think if you can look at the structure and also look at my first code even though I didn't post the complete code on the first code but I think that s the main part which you may need as its also the main part I'm having problem with when trying to apply it to the second code.
0
Hi.

I have 2 forms Form1 and Form2. Form1 is the core form or the main application first form which runs first then at some point it hide it self and show Form2, the problem now is that I want to also reshow back Form1 when Form2 closes.

Anyone know how I can have that. Currently the forms do hide form1 and show form2 but I can't include form1 on form2 because form1 has already had form2 included in it. I'm using Microsoft Visual Studio 2010 CLI application.
0
Hi,
I have a problem with custom templates not creating solutions correctly. It works fine on my Home computer but not on my office computer. I have reinstalled VS 2015 several times but problem remains. The issue is the "Location" and "Solution Name" dialog are not visible nor are the "Create directory for solution" or "add source to control" checkboxes and browse button.

Below is an example of what happens and below is one of the template files (this effects several new project templates under c++).

If I select New -> Visual C++ -> Empty Project, I get the following dialog at bottom of window (You can see that "Location Field" is Enabled and yet it does not show when I create a new project)



Name: Project 1
Location: C;\users\david\visual studio 2015\projects
Solution Name : Project 1
Also a "Browse" button, "Create directory for solution" checkbox and "add to source control" checkbox.

If I select New -> Visual C++ -> Particle Project (which is one of the custom projects) I get

Name : Sketch1

All the other dialogs and checkboxes are missing.

BUT, When I am on my computer at HOME, I see all the correct solution name, location and checkboxes ok, but NOT on my OFFICE computer.

I am sure it is related to some setting in a file somewhere that is overriding the parameters for the VM template but don't know which file will be controlling this behavior.

<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" …
0
I referred to your post :
https://www.experts-exchange.com/questions/20930458/CreateProcess-for-Currently-Logged-On-User-from-Service-running-System-Account.html
and started building i got error in calling of
HANDLE GetCurrentUserToken()
{
      PHANDLE currentToken = 0;
      HANDLE primaryToken = 0;
      DWORD processID = GetExplorerProcessId();
      HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, processID);
      if (!hProcess)
      {
            LogMessage(ErrorExit(TEXT("OpenProcess Error")));
      }
      if (!OpenProcess(PROCESS_ALL_ACCESS, TRUE, processID))
      {
            LogMessage(ErrorExit(TEXT("OpenProcess Error")));
      }
      if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, currentToken))
      {
            LogMessage(ErrorExit(TEXT("OpenProcessToken Error")));
      }

      if(!DuplicateTokenEx(currentToken,TOKEN_ASSIGN_PRIMARY | TOKEN_ALL_ACCESS,0, SecurityImpersonation, TokenPrimary, &primaryToken))
      {
            LogMessage(ErrorExit(TEXT("DuplicateTokenEx Error")));
      }

      return primaryToken;
}


Kindly Help me out
0
I tried to make a break, when memory write occurred. I do not have success. Does anyone have succeeded?
The purpose of this break point is to find where a piece of memory has been written. So I could not point the where the code is, I only know the data location. I tried when data changed, but it seems that I have to specify the code location. Thanks for any help.
0
Hi

What are the most effective code style enforcing/maintainence visual studio plugins around (for C++)? Eg: Code Maid, any others?

thanks
0

Visual C++.NET

Microsoft Visual C++ (often abbreviated as MSVC or VC++) is an integrated development environment (IDE) product from Microsoft for the C, C++, and C++/CLI programming languages. It features tools for developing and debugging C++ code, especially code written for the Microsoft Windows API, the DirectX API, and the Microsoft .NET Framework. Many applications require redistributable Visual C++ packages to function correctly and are often installed independently of applications, allowing multiple applications to make use of the package while only having to install it once

Top Experts In
Visual C++.NET
<
Monthly
>