|
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!
|
|
|
|
|
I been working with MFC for while and there is something I always wondered
when I create controls dynamic for ex.
CEdit *pEdit = new CEdit;
pEdit->Create( WS_CHILD | WS_VISIBLE , rcEditRect , this , nID );
Then i always need to give the control an ID ( nID )
What is this for ?? Can I use any number here as long as it have not been used before ?
what if 2 controllers get the same ID what could happened ?
I never had any problems with it yet. I always use nID++ before creating the next controller. but it been bugging me that I didn't really understand the purpose of the nID
I been suspecting that it is used when finding items when i use
GetDlgItem .. But is that all it is used for ??
/Mathias
|
|
|
|
|
The ID is defined in resource.h with lines like this:
#define IDD_ACTION 1012
where IDD_ACTION is the name you gave your control when you created it in the dialog editor. When you create your own ID's it is imperative that no two controls on the one dialog have the same ID because a dialog recieves messages like WM_DRAWITEM, which specify the control that sent the message by specifying the ID.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I want create DLL that gives a dialog box.
I create dll with the classWizard(dll), I added Dialog to the resource
and class CMyDialod for it.
Now mukkie discussed me to add to the header file of CMyDialog So:
-----------------------------------------------------------------
#ifdef DLL_BUILDING
#define DllExportImport __declspec(dllexport)
#else
#define DllExportImport __declspec(dllimport)
#endif
class DLLExportImport CMyDialog : public CDialog
------------------------------------------------------------------
I made it but it's performs me the below errors :
----------------------------------------------------------------
Dlg1.cpp
C:\Windows\Desktop\dll1\Dlg1.cpp(19) : warning C4273: 'CDlg1::CDlg1' : inconsistent dll linkage. dllexport assumed.
C:\Windows\Desktop\dll1\Dlg1.cpp(28) : warning C4273: 'DoDataExchange' : inconsistent dll linkage. dllexport assumed.
C:\Windows\Desktop\dll1\Dlg1.cpp(36) : warning C4273: '_GetBaseMessageMap' : inconsistent dll linkage. dllexport assumed.
C:\Windows\Desktop\dll1\Dlg1.cpp(36) : warning C4273: 'GetMessageMap' : inconsistent dll linkage. dllexport assumed.
C:\Windows\Desktop\dll1\Dlg1.cpp(36) : warning C4273: 'protected: static struct AFX_MSGMAP const CDlg1::messageMap' : inconsistent dll linkage. dllexport assumed.
C:\Windows\Desktop\dll1\Dlg1.cpp(36) : error C2491: 'CDlg1::messageMap' : definition of dllimport static data member not allowed
C:\Windows\Desktop\dll1\Dlg1.cpp(36) : warning C4273: 'private: static struct AFX_MSGMAP_ENTRY const * const CDlg1::_messageEntries' : inconsistent dll linkage. dllexport assumed.
C:\Windows\Desktop\dll1\Dlg1.cpp(36) : error C2491: 'CDlg1::_messageEntries' : definition of dllimport static data member not allowed
Generating Code...
Error executing cl.exe.
dll1.dll - 2 error(s), 6 warning(s)
--------------------------------------
Why ??????
|
|
|
|
|
|
I tried now to delete all the additions that I made ,
So I have in my dll project only regular dialog and his simple class(-CDlg1).
And I added function in the dll1.cpp so:
----------------------------------------------
extern "C" __declspec(dllexport) long CallDlg()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CDlg1 dlg;
dlg.DoModal();
return 0;
}
--------------------------------------------
Now I get the errors
--------------------Configuration: dll1 - Win32 Debug--------------------
Compiling...
dll1.cpp
C:\Windows\Desktop\dll1\dll1.cpp(58) : error C2146: syntax error : missing ';' before identifier 'code'
C:\Windows\Desktop\dll1\dll1.cpp(58) : error C2501: 'My' : missing storage-class or type specifiers
C:\Windows\Desktop\dll1\dll1.cpp(58) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
dll1.dll - 3 error(s), 0 warning(s)
__________________________________
What can I to do ???
|
|
|
|
|
the erros is so:
--------------------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)
|
|
|
|
|
Did you define DLL_BUILDING in your pre-processor settings?
Michael
|
|
|
|
|
|
I gets the errors:
--------------------Configuration: dll1 - Win32 Debug--------------------
Compiling...
dll1.cpp
Generating Code...
Compiling...
Dlg1.cpp
C:\Windows\Desktop\dll1\Dlg1.cpp(19) : warning C4273: 'CDlg1::CDlg1' : inconsistent dll linkage. dllexport assumed.
C:\Windows\Desktop\dll1\Dlg1.cpp(28) : warning C4273: 'DoDataExchange' : inconsistent dll linkage. dllexport assumed.
C:\Windows\Desktop\dll1\Dlg1.cpp(36) : warning C4273: '_GetBaseMessageMap' : inconsistent dll linkage. dllexport assumed.
C:\Windows\Desktop\dll1\Dlg1.cpp(36) : warning C4273: 'GetMessageMap' : inconsistent dll linkage. dllexport assumed.
C:\Windows\Desktop\dll1\Dlg1.cpp(36) : warning C4273: 'protected: static struct AFX_MSGMAP const CDlg1::messageMap' : inconsistent dll linkage. dllexport assumed.
C:\Windows\Desktop\dll1\Dlg1.cpp(36) : error C2491: 'CDlg1::messageMap' : definition of dllimport static data member not allowed
C:\Windows\Desktop\dll1\Dlg1.cpp(36) : warning C4273: 'private: static struct AFX_MSGMAP_ENTRY const * const CDlg1::_messageEntries' : inconsistent dll linkage. dllexport assumed.
C:\Windows\Desktop\dll1\Dlg1.cpp(36) : error C2491: 'CDlg1::_messageEntries' : definition of dllimport static data member not allowed
Generating Code...
Error executing cl.exe.
dll1.dll - 2 error(s), 6 warning(s)
|
|
|
|
|
classes are not exported from DLL's like this.
try
class AFX_EXT_CLASS CMyDialog:public CDialog
then the lib of this dll goes into ur project and the .H file of the dialog too. then try using the object.
|
|
|
|
|
|
Give me Your email address, (You can send me via email - TeamMukippe@wp.pl / TeamMukippe@poland.com ) and I'll send You sources of working project (exe-dll pair)
|
|
|
|
|
Hi ,
As I am new to WEB, can some one tell me how can I write
an ActiveX to call a Javascript/VBScript function in HTML
in MSIE .
Thanks and Regards,
SanskyPotov
|
|
|
|
|
Hello!!
Can anybody tell me how can I discharge a Battery quickly on a LapTop... Can a graohics application with complex calculations discharge a battery or can playing a Video CD help in discharging the battery at a quick rate..
Please advise..
Sandeep
|
|
|
|
|
I would go for the vidio CD. The CD drive uses a lot of power, and the vidio uses a lot of processor, and then power...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I want to save a mediaplayer(ActiveX control)Frame into a bitmap file.
How can I do that?
Windows98 SE, VC++ 6.0 SP5
|
|
|
|
|
Hi.
I think You most Use Screan's Bits.(Read Color of Dialog's Pixel)
Iman Ghasr-e-fakhri
|
|
|
|
|
I suspect you'll find grabbing a screen DC won't do it, because I know I've tried in an attempt to capture web movies, to no avail.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
One efficient way to do this (I'm sorry I shouldn't use the word "effcient" because it carries out endless debates ).
One way to do this is through a custom based COM filter using DirectShow (now completely integrated in DirectX 8.x). If you are planning to use this as a one time tool, you could avoid the code involved in plugging the filter into the GraphFilter of DirectShow and use the GraphEditor instead.
The filter needs to get a stream input of the sample video in order to create the file that you want (i.e. bitmap). For instance,
//
// Copy the input sample into the output sample
// Then transform the output sample 'in place'
//
HRESULT MyFilter::Transform(IMediaSample *pIn, IMediaSample *pOut)
{
HRESULT hr = Copy(pIn, pOut);
if (FAILED(hr)) {
return hr;
}
return Transform(pOut);
} // Transform
//
// Create a bitmap from source and let dest be identical
// in order to continue the process (playing).
//
HRESULT MyFilter::Copy(IMediaSample *pSource, IMediaSample *pDest) const
{
...
}
There is much more work involved in developing a DirectShow filter. I hope this help you out.
|
|
|
|
|
I installed .Net,and I found the component writed with VB was correct while debug step by step,then I make the dll.But it does not work correct.(In one method of this component ,I called one function of another dll just for unzip files.)
If this is caused by .net?
sandos
|
|
|
|
|
How can inform a ActiveX control move it's input focus to other control when a events occur? i use the fellow function :
SendMessage(WM_KEYDOWN,VK_TAB,0);
but it doesn't act
|
|
|
|
|
Try call keyb_event(...) with tab key code.
|
|
|
|