Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all 3021 articles
Browse latest View live

menuitem separator

$
0
0
I'm using this tutorial for making an owner draw menu.

http://www.codeguru.com/cpp/controls...ep-by-Step.htm

When I go into the .rc file and remove all of the MENUITEM SEPARATORs all the menu options are squished to the left of the menu as in the screenshot. As long as there is just one MENU SEPARATOR anywhere the menu is fine. If I could make the application without MENU SEPARATORs that would be awesome. Any help would be great. Thanks for your time!!!
Attached Images
 

Debug a Native DLL written in VC++.NET 2010 Express called from a VB.NET .exe file

$
0
0
The saga continues. Sometimes I think I must be the first person in the world to convert a VB6 project that calls a VC++ DLL into the new and exciting (ie really irritating) .net versions, namely vb.net and vc++.net

In VC++ 6.0 you could set the debug version of the calling VB6 .exe and then trace it through the dll step by step like this:

Project --> Settings --> Debug --> Executable for Debug Session

Now,according to Microsoft you cannot do this in 2010 Express version of vc++.net but you CAN (they say) put a break in the vc++.net dll then start your exe in vb.net and it will step into it

Well, when I try it, it does NOT go into the DLL when I press F8 - anybody know the trick?

(I am using 2010 Express because I am on XP because I still need VB6 and it will not install the VB6 IDE in Win 7/8)

Edit:
Well, it seems that in vb.net, if you right click when you get to the line of code that calls the function in your dll, you get the following option (in my case):

Step Into Specific: MOPEKS.prjDLLs.TestF

where "MOPEKS.prjDLLs" is the module in my code that includes TestF. So, I do this and press it, whereupon, according to Microsoft it should go into the function TestF. Of course, it doesn't but this does sound like progress of a sort

Here is MS on the subject from:

http://msdn.microsoft.com/en-us/libr...=vs.90%29.aspx

To step into a specific function

Advance the execution point to the function call you want to step into. (You might use a breakpoint, Step Into, Step Over, or Run To Cursor.)

Right-click the source window to open the shortcut menu.

Click Step Into Specific and choose the function you want from the submenu.

The debugger executes the function call and breaks at the beginning of the selected function. The Step Into Specific command appears only if the execution point is located on a line of code that contains a nested function.


I have a horrible feeling that maybe it is disabled in the Freebie versions (ie Express 2010 in my case)

CString::Format() Cannot Align Well Vertically

$
0
0
Hi,

I am trying to display some data in text format on a dialog and I am using a CString to do it. Below is how I coded it.

Code:

CString outputStr;
CString auxStr;

// Add header
outputStr.Format("");
auxStr.Format("%-7s%-20s%-7s%-20s%s\r\n", "CalNo", "CalA (in)", "CalNo", "CalB (in)", "A+B (in)");
outputStr += auxStr;
...
for(...) {
    // Do some calculation
    ...
    // Append data for each row
    auxStr.Format("%-7d%-20.3f%-7d%-20.3f%.3f\r\n", calANo, calAVal, calBNo, calBVal, calAVal+calBVal);
    outputStr += auxStr;
}
...

But the output rows are not aligned as shown in the attached picture. There a two problems.
1. Data rows don't align with the header row.
2. When the first element of a row changes to two digits, the other elements are shifted.

According to MSDN(http://msdn.microsoft.com/en-us/libr...v=vs.60).aspx), CString::Format() works the same way as printf(). I wrote a small program using printf() to do the same thing, and the output in the console are perfectly aligned.

What have I missed when doing the display in GUI?

Thanks,
Brian
Name:  CaliperMeasure.jpg
Views: 96
Size:  14.8 KB
Attached Images
 

How do you CWnd::SendMessage(...) a pointer to a string?

$
0
0
The following throws an exception so what is the correct way of ding this?

Code:

void CBase::SendMessage(LPCSTR lpszMessage)
{
        static CString strMessage;

        strMessage = lpszMessage;
        m_pDlg->SendMessage(WM_UPLOAD_MESSAGE, (WPARAM)(LPCSTR)strMessage);
}

Microsoft Visual C++ and I2C(I Squared C) interface

$
0
0
Hello All,

I am attempting to write up a program using Microsoft Visual C++ to control an I2C(I Squared C) interface. The I2C interface has a RS-232 connection. I want to use this setup to transfer a hex file to a ATMEL AT24C01B. The hex file will be transferred to the EEPROM slave address of: A2. The program should ask the user to input a number(must be 3 digits) that is associated with a certain hex file and also another number selection(must be 8 digits).

I am rusty in C++, more so than I initially thought. Plus, I am not familiar with the I2C hardware. Can anyone help me out with this?

Thank you in advance.

Boston357

Letting a user enter a charter on a specif line and place ?

$
0
0
Hi!

First off:

Sorry if this is wrong question, I'm new here + not a expert on C++.
Is this the right place to ask this if I have Bloodshed dev C++ ?...

Please move it then if not! :)..

To the question:

How can I create in my C++ program so a user can paste a text
and then choose a charter on specific line and place?. The above thing isn't that important
I just want to place a charter on a specific line and place.

I mean something like this:

Enter a charter:

You choosed " / "

On wich line do want the charter?

You choosed "Line 1 and 2"

Where do you want the the to appear on the line?
(left or right)

You choosed left.

Results:


Line 1. / hello

Line 2. / hello



Thanks alot!

I don't know if this is a too big thing to ask or it's just a small thing so it's ok...
Just give some explame.

Cheers.

How do you fix this release mode compile error?

$
0
0
else if (!FileExists(strFilePath))
{
AfxMessageBox(_T("The files ") + strFilePath + _T(" does not exist..."));
}


Error 1 error C2664: 'CEasyWebStoreUploaderDlg::FileExists' : cannot convert parameter 1 from 'ATL::CStringT<BaseType,StringTraits>' to 'CString' G:\EasyWebStoreUploader\EasyWebStoreUploaderDlg.cpp 157

How do you make this bit of code compatible with both debug and release builds?

$
0
0
This code compiles in release mode but I get this compile error in debug mode:

Error 1 error C2664: 'GetPrivateProfileStringA' : cannot convert parameter 4 from 'wchar_t [255]' to 'LPSTR' g:\easywebstoreuploader\ini.cpp 45


Code:

CString CIniFile::getKeyValue(CString strKey, CString strSection)
{
        wchar_t ac_Result[255];

        // Get the info from the .ini file       
        m_lRetValue = GetPrivateProfileString(strSection, strKey, _T(""), ac_Result, 255, m_strFileName);       

        CString strResult(ac_Result);
        return strResult;
}


Changing the back ground color of a control in this situation

$
0
0
ON_WM_CTLCOLOR(...) works for all the other controls but not the tab control.

Code:

void CEasyWebStoreUploaderDlg::DoDataExchange(CDataExchange* pDX)
{
        CDialogEx::DoDataExchange(pDX);
        DDX_Control(pDX, IDC_TAB_CTRL, m_tabCtrl);
        DDX_Text(pDX, IDC_EDIT_STATUS, m_strServerStatus);
        DDX_Text(pDX, IDC_EDIT_UPLOAD_RESULTS, m_strUploadResults);
}

Developing HTTP Server using C++

$
0
0
I am developing an HTTP Server in VC++ using Microsoft's Casablanca SDK using this article

http://www.strathweb.com/2012/12/web...native-c-code/

In this article they have mentioned that

Quote:

Before we run this app, you need to copy two files to the build folder (since the installation of the SDK will not modify your PATH settings):
– casablanca110.dll
– casablanca110.pdb


For debug builds you can copy these files from C:\Program Files (x86)\Microsoft Code Name Casablanca SDK for VS 2012\SDK\bin\x86\Debug to your Debug folder.
I did copied these 2 files into the debug folder of my project, but when I ran, the project, I still received this error message that the application needs casablanca110.dll and terminiates. Can someone tell me the solution to this?

Visual Studios .NET 2003 Strange Build Dependencies

$
0
0
Hello all, it's my first post here, so we'll see how it goes.

As an upfront disclaimer, I'm trying to bandaid a rediculously complicated inherited build process that I would like nothing less than to destroy and use some modern aids, but alas I'm stuck with what I've got and will try to make due :(

I've got a solution with 107 projects in Visual Studios .NET 2003, but we will say I've got 26 projects that build in order A->Z. I do a clean, ensure that no files are lurking about to mess with me, then I build.

The build breaks on projects P and Q with errors of "identifier not found, even with arguement dependent lookup", with the dependency being project H which built a ways before. I do a project-only rebuild on H, then a project-only rebuild on P, and no problems. If I do a project-only rebuild on Q at this point, no problem. If I do a solution build (not clean) right after rebuilding P, it will break on Q, again with the same error which is satisfied by H.

None of the other projects build H's code.

Any ideas on:
1) What does the error "identifier not found, even with arguement dependent lookup" actually mean? Google wasn't able to assist.
2) What is causing this strange build dependency?

Much thanks...

Using Casablanca SDKs in C++

Calling VC++ routines from Fortran 77

$
0
0
Is it possible to call VC++ routines using a Win32 DLL form fortran 77??

[RESOLVED] Visual Studios .NET 2003 Strange Build Dependencies

$
0
0
Hello all, it's my first post here, so we'll see how it goes.

As an upfront disclaimer, I'm trying to bandaid a rediculously complicated inherited build process that I would like nothing less than to destroy and use some modern aids, but alas I'm stuck with what I've got and will try to make due :(

I've got a solution with 107 projects in Visual Studios .NET 2003, but we will say I've got 26 projects that build in order A->Z. I do a clean, ensure that no files are lurking about to mess with me, then I build.

The build breaks on projects P and Q with errors of "identifier not found, even with arguement dependent lookup", with the dependency being project H which built a ways before. I do a project-only rebuild on H, then a project-only rebuild on P, and no problems. If I do a project-only rebuild on Q at this point, no problem. If I do a solution build (not clean) right after rebuilding P, it will break on Q, again with the same error which is satisfied by H.

None of the other projects build H's code.

Any ideas on:
1) What does the error "identifier not found, even with arguement dependent lookup" actually mean? Google wasn't able to assist.
2) What is causing this strange build dependency?

Much thanks...

C++ open source project for beginners

$
0
0
Hello all,

I'm reading the PPP book (this http://www.stroustrup.com/programming1.html). Now I'm doing the exercises of chapter 14 and soon I start the 15th chapter of it.
For becoming a real programmer I heard that I should test my skill in practice, for example, in a team on a project, like an open-source one.

OK, after some research I found that GitHub is one of the best websites offering very good open-course projects. I saw that website and explored it but indeed I couldn't find an appropriate project for myself.
My C++ knowledge till here by reading books is, types and statements, conditions and loops, vectors, functions, classes and some primary cases of Graphics.
The problem with the projects of that website is that all of them (or at least all of that I found) are in a high level that I can't understand.

Now my questions is, in reality, is participating in such projects needed for me now? If yes, what good open-source project do you know to recommend me please? It should be a C++ one and in a low level to be useful for me.

If no, apart from that, what else can I do? I like to join in a team.

Thanks guys.

How Can I Disable WM_CONTEXTMENU Handler of CEdit?

$
0
0
Do I have create a new class inheriting CEdit?

Developing Unmanaged aplications in VS2013 to Work Just Like VC6 Did

$
0
0
Well Im trying to develop applications in VS2013, just like i did in VC6 i want the new IDE but i like the old final exe depencencys...

I developed a simple console project and customer reported, the program complains about MSVCR120.dll.


BTW im using the new safe versions of sprintf_s, strcpy_s etc etc etc... and i heard that they are not part of the standard so.. would they be the reason for my program complaining about MSVCR120.dll?

If not whats the correct way to develop my application to be undependant to those dlls i want they to deploy just like VC6 projects do.


Thx in Advance!!

[RESOLVED] Developing Unmanaged aplications in VS2013 to Work Just Like VC6 Did

$
0
0
Well Im trying to develop applications in VS2013, just like i did in VC6 i want the new IDE but i like the old final exe depencencys...

I developed a simple console project and customer reported, the program complains about MSVCR120.dll.


BTW im using the new safe versions of sprintf_s, strcpy_s etc etc etc... and i heard that they are not part of the standard so.. would they be the reason for my program complaining about MSVCR120.dll?

If not whats the correct way to develop my application to be undependant to those dlls i want they to deploy just like VC6 projects do.


Thx in Advance!!

VS2013 Compiling with header redirection IDE complains. "Open SSL"

$
0
0
Hello im trying to compile a project that uses Open SSL but i have a problem since compiler complains about this on some headers

The files are empty and only containing this line:

"../../crypto/md5/md5.h"

I understood that those headers redirect to the actual file in a different path from the include folder, must work in other compilers but VS2013 complains about it.

Im planing to work arround it like copying those files directly in the include folder or even take the time to redirect those includes to the actual file one by one but im guessing that there is a simpler way.

The reason Im asking is cause i have no idea how to search about the solution or where are the terms.


Thx for your time!!

Selection issue with CListCtrl

$
0
0
Hi,
I have a ListCtrl on my dailog. It has a report view. In my case I have selected first row with left click of mouse and entire row is displayed in blue color as selection (as per expected) and when I right click the second row of the listctrl it displays the menu which I have added to it and the selection remains with the first row.(as expected).
I have already overridden the ListCtrl class.

I want that on the right click of second row the selection should remain with the first row but this second row also should be displayed with dotted line border.

Please help in getting out from this problem. Any input will be helpful.


Thanks in advance.
Viewing all 3021 articles
Browse latest View live