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

I  am  able to create  resource dll,I  am  able to use  icon inside  dll.But how  to use  dialog  inside  resource dll.
Following  way I  loaded dll,declared  id  globally.For  example now IDD_DIALOG1  is there  in  my dll,how  should I
use  it  to display  as  Modal  or  Modeless

     
  HMODULE hmodule = ::LoadLibrary(_T("C:\\Users\\adityaraoa\\Documents\\Visual Studio 
       2012\\Projects\\Win32Project1\\Debug\\Win32Project1.dll"));
	HRSRC hrsr = ::FindResource(hmodule,MAKEINTRESOURCE(IDD_DIALOG1),RT_DIALOG);
	::LoadResource(hmodule,hrsr);// TODO: Add your control notification handler code here
	//HICON hic = ::LoadIcon(hmodule,MAKEINTRESOURCE(IDI_ICON1));
	//btn.SetIcon(hic);

Open in new window

0
On Demand Webinar: Networking for the Cloud Era
LVL 9
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Hello,
my code works just fine and I got no error message.
But how can I check the the delete was done? Like a if - else routine

//%%%%%%%%%%%%%%%%%%%%%%%%%% Löschung %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	//SQL Server
	m_strConnection = _T("Driver={SQL Server}; Server=DSERVER; Database=OMSDATEN;Uid=;Pwd;");
		
	 //-----------------------------------------------------------------------------------------------------------
	//Initialize the Recordset and binding pointers
	m_ptrRs = NULL;   
       m_piAdoRecordBinding = NULL;   

	//Initialize the COM environment
	::CoInitialize(NULL);
	try
	{
		//Create the recordset object
		m_ptrRs.CreateInstance(__uuidof(Recordset));  

     
//======================================= Delete ==============================================================
   sql.Format("DELETE LogBuch FROM LogBuch WHERE Zeitstempel>='%s' AND Zeitstempel<='%s'",str_loeschen_von,str_loeschen_bis);
//============================================================================================================
		 
      _bstr_t bstrQuery(sql);
  
		//Open the recordset object Tabelle 
 m_ptrRs->Open(_variant_t(bstrQuery),(LPCTSTR)m_strConnection, adOpenDynamic, adLockOptimistic, adCmdUnknown);

		//Get a pointer to the record-binding interface Coils
		if(FAILED(m_ptrRs->QueryInterface(__uuidof(IADORecordBinding),(LPVOID *)&m_piAdoRecordBinding)))     _com_issue_error(E_NOINTERFACE);
  
		//Bind the record class to the recordset
	//	

Open in new window

0
SQL Server 2000
First I did this:
CString  str_CustomerNo_from="1000"
CString str_CustomerNo_to      ="4000"

sql.Format("SELECT * INTO Sicherung_Thomas.dbo.Customer FROM OMSDaten.dbo.Customer WHERE CustomerNo>='%s' AND CustomerNo<='%s'ORDER BY CustomerNo ASC",str_CustomerNo_from, str_CustomerNo_to);



Then I deleted the data that I saved before:(in OMSDaten database)
sql.Format("DELETE Customer FROM Customer WHERE CustomerNo>='%s' AND CustomerNo<='%s'",str_CustomerNo_from,str_CustomerNo_to);


Now my question: How can I copy the data back from Sicherung_Thomas.dbo.Customer to the existing table OMSDaten.dbo.Customer?
                                             I can not use SELECT * INTO because the table already exist.

Please let me know.
Thank you.
Best regards,
Thomas
0
Hello,
I would like to delete a Table from a database.

Name of the Table = "customer"
Name of the Database = "Sicherung_Thomas"
SQL Server 2000

I tried this:

CString str_Tablelle;
str_Tabelle="customer.dbo.Sicherung_Thomas";
 
//-----------------------------------------------------------
sql.Format("DROP TABLE %s ",str_Tabelle);
//-----------------------------------------------------------

My Error Message is: deleting is not possible because table do not exist in  system catalog

But the table is there....what do I did wrong?
Please help.
Best regards,
Thomas
0
I  am  able to  see the  controls  design time  ,but  not able to  see  them  at  run time.
Please  help as  early as  possible.
I  registered FM20.dll  as  suggested  in  one  article  on  google.
Design-Time.png
Runtime.png
0
try
	{
    //...................................................................
	 sql.Format("SELECT * INTO Sicherung_Thomas.dbo.LogBuch_%s FROM OMSDaten.dbo.LogBuch WHERE Zeitstempel>='%s' AND Zeitstempel<='%s'ORDER BY Zeitstempel ASC",str_tmp,str_loeschen_von,str_loeschen_bis);
    //...................................................................
	 _bstr_t bstrQuery(sql);
  	//Open the recordset object Tabelle 
    m_ptrRs->Open(_variant_t(bstrQuery),(LPCTSTR)m_strConnection, adOpenDynamic, adLockOptimistic, adCmdUnknown);
    //Get a pointer to the record-binding interface Coils
	if(FAILED(m_ptrRs->QueryInterface(__uuidof(IADORecordBinding),(LPVOID *)&m_piAdoRecordBinding)))     _com_issue_error(E_NOINTERFACE);
   
	}



	   //---------- Any erros? -------------
    	catch (_com_error &e)
		{
			//Display the error
        	GenerateError(e.Error(), e.Description());
		}
		//-----------------------------------

	


	// Do we have a valid pointer to the record binding?
	if(m_piAdoRecordBinding) m_piAdoRecordBinding->Release();       
	//Set the recordset pointer to NULL
	m_ptrRs = NULL;     
	//Shut down the COM environment
	::CoUninitialize();




//------------------------------------------------------------------------------------------------------------------------------------------------
void  CDatenbank_Anzeigen_Loeschen_Dialog::GenerateError(HRESULT hr, PWSTR pwszDescription)
{
	CString strError;
	//Format and display Error Message
	

Open in new window

0
sql.Format("SELECT * INTO Sicherung_Thomas.dbo.LogBuch4 FROM OMSDaten.dbo.LogBuch WHERE date>='%s' AND date<='%s' ORDER BY Zeitstempel ASC",str_date_von,str_date_bis);

str_date_von  : 2011-01-05         May 1st
str_date_bis:    2011-01-10          Oct.1st

SQL Server 2000

Hallo,
I would like to change the name of the table in Sicherung_Thomas = LogBuch4 to
LogBuch_2011_01_05____2011_01_10 in this sql query
So I want to rename the LogBuch in the query depending on the values in str_date_von,str_date_bis



Thank you for your help.
Best regards,
Thomas
0
Hi Experts,

This is a fragment of my code:

If Not IsDBNull(LayeredSystemComponentsRow.sglShiftFactor) Then '20170704

    .sglShiftFactor = LayeredSystemComponentsRow.sglShiftFactor
	
Else

    .sglShiftFactor = 1.0

End If

Open in new window


When LayeredSystemComponentsRow.sglShiftFactor is DBNull, I get an exception:

System.Data.StrongTypingException was unhandled by user code
  HResult=-2146232021
  Message=The value for column 'sglShiftFactor' in table 'LayerDetails1' is DBNull.
 ...
 ...

 Help!!!!
 
 Regards,
 Leigh
0
Hello all,

I searched my company url https://abc.com and received results.  Is there some way to not have results appear for that search.
Can you please help me asap.

Thank you,
Rithesh
0
If anyone knows  whats use of CStringData and CFixedStringLog class? and how to use them?,please give example
0
Enroll in August's Course of the Month
LVL 9
Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

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
Hi Experts,

I'm using VS 2013.

I've got this VB.NET Windows form (attached).

When I double click on it's name in Solution Explorer only the source code opens, not the Designer.

That form was working OK a few days ago.

Regards,
Leigh
VB.NET.zip
0
I have been able to create a CRecordSet object in MFC to query a database table. Is there a better alteranitive to using CRecordset? to run queries against sql server?

CRecordset is derived from CDatabase, so I don't know iif somehow possible to just use the CDatabase class instead. They are both ODBC.


Should I stay away from ODBC, and use something else to connect from C++ MFC to sql server?
0
Hi,

I have "tree" include file that not wanna associate with the cpp file.
..
.....
#include <stdio.h>
#include "../sys/pcsc.h"  <<  fatal error C1083
#include "/sys/util.h"  <<  fatal error C1083
#include "sys/clessCardType.h" <<  fatal error C1083
....
..

i tried three different ways to link the in the cpp file.

print screen added
Capture.GIF
0
Hi guys.

I have Form1.h and Test.cpp files in my project which was generated by VS. I have around 5 functions in my Test.cpp file and each function has to update the label with its result. I've made the label1 public on my Form1.h file and with this solution I am now able to write to the label1 outside the h file, I mean I can write to the label1 from .cpp file but only when the application is starting up or should I say only from the main function. I've used the solution provided on this post here and now my problem is that I can not use the same approach on other 5 to 6 functions as this approach also uses the
Application::Run(form);

Open in new window

which I don't think is appropriate to keep calling this from each and every function that needs to update the label.

The updates are based on the App returned results for each and every function its execute.
0
Hi Experts,

In my VB.NET project the Project | Properties | Settings defines this Connection String:

Name: LOADSConnectionString
Type: (Connection String)
Scope: Application
Value: Provider=Microsoft.Jet.OLEDB.4.0;Data Source="|DataDirectory|\CIRCLY Data\LOADS7.cmdb";Persist Security Info=True

At runtime, how can I get/set the Connection String, LOADSConnectionString? after DataDirectory is resolved (I know how to access the values in Settings).

More specifically can I get/set Data Source, or do I need to work with the full Connection String?

Regards,
Leigh
0
Hi Experts,

In my VB.NET project the Project | Properties | Settings has a number of Connection Strings, e.g.

Name: LOADSConnectionString
Type: (Connection String)
Scope: Application
Value: Provider=Microsoft.Jet.OLEDB.4.0;Data Source="|DataDirectory|\CIRCLY Data\LOADS7.cmdb";Persist Security Info=True

If I click on the ... button on the right, it shows:

Connection Properties

Database file name:
D:\Dev-Ver7.0\VB.NET\VB.NET\CIRCLY Data\LAYERS7.cmdb

This is the file that gets opened when I use the Database Table designer to Preview data etc.

I want to know the significance of the string "|DataDirectory|" in Data Source="|DataDirectory|\CIRCLY Data\LOADS7.cmdb".

I've searched for references to "DataDirectory" in the project, and it is not defined anywhere.

Given that "DataDirectory" is undefined, does that mean that Data Source will resolve to "some path?\CIRCLY Data\LOADS7.cmdb"

If I did want to define "DataDirectory" - how would I do it?  Via Settings?
Also what is the significance of the "|" characters?

Regards,
Leigh
0
Hi Experts,

I'm running Visual Studio 2013.

I am trying to debug vb.net code.

How can I have the debugger break when a Public variable changes value?

I thought Debug > New Breakpoint > New Data Breakpoint... may be the way to go, but New Data Breakpoint... is greyed out.

Regards,
Leigh
0
Hi Experts,

I'm getting this compile error:

Unable to find connection 'LOADSConnectionString (MySettings)1' for object 'MySettings'. The connection string could not be found in application settings, or the data provider associated with the connection string could not be loaded

I've looked through the text of the source files, but cannot find the offending text - with the '1' at the end of the connection string 'LOADSConnectionString (MySettings)1'.

Here is a .zip file containing the DataSet files and the Settings.settings file.

Regards,
Leigh
0
Free Tool: ZipGrep
LVL 9
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Whole sample project can be found here: Sample project

Normal MDI child:
normal.png
MDI child is detached out of MDI client area:
float.png
Problem is after MDI child is detached, I am not able to click on menu/controls anymore.

I think one approach is to subclass winproc of MDI app, and then catching the messages and redirect them (like this one). But I dont know where to begin.

Any idea/ other approaches are welcome!

The code I used to detach MDI child:

HWND MDIHwnd = pMainFrame->m_hWndMDIClient;
HWND mdiChildHwnd = GetWindow(MDIHwnd, GW_CHILD);

unsigned int style = GetWindowLongPtr(mdiChildHwnd, GWL_STYLE);
style = (style & (~WS_CHILD) | WS_POPUP);
SetWindowLongPtr(mdiChildHwnd, GWL_STYLE, style);

WaitForInputIdle(mdiChildHwnd, INFINITE);
SetParent(mdiChildHwnd, NULL);

WaitForInputIdle(mdiChildHwnd, INFINITE);
SetWindowLongPtr(mdiChildHwnd, GWLP_HWNDPARENT, (long)MDIHwnd);

Open in new window

0
Hi Experts,

I want to change the "Time Stamp" property for my workspace from "Current" to "Checkin", as shown on the screendump in this article.

My problem is that I can't find that screen in my Visual Studio 2013?

Regards,
Leigh
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
Hallo,
I have written this program with mfc c++ and it looks nice on a 4:3   17 inch screen.
Every screen/display works from 1280 x 1024 to 800 x 600.

On an 16:9   22 inch screen the pictures on my bitmaps are looking much to big.
Every screen/display will have this bad look.

This is the nice look of a 4:3  17 inch screen:

4 : 3   17 inch screen


This is the bad look of a 16:9  22 inch screen:

16:9   22 inch screen


Can you help me to fix this?
500 points with a solution.

Best regards,
Thomas
0
My  application is getting  terminated  with exception.I  kept try catch  block and caught  exception
               
Method not found: 'Void System.Net.HttpWebRequest..ctor()'.

Screen hot attached.Already it took  for me a day to trace a  bug.Now I need to resolve it.
Please help.
Bug.png
0
I recently installed Visual Studio 2017 and after that whenever I reboot my computer I get a prompt asking me which program do I want to use to open an unnamed file. I picked wordpad and it opens a text file that appears to be the install log for .NET SDK. My question is how do I get rid of this prompt to open the install log? I looked in "Startup" and msconfig and I can't find anything doing that. Any ideas what is causing this and how to get rid of it?
See the attached file.Boot-Problem.txt
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