Click here to Skip to main content
15,897,891 members
Everything / Programming Languages / VC++

VC++

VC++

Great Reads

by Naveen
How local static variable is implemented in VC++
by Paolo Messina
Class library to make development of resizable windows a easier for the MFC developer and pleasant for the user
by Marc Richarme
Could be used to create a Visual C++ like search combo for CHtmlViews... With the update, you can highlight all matching words!
by The Ænema
This article brings you a very detailed but easy to learn experience on creating your own x64 PE packer/protector using only VC++!

Latest Articles

by Paolo Messina
Class library to make development of resizable windows a easier for the MFC developer and pleasant for the user
by David 'dex' Schwartz
Old style printf format strings ported to an ostream shim class
by The Ænema
This article brings you a very detailed but easy to learn experience on creating your own x64 PE packer/protector using only VC++!
by The Ænema
Learn how to convert any code to a stable shellcode using Visual Studio 2019 and VC++ in easy steps!

All Articles

Sort by Updated

VC++ 

4 Oct 2023 by tdc_india
Error message is :: 1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.37.32822\include\stdint.h(37,28): error C2371: 'int_fast16_t': redefinition; different basic types When I click on the error, it takes me to...
3 Oct 2023 by Richard Deeming
Don't post this under "quick answers" - it assumes that the author of the project will be constantly monitoring the list of questions, and recognise that the extremely vague title and description from your question relates to their code. ...
25 Apr 2023 by Member 15974928
in a VC++ program, I want to take a value (for example an integer by an edit control in a dialog) from user and then process it throughout the program, showing in all other dialogs so that I can get this and conclusion where and when I want. It...
25 Apr 2023 by Richard MacCutchan
This is much the same issue as yesterday's question at In VC++, how can I get the value of a variable from a dialog to another one?[^]. And you still have not provided any clue as to what your code is doing, or trying to do.
24 Apr 2023 by Member 15974928
Hi, in Visual C++, I have an Edit Control on dialog A that be filled by user. now I want to send this value to dialog B so that I can read and action on it in dialog B. How can I do this? What I have tried: I try to use a variable defined in...
3 Feb 2023 by Paolo Messina
Class library to make development of resizable windows a easier for the MFC developer and pleasant for the user
23 Jan 2023 by Nikunj Bhoi
I'm currently working on the MFC application in Visual Studio 2017 which is having the dialogs designed for resolution 1920 x 1080, but now I want to modify it and make it scalable for all resolution. What changes should I make to the...
23 Jan 2023 by merano99
Since Windows 10, an application can be notified about dpi changes via its HWNDs. In addition, automatic DPI scaling of non-client area, bitmaps in controls and dialog boxes is provided. Desktop applications must notify Windows if they support...
22 Jan 2023 by OriginalGriff
Unless your app is designed from the ground up to work well in all resolutions, you pretty much can't - it's just too much work. If your app is designed like VS (workspace in the middle with variable font and font size with "dockable" toolboxes...
30 Nov 2022 by Marino_Y0301
Hi, Thank you very much for your kind help the other day. Last time I got stuck in the method of outputting in the BSTR structure and passing it to VB, but this time I got stuck in the method of passing it from VB to VC++ as input. I thought I...
30 Nov 2022 by longjmp
hi Marino_Y0301: I checked two projects, but I can't understand how to setting keys. _ Private Shared Function GetDatFromVB(
15 Nov 2022 by TDC India
we want to develop an application on win platform with VC++. what latest version of visual studio should we purchase. Any help? What I have tried: we have not done anything at present. But earlier used visual studio 10 for the same type of work
15 Nov 2022 by OriginalGriff
Depends on the size of your company, and the features you need: Compare Visual Studio Product Offerings | Visual Studio[^] Do note that the free community edition has some restrictions: Visual Studio 2022 Community Edition – Download Latest Free...
15 Nov 2022 by Richard MacCutchan
See Visual Studio: IDE and Code Editor for Software Developers and Teams[^].
27 Oct 2022 by Member 7750028
In an edit box of my dlg application, user may enter lower or upper case letters. I want the edit box to convert/display the text in Upper case. What I have tried: EN_CHANGE tried. But how exactly I do not know. How to code it.
27 Oct 2022 by Member 7750028
I am withdrawing the Question posed to this Forum. I am getting Aged (but only 74 now)! or is it my poor Eyesight (poor readability without Spects & due to Long Sight defect) I did not even see the 'Edit->Properties->Styles where the Upper case...
25 Sep 2022 by David 'dex' Schwartz
Old style printf format strings ported to an ostream shim class
25 Apr 2022 by Manuel Horn
Hi, Task 1: I would like to empty several text boxes at once; for this I use an array in which I store the contents of the text boxes. I would then overwrite them with a for loop. Unfortunately, nothing happens to the contents of the text boxes...
2 Feb 2022 by Member 15265176
I am using Wincrypt to create a self-signed certificate, but the certificate it generates has normal RSA Encryption. Is there any way to generate a self-signed certificate with ECDSA. What I have tried: Here is my code: CreateOurCertificate()...
20 Jan 2022 by rka7705
i am trying to bbuild c++ projectin visual studio 2017, but i am getting below error Severity Code Description Project File Line Suppression State Error MSB8020 The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using...
20 Jan 2022 by merano99
The easiest way would be to change the Platform Toolset to an installed version in the project properties. Best for release and build and all bit widths. If the installed toolsets do not work, the installation may need to be repaired.
19 Jan 2022 by Member 14897671
I'm working on a TLS client that needs to be upgraded to use TLS 1.3 on Windows-11. Has anyone successfully implemented TLS 1.3 using SChannel APIs? As per Microsoft below link TLS 1.3 is supported in win-11 & server-2022 Protocols in TLS/SSL...
13 Nov 2021 by The Ænema
This article brings you a very detailed but easy to learn experience on creating your own x64 PE packer/protector using only VC++!
10 Nov 2021 by a_alise
In C# We Have This Below : private string Base64Encode(string plainText) { var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText); return System.Convert.ToBase64String(plainTextBytes); } How I Will Do It In VC++ 6.0 ...
10 Nov 2021 by OriginalGriff
Base64 isn't encryption: it is translation, and is so easy to reverse that it's doesn't count as encryption in any shape, form, or manner. If you want to convert text to Base64 it's pretty trivial as a simple google will show: Base64 C++ -...
7 Oct 2021 by woody braun
If You change bi.ulFlags = BIF_RETURNONLYFSDIRS; to bi.ulFlags = BIF_BROWSEINCLUDEFILES; you will have also the files in the browsing list!
30 Aug 2021 by Aashish_stellar
Hello, I am working on .xlsx file on windows in VC++ MFC and trying to create table in its worksheets. I am using XLS2007::ListObjects::add function for creating table but function fails every time. Please have a look what I am doing: What I...
30 Aug 2021 by Maciej Los
As per documentation, a ListObject.Add function requires to define a sheet in which the list is added. For example: Set objListObject = ActiveWorkbook.Worksheets(1).ListObjects.Add(SourceType:= xlSrcExternal, _ Source:= Array(strServerName,...
7 Jun 2021 by The Ænema
Learn how to convert any code to a stable shellcode using Visual Studio 2019 and VC++ in easy steps!
22 May 2021 by Abitha Barkath
I have a vc++ based ActiveX control which has edit box which shows "?" While typing romanian s cedilla.I am using GetWindowText() to get the text. Its legacy project and multibyte is set as charater type in project settings.Only S/T cedilla I am...
21 Apr 2021 by Remspec
I am in the process of trying to upgrade a VC++ 6.0 project to the latest version and am running into an issue. The program starts up fine but in the process of creating two child windows within the main view it crashes with an access violation....
5 Apr 2021 by tdc_india
yes, we want to upgrade it to build in VS2019. What I have tried: We are yet to try anything. Need expert opinion.
5 Apr 2021 by Richard MacCutchan
You do not run projects in the Visual Studio IDE, you run them in Windows. And the way to check whether it runs successfully is to try it. If you want to upgrade it to build in VS2019 that is a different issue. Some of the older project files...
26 Mar 2021 by Zuoliu Ding
A discussion on optimization using SIMD instructions including MMX, SSE, and AVX in x86 Assembly Language Programming
4 Mar 2021 by Member 13798855
Hi All, I have string which is Unicode and I want to convert to UTF-8 to show on RichEditcontrol as it supports UTF8 only. iam able to convert everything but only currency symbols like euro or rupees is coming as garbage etc here is the string...
3 Jan 2021 by RickZeeland
Take a look at the free InnoDependencyInstaller: Download and install any dependency such as .NET, Visual C++ or SQL Server during your application's installation![^] You may need the SP6 service pack, see: c++ - Installing visual studio 6 on...
3 Jan 2021 by Member 12208944
Front end is VC++ 6.0 Application, Back end is SQL Server 2005 database, Intermediate ODBC. I have developed an VC++ 6.0 application with SQL Server database in Windows Server 2003 OS server. That application has use by 24 users [clients]. What...
3 Jan 2021 by OriginalGriff
That's seriously old software, and it's liable to give problems on later operating systems (heck, the debugger had problems on XP!) You should seriously consider upgrading to a more modern system as there is no guarantee than any of your software...
3 Jan 2021 by Richard MacCutchan
VC++ 6.0 is more than 20 years old. You should upgrade to the latest version of Visual Studio. You can then use one of the many installation creators available.
17 Dec 2020 by adityarao31
m_pReportAPI.CreateInstance("M...
17 Dec 2020 by adityarao31
MAXExact.ReportAPI is GUID.And I think some guidance I will able to get from COM programmer
17 Dec 2020 by OriginalGriff
This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself. Let me just explain what the error means: You have tried to use a variable, property, or a...
14 Dec 2020 by rmds
My struct: typedef enum { SEND_FILE = 0, FILE_SIZE = 10, }CommandList; typedef struct { CommandList command; char DataBuffer[PAYLOAD_SIZE]; } COMMAND_HEADER; struct Command_Data { char message; }; void some_unnamed_function() { ... COMMAND_HEADER...
14 Dec 2020 by Member 15021084
My solution is to use a union : typedef struct { double value1; long value2; } t_myStruct; typedef union { unsigned char asChar[sizeof(t_myStruct)]; t_myStruct data; } t_myData; t_myData mydata; then assign values to mydata.data.value1...
27 Nov 2020 by Member 15003852
I am an intermediate in VC++ and trying to accomplish the following:- 1. Dock a timer created using Windows forms to the extreme right of the taskbar (and to the left of the notification area or system tray). 2. Make it responsive (match its...
8 Nov 2020 by rajesh482
I've implimented a ATL single thread apartment based project . class ATL_NO_VTABLE CMySrv : public CComObjectRootEx, public CComCoClass, public IMySrv In the method, I'm creating multiple worker...
27 Oct 2020 by Richard MacCutchan
I could be wrong, but at a guess the following line is not correct in your ButtonClick function: CPropertyPageA PageA; You are creating a new property page object and assuming that it will refer to the existing one. But this is a different...
27 Oct 2020 by jojos learning club
Hello Everyone, I am currently involved in a Project With MFC Application Property Pages: I have two property Pages, I wanted to call the member varibale of the first property page inside the second Property Pages. I have not much experience in...
30 Sep 2020 by Maciej Los
Start by reading MSDN documentation: Database Support, MFC Application Wizard | Microsoft Docs[^] You've got 2 options to connect to your sql server instance, via: OleDb or ODBC. A proper connection string for Microsoft ODBC driver: ...
30 Sep 2020 by jojos learning club
Hello evreyone, Can anybody please let me know which connection string to be used for MS SQl server database connection for a Windows Desktop Application with MFC? I am doing this project in Visual Studio 2019, where i have connected to the...
30 Sep 2020 by Richard MacCutchan
Take a look at ConnectionStrings.com - Forgot that connection string? Get it here![^].
30 Sep 2020 by OriginalGriff
We can't tell you exactly what string to use - we have no access to your system, the network it's relying on, or the server instance you wish to connect to; you need all those to even begin assembling a connection string. Have a look here:...
16 Sep 2020 by Member 13089825
how to get the current screen width() What I have tried: i have tried with below CRect rect; GetClientRect(&rect) int width = rect.width(); but its not working
16 Sep 2020 by Michael Haephrati
What you need is the following code: CWnd* pwndParent = this->GetParent(); CRect rc; pwndParent->GetWindowRect(&rc);
7 Sep 2020 by Member 11490990
Hi everybody It is interesting, I could do any conversion in MFC Ver.6, But I receive compiler error on itoa! Could you please give me a sample. What I have tried: Every time I get POSIX Error and _itoa give me SECURE Error.
7 Sep 2020 by Michael Haephrati
To convert an Integer into a CString, the best way would be: CString MyString; int MyInt; MyString.Format(L"%d",MyInt); Another way is to use the std library's to_wstring[^], and then cast the result to CString. In that case, your code will...
5 Sep 2020 by Michael Haephrati
I found these 2 functions to work for me. void MyDialog::LoadDialogPlacement() { static WINDOWPLACEMENT last_wp = {}; // Load last stored DB version WINDOWPLACEMENT *wp = new WINDOWPLACEMENT; GetStoredWindowPlacement(&wp); if...
5 Sep 2020 by Member 13089825
If I bring up the GUI, and then I resize and close it, when I start it up again it reverts back to the original size. it should remember the old values What I have tried: the below method will get intiate while closing GUI and it will write the size void CMainFrame::OnDestroy() { ...
1 Sep 2020 by Richard MacCutchan
This is a repost of How can I convert integer to cstring in visual C++ MFC?[^] where you received the answer.
1 Sep 2020 by Sandeep Mewara
It would be as simple as: #include int main() { int number = 10; std::string s = std::to_string(number); char const *pchar = s.c_str(); //use char const* as target type std::cout
1 Sep 2020 by CPallini
What about the documentation[^]? I've underlined it for you: Because of their potential for security issues, by default, these functions cause deprecation warning C4996: This function or variable may be unsafe. Consider using safe_function...
1 Sep 2020 by Richard MacCutchan
Since you have not given us any information about your problem the code you are using, or the actual error message, the best I can do is suggest a reading of _itoa, _itow functions | Microsoft Docs[^].
31 Aug 2020 by Member 11490990
Hello everybody I have created a SDI Doc. and I have implemented a paint program I want to save this program every 1 minute programmatically. Please help me What I have tried: I have tried GetPathName(),DoFileSave() and some try and errors, but...
31 Aug 2020 by OriginalGriff
Create a timer, and set it to an interval of one second. Create a global integer variable count, and set it to minus one. Set the count to 60 when you load the document. In the OnTimer event method, check the count. If it's negative, ignore it....
30 Jul 2020 by _Flaviu
A guide to choosing and implementing a worker thread in your application
30 Jun 2020 by Cool Dude-P
CEdit* pEditControl = (CEdit*)GetDlgItem(IDC_ID); POINT CaretPos; ::GetCaretPos(&CaretPos); pEditControl->SetSel(CaretPos.x, CaretPos.y); What I have tried: Can some one help me with this
30 Jun 2020 by Yofoo
just set position of cursor in edit, Other way except CharFromPos you can use mouse_event(SendInput) to click edit also you can sendmessage(mouse message) to edit example: xxxxxx() { POINT pt; GetCursorPos(&pt);...
30 Jun 2020 by Cool Dude-P
CPoint point; ::GetCursorPos(&point); CEdit* pt = (CEdit*)GetDlgItem(IDC_SOMEID); DWORD dEditcontrol = SendMessage(EM_CHARFROMPOS,(WPARAM)0,(LPARAM)&point); int CharPostrion = HIWORD(dEditcontrol); int CharPo = LOWORD(dEditcontrol); What I...
30 Jun 2020 by Yofoo
EM_CHARFROMPOS message lParam should 4 Byte, CPoint is 8 Byte MAKELPARAM(x, y); //use this to replace CPoint
19 Jun 2020 by Rick York
Check the documentation : CEdit Class | Microsoft Docs[^] Neither override takes an x-y position. You can call call CharFromPos() to get a character position from a point. Then call SetSel(). These are in the docs.
17 Jun 2020 by Richard MacCutchan
Most likely because the co-ordinates in the point structure are outside of the client Window. You need to convert them from screen to client co-ordinates. See the references: GetCursorPos function (winuser.h) - Win32 apps | Microsoft Docs[^] and...
1 Jun 2020 by KarstenK
In a nutshell: your variables are ONLY pointer and NOT real objects. Imagine them as address values - and both addressing the same object in your code. In your case a so called deep copy may help, when your CObject class has implemented it. Use...
1 Jun 2020 by Member 13261094
Hi , I am new to c++, could you please help me with below code. CObject *m_pRetObj1; CObject *m_pRetObj2; m_pRetObj2 = m_pRetObj1; Requirement is m_pRetObj2 , should have all values of m_pRetObj1 in new address space. as of now, address...
31 May 2020 by OriginalGriff
If you want different objects, then you need to create two different instances, and copy the data over. At the moment, you don't create any instances, so your code won't work anyway: the pointer will either contain null values - and your app...
6 May 2020 by Coder969
We have a com dll from third party and using that com dll from the vb script. We want to remove the third party dll and write our own dll with same name and object so that we dont need to change anything in our scripting code. I created the new...
30 Apr 2020 by Sagar SLS
I am migrating to Visio 2016 drawing control from Visio 2010. When I save a new file as .vsd outside the main Visio application it is throwing an exception. However, the file is saved on the given location. I save the file as .vsd for backward...
7 Apr 2020 by Member 10779791
how i can trace application name or browser url where typing something?? Example if i a\m typing on word then it will return word if it will a exe file then exe file name?? Any suggestion Thankls in Advance
7 Apr 2020 by Coder969
I want to understand which hook is used for what purpose. What I have tried: I have googled and only difference I understood is WH_KEYBOAD will inject the dll into the processes but for the WH_KEYBOAD_LL windows will make a direct call to call back function without injecting the dll. So...
31 Mar 2020 by KarstenK
This is the clear sign that you have not properly prepared your open function. My best guess is that these parameters arent so optional, but are mandatory in some scenarios. You must not only initialize a variant with some proper value but also...
31 Mar 2020 by Member 13261094
I am getting exception in Open Method. lpDisp = xlBooks.Open(a_sFileName,covOptional,covOptional, covOptional,covOptional,covOptional,covOptional, covOptional,covOptional,covOptional,covOptional,...
21 Mar 2020 by OriginalGriff
Don't even think about it. It's complicated: a lot more so than you think: especially when you try to work with font sizes changing to fit text into resized controls. Think about it: font sizes are pretty much discrete values, which controls can...
21 Mar 2020 by Member 14779107
i am creating desktop applicaton so when i am try to resize window of winform then all controls are resize at runtime. i am also try C# and VB.net code in project but it does not work... What I have tried: #include #include...
20 Mar 2020 by KarstenK
Use the "oldie but goldie" legendary tool Dependency Walker. It is saved my soul in the "DLL hell" and tons of time. Best is to use it with a release build.
20 Mar 2020 by Member 13261094
Program compiled successfully. but when i am executing the program . it is showing me dependent dll as not found. 'SiAQUA.exe' (Win32): Loaded 'C:\svn_wa\Wbcode\Trunk\Projects\SiAQUA\Debug\SiAQUA.exe'. Symbols loaded. 'SiAQUA.exe' (Win32):...
20 Mar 2020 by MohanaManikandan
I'm fixing some PC Lint Plus Warnings and errors. The codebase has IDL files for COM structs. Hence the auto generated h files have virtual functions for COM class but no virtual destructor. Following is the snippet from auto-generated header...
20 Mar 2020 by Rick York
You can use the DumpBin utility that comes with Visual Studio with the /IMPORTS option and that will tell you what DLLs your program imports. Then verify that each one exists. In my experience, I have been shown a message box that states which...
20 Mar 2020 by Richard MacCutchan
This is the third time you have posted this question, and you have been given the only suggestions that we can offer. You need to collect more information from the build of your project to get a complete list of all the libraries that it is...
18 Mar 2020 by Member 13261094
Program compiled successfully. But when i am executing program , getting below exceptions 'SiAQUA.exe' (Win32): Loaded 'C:\svn_wa\Wbcode\Trunk\Projects\SiAQUA\Debug\SiAQUA.exe'. Symbols loaded. 'SiAQUA.exe' (Win32): Loaded...
12 Feb 2020 by Rick York
What I would do is take note of the CLSID that is missing and find where it is referenced in your code. It could be in the .RC file so remember to look there too. Then, remove all traces of that reference and everything that accesses. This...
12 Feb 2020 by Member 14630688
I have a MFC project which has ActiveX Labels. When I run my application on computer which does not have MS office on it my application throws error "Debug Assertion Failed" but this same application runs perfect on computer which has MS Office...
8 Feb 2020 by Member 11072126
Hi All, I have been assigned a VC++ project and its my first time am working on a VC++ project. The project was earlier built on visual Studio 2015 and I can see a Post-Build event being mentioned in project properties where it is calling a batch file - "vsvars32.bat". Am using Visual Studio...
8 Feb 2020 by Richard MacCutchan
1. The Platform Toolset is used to define the various library and platform versions required to generate the correct code for the application, e.g x86, x64, Windows version etc. 2. These environment settings are used only within Visual Studio, or in a batch process where you invoke the compiler...
27 Jan 2020 by CPallini
Quote: i have a string value and i want to convert string value to TCHAR value. A string is a sequence of characters, while TCHAR is a single character (either char or wchar_t as already pointed out by Richard), so you cannot convert. As a wild guess, I suppose you need to convert from a string...
27 Jan 2020 by AbhijeetMali
i have a string value and i want to convert string value to TCHAR value. What I have tried: dont know how to convert in c++
26 Jan 2020 by Richard MacCutchan
TCHAR is not a type, so there is nothing to convert. TCHAR is defined at compile time as either char or wchar_t depending on whether your project is set for ASCII or Unicode.
20 Jan 2020 by _Asif_
There is an Article on Code Project that does similar task and it also contains sample code as well. Try it WebService Call From VC++6.0[^]
20 Jan 2020 by AbhijeetMali
I am created illustrator plugin in c++. I want to call SOAP web service in plugin. i am trying bellow code but not getting responce. What I have tried: IServerXMLHTTPRequestPtr pXMLHTTPReq = NULL; hr=pXMLHTTPReq.CreateInstance(__uuidof(ServerXMLHTTP60)); hr =...
21 Dec 2019 by Member 14630688
I have ported an MFC application in VS 2010 from VS 2006 which works fine on my computer as I have VS 2010 on my computer but it doesn't work properly on some computers. My application stops working on some button clicks. Release build works on some computers but it doesn't work on all...
20 Dec 2019 by RickZeeland
Use a tool like Dependency Walker to check if there are any missing dll's, see: 5 Tools to Check Dependency Files Needed by Application • Raymond.CC[^] Or maybe you can try a cross-platform toolkit like this one: dear-imgui[^]
20 Dec 2019 by Richard MacCutchan
It is a reasonable guess that your application needs much more testing before release. The first thing you need to do is to find out where the failures occur, and what causes them. Adding some decent exception handling and logging would possibly help. In terms of your list of things you have...