|
To find system's drives try GetLogicalDrives, it returns a bitmask with all the drives available.
Use GetDriveType or GetVolumeInformation for extended information about the selected drive
Hope it helps!
ORi
|
|
|
|
|
> To find system's drives try GetLogicalDrives,
> it returns a bitmask with all the drives available.
For Windows < NT5 (aka W2k) it was true. Not so anymore I'm afraid.
For >= W2k you'll have to iterate volumes by using FindFirstVolume/FindNextVolume.
If you however are only interested in the drive-letter assigned volumes, this solution works.
|
|
|
|
|
Can anyone help me in my school project?I'm a beginner at microsoft visual c++ any need help in doing a program.I would appreciate it if anyone is willing to help me doing it.Thanks alot!
|
|
|
|
|
Oh, a homework assignment!
You should know we don't answer questions like this one usually.
But you can post some piece of code where you get stuck, then we can help you
regards
|
|
|
|
|
1. open dll proj with classWizardMFC(dll) - type MFCExtension DLL.
2. add to resources Dialog
3. add new class for this dialog
4. write function with DoModal for the dialog , so:
--------------------------------------------------
extern "C" __declspec(dllexport) long CallDlg()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CDlg1 dlg;
dlg.DoModal();
return 0;
}
-------------------------------------------------
5. It is not works ! Why ??????
below is the errors that I gets:
--------------------Configuration: dll1 - Win32 Debug--------------------
Compiling...
dll1.cpp
Linking...
mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in dll1.obj
mfcs42d.lib(dllmodul.obj) : error LNK2005: __pRawDllMain already defined in dll1.obj
mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in dll1.obj; second definition ignored
mfcs42d.lib(dllmodul.obj) : warning LNK4006: __pRawDllMain already defined in dll1.obj; second definition ignored
Creating library Debug/dll1.lib and object Debug/dll1.exp
Debug/dll1.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
dll1.dll - 3 error(s), 2 warning(s)
|
|
|
|
|
remove the AFX_MANAGE_STATE(AfxGetStaticModuleState()); line, you don't need it in an extension dll. It's only needed in regular mfc dlls
|
|
|
|
|
hi
i have class derived from CHeaderCtrl with own virtual DrawItem but it is never called
it is another class member and is created by .Create() call
(no problem with WM_ handlers)
what can be wrong?
t!
|
|
|
|
|
Are you sure you're using HDF_OWNERDRAW flag in HDITEM passed to CHeaderCtrl::InsertItem?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
i afraid i'm using
HDITEM hdi;
hdi.mask = HDI_TEXT | HDI_WIDTH | HDI_FORMAT;
hdi.fmt = HDF_STRING | HDF_LEFT | HDF_OWNERDRAW;
t!
|
|
|
|
|
You've mentioned in the first post that there's 'no problem with WM_ handlers'.
Does this mean that parent window gets WM_DRAWITEM as expected and the only problem is with forwarding to virtual DrawItem method in header?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
parent has to deal something with?
i thought it goes to myhdrctrl::onpaint or onsize and similars
t!
|
|
|
|
|
parent has to deal something with?
Yes, but MFC does this for you automatically. Can you use Spy++ and check if parent gets WM_DRAWITEM?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
yes parent gets wm_drawitem with header ctrl id (fprocessed: false)
t!
|
|
|
|
|
|
sorry but _is_ virtual
afxcmn.h
class CHeaderCtrl : public CWnd
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
t!
|
|
|
|
|
sorry but _is_ virtual
You're right, it is virtual. But it doesn't buy you anything. You still need ON_WM_DRAWITEM_REFLECT.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
wm_drawintem_reflect? where to find it?
i tried wm_drawintem but is not called too
t!
|
|
|
|
|
No, there's no message named WM_DRAWITEM_REFLECT. You need a macro in the message map.
BEGIN_MESSAGE_MAP(CYourHeader, CHeaderCtrl)
ON_WM_DRAWITEM_REFLECT()
END_MESSAGE_MAP()
This will connect your DrawItem method into MFC message handling mechanism. Parent window will call CYourHeader::DrawItem when handling WM_DRAWITEM.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
nothing
i tried
afx_msg void DrawItem ( LPDRAWITEMSTRUCT lpDrawItemStruct );
into hdr.h too - the same
when i look to examples i have (tree-list-ctrls on cp) there is my version only, i see nothing like this
t!
|
|
|
|
|
Another idea: put the breakpoint in CHeaderCtrl::OnChildNotify. Does the program stop there?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
|
This is strange. I've checked the MFC sources. Here's how is expected to work:
1) parent window receives WM_DRAWITEM message - this is done by Windows itself, no MFC needed at this point
2) message map in CWnd class has a handler for this message. Default implementation is in CWnd::OnDrawItem
3) CWnd::OnDrawItem checks if message applies to menu or child window. If child window needs to be owner-drawn, it will be notified. Notification is performed by calling virtual CWnd::OnChildNotify. CHeaderCtrl and other classes override this function.
4) CHeaderCtrl::OnChildNotify explicitly checks for WM_DRAWITEM. If this is the case, it calls virtual CHeaderCtrl::DrawItem. Default implementation just contains ASSERT(FALSE), so you should at least have an assert (assuming some problems with overriding DrawItem).
5) overriden CYourHeader::DrawItem does the job.
If CHeaderCtrl::OnChildNotify is not called, the next suspect is WM_DRAWITEM handler in parent class. Do you explicitly handle WM_DRAWITEM in the parent window?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
parent is commnon static control created into dialog editor (property page)
no own class subclassed to it
CStatic *pStatic = (CStatic*)((CPropertyPage*)wnd)->GetDlgItem(ID_STATIC);
m_Header.Create(WS_CHILD | WS_VISIBLE | WS_DISABLED | HDS_HORZ, headerRect, pStatic, 12345 /* id */);
t!
|
|
|
|
|
OK - I can see what's going wrong. The parent isn't subclassed by MFC. When static window receives WM_DRAWITEM, the message goes to DefWindowProc, not to CWnd::OnDrawItem.
The 'pStatic' pointer you're getting via GetDlgItem points to a temporary object, which is destroyed by MFC during idle processing.
You need member CStatic variable associated - change the id from IDC_STATIC to something else, IDC_HDR_PARENT and use ClassWizard to add a member control variable.
Optionally, add m_static manually to CYourDlg and call m_static.SubclassDlgItem(IDC_HDR_PARENT, this) in CYourDlg::OnInitDialog.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
really, parent was whole problem
thanks very much
t!
|
|
|
|