|
Here's the code from my "theApp" objerct:
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// Set this to include all the common control classes you want to use
// in your application.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
I don't know if this is right/wrong. It's what the wizzard put in the programs .cpp file
some more code:
CMonthCalCtrl m_cMonCtrl;
CListCtrl m_cLstCtrl;
DDX_Control(pDX, IDC_MONTHCAL, m_cMonCtrl);
DDX_Control(pDX, IDC_LOG_ENTRY_EDTLOG, m_cLstCtrl);
CTime ct;
/**************************************** ERROR *******************************/
m_cMonCtrl.GetCurSel(ct);// "Access Violation" error (no hwnd, ie hwnd=00000000)
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: InitCommonControlsEx(&InitCtrls);
DDX_Control(pDX, IDC_LOG_ENTRY_EDTLOG, m_cLstCtrl);
Just for grins, what happens if you comment out these two statements?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Larry Mills Sr wrote: ...when I checked it in Debug.
Checked what?
Larry Mills Sr wrote: Naturally upon the GetCurSel(CTime ct)
Which is called from where?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Here's the code:
CMonthCalCtrl m_cMonCtrl;
CListCtrl m_cLstCtrl;
DDX_Control(pDX, IDC_MONTHCAL, m_cMonCtrl);
DDX_Control(pDX, IDC_LOG_ENTRY_EDTLOG, m_cLstCtrl);
/**************************************** ERROR *******************************/
CTime ct;
m_cMonCtrl.GetCurSel(ct);// "Access Violation" error (no hwnd, ie hwnd=00000000)
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: m_cMonCtrl.GetCurSel(ct);// "Access Violation" error (no hwnd, ie hwnd=00000000)
Where is this called from?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Here's the code again:
void CEditLog::OnMcnSelectMonthcal(NMHDR *pNMHDR, LRESULT *pResult)
{
/**************************************** ERROR *******************************/
//LPNMSELCHANGE pSelChange = reinterpret_cast<LPNMSELCHANGE>(pNMHDR);
// TODO: Add your control notification handler code here
//m_cMonCtrl
CString str;
CString csFileName;
CString csTmp;
int nMonth, nDay, nYear;
nMonth = nDay = nYear = 0;
CTime ct;
/**************************************** ERROR *******************************/
m_cMonCtrl.GetCurSel(ct);// "Access Violation" error (no hwnd, ie hwnd=00000000)
it's called when the user selects a date in the control.
A C++ programming language novice, but striving to learn
|
|
|
|
|
I just tried this (the only control on the dialog template was a Month Calendar) with VS6 and it worked fine. I suggest you do the same, and then start re-introducing your other code until the problem comes back.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes, I've done this several times. Still the same result if I also include a ListCtrl on the same dialog. Try doling so yourself: ie, add a listctrl then try to add column headers (Report View). either the MonthCalendar will throw an Access vioalation or the ListCtrl will!
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: Try doling so yourself: ie, add a listctrl then try to add column headers (Report View). either the MonthCalendar will throw an Access vioalation or the ListCtrl will!
Did it. No errors.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
It has to be myh bad install then. I created another dialog-based project, put a MonthCal control and ListControl on the same dialog and this time the listcontrol can up with hwnd=00000000. (It was called before the monthcal control.)
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: It has to be myh bad install then.
If you care to send me your e-mail address via private reply, I'll send you my VS project for you to compare.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Okay: larryamillssr@hughes.net
By-the-way, I'd like to send you my complete project so you can check it out.(the project for checking for the error.) The original project compiled and worked correctly under VS2008 Pro BETA 2. This retail version has given me nothing but trouble from the start. And I can't get any help from microsoft. I think it didn't load something/or didn't merge something right. I've reinstalled it 4 times with the same results.
Like I said, the program was created under VS2008 APro BETA 2 and everything worked correctly until I installed the retail version.
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: Okay: larryamillssr@hughes.net
It's on its way.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
David,
I'm having some trouble with sending you the project. Please be patient. I'll eventually fiquire out why my program (Outlook) is having trouble sending it to you.
A C++ programming language novice, but striving to learn
|
|
|
|
|
In the interim, what did you discover with the code that I sent you?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Your ListControl and MonthCal control both had hwnd. However, I don't know if that proves anything or not. The program I am having this problem with Compiled and Ran as it was meant to do under VS2008 Pro BETA 2. It's this retail version that is having a problem with it. I was nearly finished with that program too!
That's why I asked if anyone else was having a problem with VS2008 Pro retail version.
A C++ programming language novice, but striving to learn
|
|
|
|
|
David,
I've tried everything to send you the project. Something is wrong and I can't send it. Maybe I could send a file at a time. I've reinstalled again and nothing has changed.
A C++ programming language novice, but striving to learn
|
|
|
|
|
Well, since I do not have VS2008, I'm not sure it would help. Is Outlook complaining about all attachments, or just .zip files?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Outlook says file too large. It's only 15.3MB
If you used your program and create another dialog calling if "IDD_ERROR_DLG" with a class named "CErrorDlg.h/.cpp" You could use my header and .cpp file to see what happens. Want to try?
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: Outlook says file too large. It's only 15.3MB
Remove the unnecessary binary files (e.g., EXE, OBJ, PCH, OPT, NCB) from it.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks to David's knowledge I've discovered that my VS2008 is NOT broken. The problem occured because I forgot to include "CDialog::OnInitDialog();" in my OnInitDialog() function.
Thanks David.
A C++ programming language novice, but striving to learn
|
|
|
|
|
Hello,
I'm using Borland C++ Builder v6. I've got a task, to show some text data. Currently I'm using Memo component for that.
But the problem is, that I have to show different words in different colors. The text has to be selectable.
What solution or component could you advise me? Is it possible to do so with Memo?
Thank you.
Dj_Lord
modified on Sunday, April 13, 2008 3:08 PM
|
|
|
|
|
I've found the solution, it is to use TRichEdit.
Dj_Lord
|
|
|
|
|
Hello every1!
I am ecountering a problem trying to write data to a serial port (COM1).
The thing is, the same code works fine in Visual Studio 5...
Here is the code in problem:
<br />
char[] portName= "com1";<br />
osWrite1.hEvent=CreateEvent(NULL, TRUE, FALSE, NULL);<br />
if(osWrite1.hEvent==NULL)
MessageBoxW(L"Creating Write Event failed...", L"Failure",MB_OK|MB_ICONEXCLAMATION);<br />
<br />
hComm1= CreateFileA( portName, GENERIC_WRITE ,0,0,OPEN_EXISTING,FILE_FLAG_OVERLAPPED,0); <br />
(CreateFile in VS5.0 was in fact CreateFileA, while in VS8 is CreateFileW, which takes another type for the first parameter)<br />
if (hComm1 == INVALID_HANDLE_VALUE)
MessageBoxW(L"CreateFile failed!Aborting...",L"Failure",MB_OK|MB_ICONEXCLAMATION);<br />
<br />
else {<setting baud="" rate,="" parity="" etc="">}<br />
</setting>
When running the code, the messageBox with "CreateFile failed! aborting..." appears. Any ideas what to do ?
Meanwhile I`m studying ways to do this using the modern way: using classes
Thanks!
Shpid3r
|
|
|
|
|
Permissions? Are you running as an Administrator, I think you have to be an admin in certain instances to talk to the serial port.
Otherwise does the port number exist?
|
|
|
|