|
How can I hide several classes and typedefs from the class view tree?
|
|
|
|
|
You can do two things. The easiest, if the class is defined in it's own header file seperate from other things, just remove it from the "Headers" folder in the File View.
Second, you can add the header file to a text file called sysincl.dat in the ...\Microsoft Visual Studio\Common\MSDev98\Bin directory.
To my knowledge, there isn't a way to remove just a class, you have to remove everything that's in a file.
|
|
|
|
|
I currently have an MFC-ODBC based application with
the wizard generated initialization. I would like
to initialize from a SELECT FROM WHERE type query.
My current code as follows:
CRegiDBSet::CRegiDBSet(CDatabase* pdb)
: CRecordset(pdb)
{
//{{AFX_FIELD_INIT(CRegiDBSet)
m_CourseID = _T("");
m_CourseTitle = _T("");
m_Hours = 0;
m_StudentID = 0;
m_CourseID2 = _T("");
m_SectionNo = _T("");
m_Grade = _T("");
m_InstructorID = _T("");
m_Name = _T("");
m_RoomNo = _T("");
m_CourseID3 = _T("");
m_SectionNo2 = _T("");
m_InstructorID2 = _T("");
m_RoomNo2 = _T("");
m_Schedule = _T("");
m_Capacity = 0;
m_StudentID2 = 0;
m_Name2 = _T("");
m_GradYear = 0;
m_nFields = 19;
//}}AFX_FIELD_INIT
m_nDefaultType = snapshot;
}
CString CRegiDBSet::GetDefaultConnect()
{
return _T("ODBC;DSN=Student Registration");
}
CString CRegiDBSet::GetDefaultSQL()
{
return _T("[Course],[Enrollment],[Instructor],[Section],[Student]");
}
This brings in all of the rows from all of the tables.
I would like to initialize from a select; something like the following.
I have already tried substituting this in the GetDefaultSQL proc.
_T("
SELECT Course.CourseID as 'ID',
Course.CourseTitle as 'Title',
Section.Hours as 'Hours',
Section.RoomNo as 'Room',
Instructor.m_InstructorID
FROM Course, Enrollment, Instructor, Section, Student
WHERE Course.CourseTitle like 'Math'
ORDER BY 'ID', 'Room'
");
Additionally the wizard generates a large list of variables
corresponding to all of the columns in the tables. I would
like to initialize my date with the results from the query
shown above. Working example code would be very helpful.
Thank You.
|
|
|
|
|
I am trying to use CCheckBox buttons (push-like property set) on a dialog. When one is selected I need to change the text color and the background color of the selected button. I am using CColorButton in order to do this with standard CButtons, but how can I change the color of these CCheckBox buttons?
Roger
Software Engineer
|
|
|
|
|
If I had MFC in my app, I could just do this:
CFile file;
CFileStatus status;
if ( file.GetStatus(path, status) && (status.m_attribute & CFile::readOnly) == CFile::readOnly)
{
status.m_attribute &= (~CFile::readOnly);
file.SetStatus(path, status);
}
but it's my (in)famous WTL program, and so I do not. ( Yes, yes, it appears I can turn MFC on in the app, but that kinda misses the point, doncha think ?? ).
So how did we unset this flag programatically before MFc storlled along ?
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
BOOL SetFileAttributes(
LPCTSTR lpFileName, // file name
DWORD dwFileAttributes // attributes
);
--------------------------------------------------
If my messages appear curt, I apologize.
I try to be brief to save your time as well as mine.
--------------------------------------------------
|
|
|
|
|
I know how to use OLE DB in MFC standard exe, but now I must use it in my companent which is a regular DLL, it doesn't work!who can help me?
I'm a vcd! visual c++ developer!
|
|
|
|
|
I'm trying to create a custom appwizard that can creates a static library project without MFC.
However, it seems the default project type the custom appwizard creates is a MFC MDI win32 application.
To generate a static library without MFC, I have to undefine the MFC standard appwizard macros from the m_Dictonary member manually, and add each macro for the static library.
This seems to be like a quick hack because in the long run, it seems very unportable. Is there another way to specify the appwizard to generate a static library without MFC?
|
|
|
|
|
Use the "Win32 Static Library" AppWizard. It sounds like you're using the MFC AppWizard.
--Mike--
http://home.inreach.com/mdunn/
All your base are belong to ME~!
|
|
|
|
|
Firstly thanks to all who maintain and contribute to this site. I have learnt a lot from your efforts, so thanks again.
Now to my problem. I have an application that is required to print some reports. I have done this by deriving a view from CView and using the MFC framework to do the printing for me. I have overwritten OnPreparePrinting, OnPrepareDC, OnBeginPrinting etc. Now everything has been working fine for quite a while now. Yesterday I came to do some minor modifications to the format of the report. I recompiled my application in debug and stepped into my code. I got an assertion failure in ...\mfc\src\viewprnt.cpp. It occurs in the function DoPreparePrinting(). pInfo has been created using default values etc - I don't try and do anything with it.
I won't copy all the code for the function in here but basically it is an if..else statement. My code executes the else statement and I have marked the bit that fails.
else
{
// otherwise, bring up the print dialog and allow user to change things
// preset From-To range same as Min-Max range
pInfo->m_pPD->m_pd.nFromPage = (WORD)pInfo->GetMinPage();
pInfo->m_pPD->m_pd.nToPage = (WORD)pInfo->GetMaxPage();
if (pApp->DoPrintDialog(pInfo->m_pPD) != IDOK)
return FALSE; // do not print
}
ASSERT(pInfo->m_pPD != NULL);
***** ASSERT(pInfo->m_pPD->m_pd.hDC != NULL); **** This fails
if (pInfo->m_pPD->m_pd.hDC == NULL)
return FALSE;
Now the things that bother me are that it worked in the past but not now. I have not changed the code that produces the report - only a small cosmetic change the the layout of the report. And further if I execute the program rather than step into it it works!
I have done my best to wade through the documentation hand have searched the MSDN site and read the references I could find. I have stepped through this repeatedly and am most puzzled. From looking at the code in CView I can see that pInfo->m_pPD->m_pd.hDC seems to be created when CreatePrinterDC is called. However as I step through that statement is never called - it is in branches of code that my application doesn't execute. I don't really want to change what the user sees because I do want them to be able to change the default printer used. I have tried cutting and pasting CView's DoPreparePrinting function and inserting a CreatePrinterDC call but all this leads to is a crash when CView later on calls GetPortName because the pointer returned by ::GlobalLock(hDevnames) is NULL.
If anyone has any ideas as to what might have happened or to where I might look next for an answer then I would be most grateful.
Thankyou in anticipation and sorry for the length of this post.
|
|
|
|
|
I want to write a program to login win98 !
But before User can login I must block win98 explorer.exe !
How can I do it ?
Thanks everybody !
Bob
|
|
|
|
|
I want to write a program to login win98 !
But before User can login I must block win98 explorer.exe !
How can I do it ?
Thanks everybody !
Hong Bob
|
|
|
|
|
Hi,
I want to know how can I save all the contents of a CListCtrl and how Reload it when the program restart?
plz reply here : mpblaze@iquebec.com
BLaZe
|
|
|
|
|
You'll have to iterate through using GetItemText(. . .) to retrieve each one. Just like you did to set the individual items
and subitems when you initialized it.
Hope this helps.
Best Regards
|
|
|
|
|
PLease can you send me a little source with only these 2 function
- Write CListCtrl to a file
- Read CListCtrl from the file
plz if you have time
TIA
BLaZe
|
|
|
|
|
i am developing a MS-PAINT like application and i have a class derived from
CScrollView
Now everything works fine as long as i draw Lines /Rectangles etc. but when
i want to enter Text , i am unable to do so directly on the screen , i want
to display a blinking cursor when the user enters the text within a
specified region
(just the way text is entered in MS-PAINT)
someone please help me
--mayank
===========;)
|
|
|
|
|
Good luck. You need to display a caret, move it, disply the text you enter, etc., etc., etc.
At the end of the day, their way sucks anyhow. I thought of doing something similar, excepting that I'd make the box moveable, but why would you ? You type a bit, resize your box, type a bit, decide it's not in the right position, delete the box, start again..... My paint program does it with a modeless dialog - you can select font, select pitch, select text effects, and enter text into a RichEdit, then the text becomes a tool that you can move about, and click to stamp it where-ever you like, as often as you like. It's intuitive and easy to use, unlike Paint *or* Paint Shop Pro ( the last version I used was 5, but I *never* figured out the text tool ).
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Does every call to CString::GetBuffer() have to be matched to a CString::ReleaseBuffer() call? In particular, when a GetBuffer() call is used as a parameter to a function i.e.
nRet = SQLTables( hStmt, NULL, SQL_NTS, NULL, SQL_NTS, NULL, SQL_NTS,
(unsigned char *)strType.GetBuffer( 0 ), SQL_NTS );
strType.ReleaseBuffer(); // Necessary
What effect will not calling ReleaseBuffer() in the above example have? Memory leak or just problems with other CString member calls prior to ReleaseBuffer() being called?
Thanks!
|
|
|
|
|
When you call GetBuffer(), you are responsible for managing the character buffer. Calling ReleaseBuffer() tells CString that it can take over memory management again. If you don't call ReleaseBuffer() but do call some method that would normally make CString reallocate and grow the buffer, it'll likely fail.
Also, the MFC docs on CString::GetBuffer() say this:
If you use the pointer returned by GetBuffer to change the string contents, you must call ReleaseBuffer before using any other CString member functions.
--Mike--
http://home.inreach.com/mdunn/
All your base are belong to ME~!
|
|
|
|
|
you can get more info on this in CP Article.
http://www.codeproject.com/string/cstringmgmt.asp
|
|
|
|
|
Does anybody know if there is a common or wellknown behaviour why an
MFC-Application works flawlessly in DEBUG-Mode and suddenly when compiled
in RELEASE-Mode throws the unhandled exception 0x00000005:Access violation???
Manfred
---
Programming is knowing...
|
|
|
|
|
We're working through a couple of similar bugs here right now, and this URL
http://codeguru.earthweb.com/debug/ReleaseMode.shtml
is full of good advice. One other thing you can do is change TRACE to OutputDebugString, and you'll get tracing in release mode.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Thanks Chris - it's once again YOU to help me (try to) out of a problem.
OnPaint() is working now as it is supposed to...
Also thanks to all the other Gurus: 'Funky' Erik (Funkenbusch) and Lauren (I like the
colours of your homepage)...
The unhandled exception 0x00000005:Access Violation occurs in a WIN callback-function.
When I open some MIDI-Input with
midiInOpen(&hMidiIn, CurInDevice, (DWORD)MyCallback, NULL, CALLBACK_FUNCTION); The 3rd parameter is the address of a callback-function which is called by the
Midi-Device-Driver everytime a MIDI-Event has arrived its input.
The callback works as follows:
void CALLBACK MyCallback(HMIDIIN hMidiIn, UINT wMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
{
int iResult;
switch(wMsg)
{
case MIM_DATA:
{
iResult = Zones->PostMessage(WM_MIDIEVENT);
ASSERT(iResult);
break;
}
case MIM_MOREDATA: break;
case MIM_OPEN: break;
case MIM_CLOSE: break;
default:
ASSERT(0);
} So the callback only posts a userdefined message
#define WM_MIDIEVENT WM_USER+100 to my Dialog. The MessageMapEntry
ON_MESSAGE(WM_MIDIEVENT, OnMidiEvent) is for now just a stub - doing nothing...
void CZones::OnMidiEvent()
{
} When the first MIDI-Event arrives everything works fine, but as soon as the second
event drops in I may not move the mouse over the System-Menu or click the Dialog or move
over a checkbox in the dialog. As long as I don't move the mouse I can play as many notes
as I want...
BTW: When the Dialog is minimized everything works flawlessly too. But I only have to
right-click into the task-bar.....EHHHHHH
No context-menu for maximizing or closing - just my unhandled exception 0x00000005:ACCESS-VIOLATION
Any Ideas on that ?
The exception appears on two machines exactly at the same address.
In DEBUG-MODE everything works brilliant, no latency (MIDI-delays) no MIDI-drones (sounding
till you shut down your system) - no really professional...
Manfred
---
Programming is knowing...
|
|
|
|
|
I followed your advice, Chris - and went to your CodeGuru link.
http://codeguru.earthweb.com/debug/ReleaseMode.shtml
There was one comment by Kelly Beyer: 'Incorrect Message Map Function Signatures'
which referred to a MSDN-KnowledgeBase article.
http://support.microsoft.com/support/kb/articles/Q195/0/32.ASP
So I changed the handler macro of my User-defined message from
afx_msg void OnMyMessage(void); to
afx_msg LRESULT OnMyMessage(WPARAM, LPARAM);
And my handler-function from
void MyDialog::OnMyMessage(void); to
LRESULT MyDialog::OnMyMessage(WPARAM, LPARAM);
And now it works.
In all my books showing how to write User-defined messages it is done the wrong way.
No explanation that the signatures have to be exactly like the ones above. They all
used 'void' instead - and as, when being a beginner, you seldomly switch to release-mode
you never realize that there is a little bug in your application. And when you do
it once than you'll never find out when this bug silently came into your app.
Though it's hard to put the blame on a User-defined message that worked for months in DEBUG-MODE.
Believe me: You would take everything else under consideration before this...
But at least I think it is a very bad behaviour that the compilor doesn't give you
at least a warning when working in DEBUG-MODE (I'm only working in 'Warning-Level 4').
I would never have found the bug in my app without that articles on the net.
There is one little question still bugging me as I got a little paranoid now.
Do you think that this is the real solution to my problem or is it just a temporary
workaround that is hiding another surprise for me now for the future???
Does it sound like 'there must be something else' to you ???
Thanks again for your help - this time a hit, not only a try...
Manfred
---
Programming is knowing...(and having better friends than the MicroSofties)
|
|
|
|
|
Yes, i believe it. This bug used to catch me all the time. Now i've learned to always do ON_MESSAGE handlers the LRESULT way.
there is a "ON_MESSAGE_VOID" message handler, but i've never used it and i don't know if it will help. (from Afxpriv.h)
#define ON_MESSAGE_VOID(message, memberFxn) \
{ message, 0, 0, 0, AfxSig_vv, \
(AFX_PMSG)(AFX_PMSGW)(void (AFX_MSG_CALL CWnd::*)(void))&memberFxn },
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|