|
Hi.
How can I Extract .EXE(or DLL) file's Icons & other Resources.in Runtime and without other applications
Iman Ghasr-e-fakhri
|
|
|
|
|
With the samples that come with VC6.0 there is a sample application called IconPro which shows how to extract icons from exe and dll files. To use this to get other resources requires searching for example RT_BITMAP (for bitmaps) instead of RT_ICON.
The main functions to extract the resources are
FindResource
LoadResource
LockResource
FreeResource
Hope this helps
|
|
|
|
|
Hi.
How can I Find System's Drives And Drives Type with Windows API(s)
Iman Ghasr-e-fakhri
|
|
|
|
|
Hi,
Use GetDriveType(). Don't know how to enumerate, though.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
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
|
|
|
|
|