|
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.
|
|
|
|
|
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~!
|
|
|
|