I have been using controls in VC++ 6.0 for years without any particular problem.
This time I wanted to shift to VC++ under VS2008, using unmanaged code .
I thought the same code that creates a trivial main window, and then the simplest Static control in the main window, would work well with VS2008 too.
It doesn't seem so .
I am wondering what's wrong with the following snippet :
I can see the main window appearing with the menu and all the rest, but the Static control doesn't appear.
I get a NULL handle as a return from its CreateWindow (). The error code is 1407, appearently meaning that the control class ("Static") is unknown.
I have been seaching all the MSDN documentation without finding an useful hint.
What's even stranger , the above code works perfectly under VC++ 6.0.
Any idea ?
how to replace \n with alt+enter while exporting to .CSV
I am writing line by line to a file(.CSV). If the string is having "\n" in between then the multiline is not possible for a single cell and it is coming to the next line of Excel .
Can anyone help me to replace the "\n" with "Alt+Enter" equivalent?
I am using CSting to collect the entire line at a tiime.
I am trying as below
Let the line feed in place and enclose the cell content by double quotes. This should be accepted by Excel when rows are terminated by carriage return - line feed pairs. So your CSV file should look like:
Row1:Col1, "Row1:Col2\n with new line"\r\n
Row2:Col1, "Row2:Col2, with comma"\r\n
Row3:Col1, "Row3:Col2 with "" esacped quote"\r\n
Row4:Col1, " Row4:Col2 begins and/or ends with space "\r\n
As an alternative you may write HTML files using tables. These can be also imported by Excel.
The output window show the following error messages:
First-chance exception at 0xfefefefe in SchPedestal.exe: 0xC0000005: Access violation.
Unhandled exception at 0xfefefefe in SchPedestal.exe: 0xC0000005: Access violation.
The program ' SchPedestal.exe: Native' has exited with code -1073741819 (0xc0000005).
ClassInfo inherits from CPropertySheet, while the other objects inherit from CPropertyPage.
If you expect the error to be in the posted code, set a breakpoint on top and use the debugger to step through the instructions until the error occurs. Then check your variables to find out which is generating the access violation.
Actually, at the start the property page objects were members of the PropertySheet object.
Also, initially, the LoadSchoolName function was part of a win32 dll( I made it so for maintenace purpose) which the MFC extension dll ClassInfo.dll load or links with.
But when access violation kept occuring at that location of the function, I decided to make the function a member function in the MFC extension DLL, rather that a win32 dll.
Well, that did not solve the problem. So, I read through msdn and saw that example on DoModal() did not make the property pages member of the propertysheet object, so I decided to try that next, but still the same problem.
Shown below is the function that calls the LoadSchoolName function:
ClassInfo * pPropertySheet = (ClassInfo *)m_Pointer;
CComboBox *pCombo2 = (CComboBox *)GetDlgItem(IDC_COMBO2);
int i = 0;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
The OnInitDialog function loads various school names from data base and uses them to fill the stated combobox. Like I said the wizard displays the wizard's start page , but each time I click next, the the access violation occurs.
If I comment out the LoadSchoolName function, the wizard successfully load the next Property page , but with an empty combobox.
So I decided to replace the combobox pointer in the LoadSchoolName function with a
Object( I cast each SchoolName TCHAR pointer to ULONG_PTR using a reinterpret_cast. So that I call add the strings to the combobox from the CArray object.
On doing this , access violation occures at the point in the code where I call CArray
It appears thar whetther I try to add the string to a combobox or an array, each time I attempt to addd the school name string, access violation occurs. I don't just understand why.
You are formatting quite a lot of things into the school name. Maybe you create more than 100 characters and the StringCbPrintf() doesn't add the terminating \0 character in that case. You could try
szSchoolName = 0;
before calling AddString() and see if that changes anything.
The good thing about pessimism is, that you are always either right or pleasently surprised.
The flash memory of the PIC controllers is the program memory where code is stored. You can initialize the variable at compile time and it will be written together with the program code.
To write to the program memory by the running program you need to execute special instructions. For the PIC 32 see section 5. Flash Programming[^ PDF] of the PIC32 Family Reference Manual.
A compiler or assembler may provide functions or macros to perform the writing or compilers may have built-in support for writing. So the answer if the value is written depends on the used compiler. But if the compiler does not support writing to flash memory, you will get an error at compile time.
it really depends on the company/implementation - I doubt there's any 'standard' meaning, eg 'Example', 'Extension' - the only way to know for sure is a side-by-side comparison using [insert name of your favourite diff/compare tool here]
thank you very much. i had to name something where it was in appropriate to overload, and I couldn't think of an appropriate name. i saw something in microsoft's thread or mutex library that used that naming convention. I should have realized Ex meant "extended", duh. Kind regards,
I have an ATL dialog based applications.
I have a custom list control derived from CListCtrl with message map
BEGIN_MESSAGE_MAP( MyListCtrl, CListCtrl )
ON_NOTIFY_REFLECT( NM_CUSTOMDRAW, &MyListCtrl::OnNMCustomDraw )
void MyListCtrl, ::OnNMCustomDraw( NMHDR *pNMHDR, LRESULT *pResult )
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast( pNMHDR);
// Take the default processing
*pResult = CDRF_DODEFAULT;
if( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
*pResult = CDRF_NOTIFYITEMDRAW;
else if( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
int nRow = static_cast(pLVCD->nmcd.dwItemSpec );
if( true == MyArray[nRow].bIsOlder )
pLVCD->clrText = RGB( 128, 128, 128 );
pResult = CDRF_DODEFAULT;
But I am not getting ant reflected message from the parent dialog.
I know that it can be done by using the REFLECT_NOTIFICATIONS() in the parent class. But I read that we have to derive the CListCtrl from CContained window. Is it the right way, if so what are things I have to take care.
Is there any better solution to resolve this issue?
Hello everyone, there is an article in Chinese discussing MS Detours API hooking library and Mhook library. I don't understand how to download the attachment and I can't understand the article. Could anyone who understands Chinese help me out here? Much appreciated in advance!! Please
I'm facing the following strange problem using MFC Grid Control (by Chris Maunder) in my VS2010 MFC application:
I've included the CGridCtrl control in a dialog in order to let the user to edit data. It works fine but sometime when I open the dialog the cells content is not displayed but it's covered by the cell background color.
Unfortunately I can't solve the problem because it only happens randomly. I tried to call Invalidate() to both the CGridCtrl control and the dialog but it doesn't solve.
Normally we would tell you to post this question in the forum at the bottom of the article: MFC Grid control 2.27[^], but I think it is ok for you to post it here as well.
Although Chris is around all the time, he is obviously very busy so there is no guarantee he is able to answer your question.
It is a very old project by now (it is article #8 here on CodeProject!), but I see that Chris did update it not too long ago. In your explanation of the problem, you need to include which version of Windows you are running it on an make sure to mention whether it is 32 or 64 bits.
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty