|
How do I go about displaying Windows Explorer style forlder view without control panel, printers and recycle bin, but only to include drives (hard disks, floppy disks and CD roms) and directories with correct icons. Is there a system property does assosiates icons to device types?
Please help,
Tushar
|
|
|
|
|
Hello,
Sorry if this is a repleat type question.
I have been using this site to learn more about WTL and there is very useful information included. I am trying to develop a FormView type application that has a toolbar + statusbar + dialog type form view. When I create such an application with WTL app-wiz, I do not get scroolbars the way MCF app-wiz does and therefore if I resize the eventual application, I cannot scroll which you can imagine causes a problem.
Next question, it is possible to display menus in MCF application with icons, like WTL apps do? I do not want to incorporate large amounts of code into my app that is not tested. This way I would not have to use/learn WTL.
Please help,
Tushar
|
|
|
|
|
After i compiled my project in the release version and execute my program in other computer, there is an erros msg says "An unsupported operations was attempted".
I think the one causing it is my MFC 2.0 GridControl
What can I do ???
|
|
|
|
|
I don't know where the gridcontrol resides (comctr32?), but it seem like
you either don't have the module on the testcomputer, or it is not registred. Check version for whatever module gridcontrol resides in, and try to (re)register it using regsvr32.
/moliate
|
|
|
|
|
How to get the manufacturer/model of a given cd-rom drive letter?
I know how to get this from registry (HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\Scsi) but how to associate a given drive letter and a given scsi port? But if I can associte this information, how about other types of cdrom's (SCSI/EIDE)?
Any help would be apreciated!
Thanks in advance!
Rui Lopes
|
|
|
|
|
I want to print from a document that it contain
text,the text is more than one page,how and where
I should initialaze it and write code for it?
|
|
|
|
|
the code as follow:
bool CDBOperate::CanLoginToDB(CString username,CString userpassword)
{
if(username.GetLength()<=0||userpassword.GetLength()<=0)
return false;
if(!m_db.IsOpen())
ConnectToDB();//this function use to open database
char *sqltext="select * from user";
CDaoRecordset rs(&m_db);
try
{
rs.Open(AFX_DAO_USE_DEFAULT_TYPE,sqltext,0);
}
catch(CDaoException* e)
{
e->Delete();
return false;
}
rs.m_strFilter="user="+username+" and password="+userpassword;
int i=rs.GetRecordCount();
if(i<=0)
{
rs.Close();
//delete rs;
return false;
}
rs.Close();
//delete rs;
return true;
}
but each time I can't get reocrd from datbase(user.mdb).
In fact ,there are 3 record in the database.
|
|
|
|
|
Your problem is in the Filter...
See the following
rs.m_strFilter="user="+username+" and password="+userpassword;
This must be
rs.m_strFilter="user=\""+username+"\" and password=\""+userpassword + " \"";
You forgot the quotes in your sentence.
The Filter is the where in a SQL sentences. User and userpassword fields are char, is for this that the value that are you looking for must be between quotes.
Best Regards....
Puff Today is Monday....
Carlos Antollini.
|
|
|
|
|
I tried it,but I can't get record too.
I don't know why!
help!!
|
|
|
|
|
GetRecordCount() typically doesn't know how many records you have until you're iterated over all of the records. My loops typically look like:
while (!rs.IsEOF())
{
...
rs.MoveNext();
}
Joel Lucsy (jjlucsy@concentric.net)
|
|
|
|
|
Hi all,
I'm trying to create some exported functions in a DLL; these functions are called from my main application(the main application is a console application). When a user type 'X' and enter, I want launch my Doc/View usign a DLL.
Therefore I've to create a window supporting MFC doc/view architecture.
Problem is that I don't know how create this window????
Thks for you help,
HES
|
|
|
|
|
You could look at this http://www.codeproject.com/docview/docviewfromdll.asp
Cathy
|
|
|
|
|
Is there a simple method to draw anti-alias'ed circles or lines? For example, if I use the code:
pdc->Ellipse( ARect );
It draw an ellipse. Is there a simple method to define a pen type that will perform anti-aliasing for me?
Thanks in advance..
|
|
|
|
|
Use the new GDI+.
Search for GDI+ or GDI plus on CodeProject
Bys,
Rui Lopes
|
|
|
|
|
How to display different icons for a tree control item when it is expanded and colapsed?
Nitesh
|
|
|
|
|
You need to set an imagelist for the state: SetImageList( &il, TVSIL_STATE );
Beyond that, I'm not quite sure.
Joel Lucsy (jjlucsy@concentric.net)
|
|
|
|
|
This will work nicely (apart from the typos ):
void CWindowWithTreeCtrlInIt::OnTreeItemExpanding( NMHDR* pNMHDR, LRESULT* pResult)
{
*pResult = 0;
NMTREEVIEW* pNMTreeView = (NMTREEVIEW*)pNMHDR;
HTREEITEM hCurrent = pNMTreeView->itemNew.hItem;
BOOL bExpanded = TVIS_EXPANDED & m_wndTree.GetItemState(hCurrent, TVIS_EXPANDED);
if ( m_wndTree.ItemHasChildren(hCurrent) )
{
int nNewImage = bExpanded ? 0 : 1;
m_wndTree.SetItemImage(hCurrent, nImage, nImage);
}
}
Important bits: use TVN_ITEMEXPANDING, not TVN_ITEMEXPANDED; TVN_ITEMEXPANDED is only called the first time an item is expanded, or after TVE_COLLAPSERESET has been called on it.
|
|
|
|
|
Hello guru's. I've experienced pretty strange OS specific bug or something using SDI app with database support (ODBC), using microsoft access database. I wrote the program under Win2K and it worked perfectly untill I tested it under Win98. It seemed that neither m_pSet->Edit();m_pSet->Update();m_pSet->Delete() work as they are supposed to. It gives me the following error "Query is too complex". I dug really deep in the MFC documentation and did not found any solution. Any workarounds, or ideas of fixing that eror and making my program work?
PS: After the error it doesen't allow me to save changes - the error occurs when I edit some fields and i try to move to the next record (that's the way it saves modifications). It only let's me create new records and edit the key field.
|
|
|
|
|
Hmmm, it's been a while since I've done anything with ODBC in MFC, but I do remember a few things. First, MFC internally composes the SQL commands to do your inserts, updates, and deletes. Use the debugger to do some more digging into the MFC code, until you get to the part where the command is fully composed and ready to be executed. Then grab it, open up the MSQuery tool, and try to execute it there. In theory you should get the same error message, which would probably indicate a driver issue.
Search for "Query is too complex" in MSDN and you may get some feedback.
Good luck,
Alvaro
|
|
|
|
|
Thanks for the reply, I found a fix, and I do think that the error was because of some Win98 specific code. In the MSDN you can't find any information on that error - I found it in some header file - with no explanation on when it occures and why. The fix was simple - I changed the parameter in the recordset's class from snapshot to dynaset and it started working. Under W2K it works fine, but in win9x it works as a read-only method.
Cheers,
Deian
|
|
|
|
|
I've got a problem while debugging a programm. When exiting the program in debug mode, i've got memory leaks and i would like to analyse them in order to free objects which are not deleted. The code is a bit long and verifying all code would be impossible. Is there a tool I could use? or a method to applicate?
Thanx for your response and excuse me for the errors in text, i'm french...
|
|
|
|
|
* the easiest way to analyze memory leaks would be to use numegas bound's checker (http://www.microway.com.au/compuware/products.stm)but this is a product you have to buy.. but it should be very good and it reports both memory and resource leaks..
* there is the mfc way to detect memory leaks.. if you are very lucky you can double click on your memory leaks and then the devstudio shows you the code, where the memory got allocated (works sometimes for me.. but i actually dunno when, maybe the objects have to be derived from cobject or whatever)
another way (happened in one of my coworker's programs) the program crashed when the program got closed (it was an invalid timer - handle he wanted to delete) and the result was that noone of the destructors ever got called.. (it is pretty simple to check that case.. if you are using cstring.. and the dump tells you that there occured memory leaks in strcore.h then this is most likely)
if you want to know if one of your methods is leaking memory you can use the CMemoryState Class...
i hope one of your ideas can help you..
bernhard
excuse my bad english, i'm austrian...
""Politicians and diapers have one thing in common. They should both be changed regularly and for the same reason."
|
|
|
|
|
I've used BoundsChecker a few times over the past several years and it's helped me very little. Often times it's just plain annoying in the amount of "who cares" stuff it reports. Other times it's just too slow to wait for. Still, a lot of people seem to like it, especially for finding GDI resource leaks, so...
The MFC way is pretty reliable for memory leaks. All you need is this at the top of every CPP file, after the includes:
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
... and you'll get the name of the source files in the memory dump at the end of the program. Then you can double click on the file and you'll see who's allocating memory that doesn't get freed. Concentrate on fixing the ones in your own code, of course.
Regards,
Alvaro
Oh, and please excuse my bad English, I'm American
|
|
|
|
|
If you find that the dumped memory leaks can't be located by double-clicking, you can also try a method described in MSDN. The article is called:
HOWTO: Use _crtBreakAlloc to Debug a Memory Allocation
Basically, you use the numbers shown next to the memory leak dumps, set a variable in the debugger, and the program will break when the leaking memory is allocated. Handy.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
i have to admit that i never used BoundsChecker.. cause.. i haven't felt a real urge to use it.. the mfc way worked pretty well for me all the time.. (the thingie you wrote with the double click.. i never found that out..)
but now my question: is there a handy way to find resource leaks in a mfc program ?
(seems to be an advantage of using boundschecker..)
have a good one
bernhard
oh.. and yaya.. you know the game..
""Politicians and diapers have one thing in common. They should both be changed regularly and for the same reason."
|
|
|
|