|
Yea, but the knowledge base and me didn't get along either. I don't really know what to look for, hence I need a tutorial. But thx though...
|
|
|
|
|
Does anyone know of an add-in which will let me show line numbers on the left of the source lines in Visual Studio? It would help for debugging bison parsers.
Thanks,
Chris
|
|
|
|
|
|
Ctrl G does work but its sometimes a bit tedious. The parsers I'm writing have a lot of rules which emit their line number when Flex is run in debug mode. It's much easier to browse the grammar with line numbers displayed on screen. Currently I'm using PFE to do this and switching back to VC to make changes.
Cheers,
Chris
|
|
|
|
|
Hi, I was wondering if anyone knew of any new Classes or features that Win2k gives MFC. And if you need to get a new version to use for Win2k.
|
|
|
|
|
You need to get the latest SDK in order to use features such as transparent windows, but to my knowledge, the new functions are all Win32 API, I don't believe they have added to the MFC dll at all.
Of course, I could be wrong
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
I have the following problem:
I am creating an Enhanced metafile using OpenGL and then trying to convert it to a metafile (WMF).
Right now I have to do the following:
HDC hDCEnhMetaFile = CreateEnhMetaFile(.."myfile.emf");
...do my drawing...
CloseEnhMetaFile(hDCEnhMetaFile);
...
HENHMETAFILE hEnhMetafile = GetEnhMetafile( "myfile.emf")
GetWinMetafileBits( hEnhMetafile, pBuffer, numBytes );
HMETAFILE hMemMetafile = GetMetafile()
hMemWinMetaFile = SetMetaFileBitsEx( numBytes, pBuffer )
hFileWinMetaFile = CopyMetaFile(hMemWinMetaFile, "myfile.wmf")
DeleteMetaFile( hFileWinMetaFile )
DeleteMetaFile(hMemWinMetaFile )
DeleteEnhMetaFile( hEnhMetaFile )
I do NOT want to actually create an EMF file. The problem is the CreateEnhMetafile function returns an HDC not HENHMETAFILE which is required for GetWinMetafileBits - I tried to just cast the HDC to an HENHMETAFILE but this doesn't seem to work (invalid parameter error). Is there someway to get the HENHMETAFILE from an HDC? Any example code out there (I can't find anything)?
Thanks
Mike
|
|
|
|
|
My program is a single document program with some dialog boxes for input. When the user finished the input, the "main" window loses its focus, therefore, I have to press Spacebar first in order to input something to the main window. How can I SetFocus back to the window. I tried several ways but don't work.
Thanks
|
|
|
|
|
|
Hi, I have some code that will succeed when I call CreateCompatibleBitmap on a dc that in an "Enhanced" meta file dc. However, the same code will not work when the dc is the older WMF syle??? I do not know much about metafiles so I'm not sure if CreateCompatibleBitmap is suppose to work for them? Thanks )
=== WMF ======================== This does not work ===========
CMetaFileDC* pCdcMeta = new CMetaFileDC();
CDC* pScreenDC = GetDC();
CRect rcClient;
CBitmap* pBitmap = new CBitmap();
GetClientRect(rcClient);
CString cstrFileName("c:\\tmp.wmf");
BOOL bRetCode = pCdcMeta->Create(cstrFileName);
// the m_hObject in pBitmap remains NULL. GetLastError only returns zero!
pBitmap->CreateCompatibleBitmap(pCdcMeta, rcClient.Width(), rcClient.Height());
DWORD dw = GetLastError();
=== EMF ======================== This DOES work ===========
CMetaFileDC* pCdcMeta = new CMetaFileDC();
CDC* pScreenDC = GetDC();
CRect rcClient;
CBitmap* pBitmap = new CBitmap();
GetClientRect(rcClient);
CString cstrFileName("c:\\tmp.wmf");
BOOL bRetCode = pCdcMeta->CreateEnhanced(pScreenDC, cstrFileName, NULL, NULL);
// the m_hObject in pBitmap remains NULL. GetLastError only returns zero!
pBitmap->CreateCompatibleBitmap(pCdcMeta, rcClient.Width(), rcClient.Height());
DWORD dw = GetLastError();
BobSco
|
|
|
|
|
Suddenly, all of the hotkeys displayed in my menus and buttons (that is, the characters that are underlined because they are preceded by a '&') do not display the underline. They still function and the underlines appear when I hit the Alt key (which seems to toggle them on and off).
I know that these hotkeys appeared properly not too long ago.
Any suggestions as to what I might have done to make this happen?
Thanks.
Paul Ebert
|
|
|
|
|
This is due to a design error in Windows 2000 and Windows 98 ME. Someone at MS seemed to think that the underlines were a bad idea, so they added a "feature" to disable these unless the Alt key is held down.
Fortunately, someone else apparently realized the silliness of this notoin, so they added a switch in the Desktop Properties dialog to fix it. Go to Desktop | Properties | Effects and Uncheck the "Hide keyboard navigation.. blah blah" switch. Your Windows system will work correctly again.
|
|
|
|
|
You've probably got Windows 2000 and have got them turned off in the Appearence tab of the Display Properties property page.
Cheers,
Peter Pearson
|
|
|
|
|
Hi !,
I´m new using this STL, now I can add members to a list an iterate though that list, but ... still don´t now how to delete members from it, and free the list in a right way...
Can anybody help me ? Thanks a lot,Bye !
Braulio
|
|
|
|
|
To clear the whole list:
list.erase( list.begin(), list.end() );
To delete a single item:
// iter is the iterator of the item you want to delete
// iter = list.begin(); // 1st item in list
// iter = &(list.at(iIndex)); //iItem in lsi
list.erase( iter );
Hope this helps
Mike
|
|
|
|
|
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.
|
|
|
|