|
Actually, I have found an easier way. All I have to do is override the DefWindowProc for my window and filter out the messages which I wish to forward:-
LRESULT CMyWnd::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_KEYUP:
case WM_KEYDOWN:
case WM_SYSKEYUP:
case WM_SYSKEYDOWN:
::SendMessage(m_hWndTarget, message, wParam, lParam);
break;
}
return CWnd::DefWindowProc(message, wParam, lParam);
}
James Spibey
|
|
|
|
|
Maybe you can use CWnd::GetCurrentMessage() and use the returned MSG structure.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
In my program i use a CListCtrl..
Selecting multiple Items.. everything is ok..
but after processing the selection i would like to destroy the selection the user made..
visually it is simple, using SetSelectionMark(-1)...
but msdn says:
"This macro does not affect the selection state of the item"
and this is the problem.. the user clicks "process" once again.. and the same selection gets processed... but i want to delete the section..
the only solution i found would be setting the "ItemState" to NonSelected.. but i had to do this for the whole selection..
is there any other / easier way??
thanks in advance
bernhard
stolen sig#19:
"Just looking for loopholes." W. C. Fields [American actor, 1880-1946, explaining why he was reading the Bible on his deathbed.]
|
|
|
|
|
Well if you are doing the processing in a loop then you could just set the ItemState to Nonselected as soon as you are done processing that item and then when all processing is done set the selection mark to -1.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
ListView_SetItemState ( hwndYourList, -1, LVIS_SELECTED, 0 );
turns off the selected state for all items in the list.
--Mike--
http://home.inreach.com/mdunn/
"Listen you footwarriors, can you hold down a bit with the firing? I've just got three impromptu weddings breaking out behind me!" -- Arthur Dent
your with and
|
|
|
|
|
How can i create setup foe win ce application?
Kumar Saurabh
Software Engneer
Syndew Pvt Ltd
New Delhi
India
|
|
|
|
|
Is it possible to change screen resolution which is not supported by the device driver(for eg. 700x400) by calling IDirectDraw::setdisplaymode?
I want to call this api as setdisplaymode(700,400,16)or
setdisplaymode(200,400,8)
|
|
|
|
|
No, no, no. Look up EnumDisplayModes - they are ALL you can set it to, the ones the card supports.
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 need to create a dll component that shows dialog form that performs some things.
This component have to match to work in client program of Delphi.
So Which type of dll I need create for it ? (ATL/ ACTIVE X or another )
-----------------------------------------------------------------------
I maked it as MFC Extention DLL but it works only in client program of VC (not in Delphi !)
------------------------------------------------------------------------
Please help ! It is very urgent !!!
|
|
|
|
|
I maked it as MFC Extention DLL but it works only in client program of VC (not in Delphi !)
extension dll's work just in mfc... so you can't use em in delphi, visual basic or whatever..
i am not expert.. but if you want to use the component everywhere you have to use
ActiveX or COM..
to decrease size of the component it is better if you implement it using ATL and not MFC... that makes the whole dll smaller and you don't have to link with the MFC (static or dynamic linking)...
if you need tutorials building a component see the sections in codeproject...
hope this helps a little bit
bernhard
stolen sig #18
"Pseudocode is code to demonstrate a concept, not designed to be run. Like certain Microsoft software. "
|
|
|
|
|
Thank you.
So you suggest me to use in ATL.
But I understood that there are problem in ATL if I want to use in class CDialog of MFC and I need use Dialog form as basis to my implementation.
What do you say about it ?
|
|
|
|
|
You can use a dialog resource to make an ATL dialog, but you won't use any MFC classes, like CDialog. There are ATL equivalents of these. In the ATL object wizrd thingy, under the miscellaneous tab, there is a "dialog" option. Chose that. You'll have an ATL dialog. The resulting dialog is NOT a COM object yet, though. Go back into the new object wizrd thingy, and select new Simple object, and make a COM object that contains an instance of the dialog class as a member, and expose functionality of the dialog through the COM objects interface. Then you can use the dialog in VB, or wherever COM objects may be used.
|
|
|
|
|
|
or you can use WTL (Windows Template Library) for your dialogs
|
|
|
|
|
Manny Thanks !
IN ATL :
Can I insert dialog by Go to Insert ATL Object, Select Category - Miscellaneous and double click on Dialog.
Which is option better ? (ATL or WTL) and why ?
Remmember : I need it for another language (Delphi) !
|
|
|
|
|
HO !! I'm in troubles
I try to add to ATL project dialog in two ways and there are problems
If I add a sinple dialog in resources as Aron suggest and I create class for the dialog I gets errors because it is base :MFC CDialog
If I Insert ATL Object, Select Category - Miscellaneous - Dialog.
I see that the code that I gets from the wizard is very strange and I dont know how to add my methods to that class.
|
|
|
|
|
MFC can be used in ATL projects. I don't tend to use it now but it can be used. So if you want to try the MFC route, post the errors and related code and we'll see if we can't help you out.
If you want to go the straight ATL route, there is a bit of a learning curve from MFC because the code is slightly different to MFC classes. What methods are you trying to add to your class?
Michael
|
|
|
|
|
The errors that I gets if I trys to add class from base CDialog for my dialog resource are:
c:\windows\שולחן עבודה\222\dlg.h(14) : error C2504: 'CDialog' : base class undefined
c:\windows\שולחן עבודה\222\dlg.h(17) : error C2629: unexpected 'class Dlg ('
c:\windows\שולחן עבודה\222\dlg.h(17) : error C2238: unexpected token(s) preceding ';'
c:\windows\שולחן עבודה\222\dlg.h(21) : error C2065: 'IDD_DIALOG1' : undeclared identifier
c:\windows\שולחן עבודה\222\dlg.h(21) : error C2057: expected constant expression
c:\windows\שולחן עבודה\222\dlg.h(30) : error C2061: syntax error : identifier 'CDataExchange'
c:\windows\שולחן עבודה\222\dlg.h(41) : error C2143: syntax error : missing ';' before '}'
C:\WINDOWS\שולחן עבודה\222\Dlg.cpp(18) : error C2065: 'CWnd' : undeclared identifier
C:\WINDOWS\שולחן עבודה\222\Dlg.cpp(18) : error C2065: 'pParent' : undeclared identifier
C:\WINDOWS\שולחן עבודה\222\Dlg.cpp(19) : error C2448: '<unknown>' : function-style initializer appears to be a function definition
C:\WINDOWS\שולחן עבודה\222\Dlg.cpp(19) : error C2143: syntax error : missing ';' before ':'
C:\WINDOWS\שולחן עבודה\222\Dlg.cpp(20) : error C2448: '<unknown>' : function-style initializer appears to be a function definition
C:\WINDOWS\שולחן עבודה\222\Dlg.cpp(27) : error C2065: 'CDataExchange' : undeclared identifier
C:\WINDOWS\שולחן עבודה\222\Dlg.cpp(27) : error C2065: 'pDX' : undeclared identifier
C:\WINDOWS\שולחן עבודה\222\Dlg.cpp(28) : error C2448: '<unknown>' : function-style initializer appears to be a function definition
C:\WINDOWS\שולחן עבודה\222\Dlg.cpp(36) : error C2061: syntax error : identifier 'CDialog'
C:\WINDOWS\שולחן עבודה\222\Dlg.cpp(40) : error C2146: syntax error : missing ';' before identifier 'END_MESSAGE_MAP'
C:\WINDOWS\שולחן עבודה\222\Dlg.cpp(40) : fatal error C1004: unexpected end of file found
Generating Code...
Error executing cl.exe.
222.dll - 18 error(s), 0 warning(s)
_____________________________________________________
I anderstand that the normal way in my case is to use
the straight ATL route.
I need add manny code to this class , mainly to the methods OnOK and OnDestoy.
Can I use simple code that I use in MFC ?
|
|
|
|
|
Hi,
Inside of the constructor of an object, I want to specify a callback routine which belongs to the same object (member function). How can I do this
If my callback routine is static everything's ok, but I need a different callback routine for every object.
I read something about wrappers which should work fine if I could write the code for the caller, but I can't because it's an OpenGL function:
glutDisplayFunc (pointerToMyMemberFunction);
In the above line (which I want to use in my object's constructor) I tell OpenGL which function it has to call when the time has come to refresh the screen.
I could do something non-object-oriented with an array of function-pointers, but that's not nice
Can anyone help me??
|
|
|
|
|
See the VC forum FAQ.
--Mike--
http://home.inreach.com/mdunn/
"Listen you footwarriors, can you hold down a bit with the firing? I've just got three impromptu weddings breaking out behind me!" -- Arthur Dent
your with and
|
|
|
|
|
I had a look but it says there:
"Windows APIs that use a callback function have a void* parameter that you can use for whatever purpose you like"
The problem is that
glutDisplayFunc (pointerToAFunction);
is not a window API !!!
So there's no possibility to pass two arguments like
glutDisplayFunc (pointerToAFunction,(void*) this );
Any other suggestion
|
|
|
|
|
Doing stuff like this within a constructor is error prone, since the object is not fully constructed until the constructor returns. You might want to have a separate init() method that properly initializes the object.
This requires that a user of your object ALWAYS call init() after constructing it. To ensure this, you should have a static method that serves up properly initialized objects, and make the default constructor protected. For example:
CMyObject* pObject = CMyObject::newInstance();
ASSERT (pObject != NULL);
ASSERT (pObject->isValid()); /ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi
I am invoking dialogbox from applications InitInstance(). Can I handle IDOK button message of dialog from document object?. Can you help if you can handle..
Thank you
Srinivasa Raju Bhairraju
Member - Technical
Cysphere.com Pvt Ltd
Ashoka Bhopal Chambers
S.P.Road
Secunderabad - 3
Email: sraju@cysphere.com
|
|
|
|
|
If the dialog box is modeless, then you can catch WM_COMMAND. If it's modal, then obviously you don't have a hope in hell.
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 had written a dialog based application.
It contained a button named "Try"
When I clicked the "Try" button,opened an other
dialog named "Test" which contained a button named "Open".
When I first clicked "Open" button and clicked the "OK"
button in Open File Dialog,everything is ok,and then
close the "Test" Dialog.
But When I click "Try" button again,it showed me wrong.
Who can please tell me what's wrong with my code??
******************************************************************
void CFirstDlg::OnButtonTry()
{
// TODO: Add your control notification handler code here
CTestDialog* dlg;
dlg=new CTestDialog;
dlg->DoModal();
}
******************************************************************
BOOL CTestDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CString sCon;
_ConnectionPtr m_pCon;
_RecordsetPtr m_pRs;
sCon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=main.mdb";
CoInitialize (NULL);
HRESULT hr=S_OK;
try
{
hr=m_pCon.CreateInstance(__uuidof(Connection));
if(FAILED(m_pCon->Open(_bstr_t(sCon),"","",adModeUnknown)))
AfxMessageBox("Can not open the database!");
}
catch(_com_error e)
{
CString errormessage;
errormessage.Format("Failed!\r\nError Message:%s",e.ErrorMessage());
AfxMessageBox(errormessage);
}
m_pRs.CreateInstance("ADODB.Recordset");
if(FAILED(m_pRs->Open("SELECT * FROM employeer",_variant_t((IDispatch*)m_pCon,true),adOpenStatic,adLockOptimistic,adCmdText)))
AfxMessageBox("Can not open the record set!");
if((m_pRs->State & adStateOpen) == adStateOpen)
m_pRs->Close();
if ( (m_pCon->State & adStateOpen) == adStateOpen)
m_pCon->Close();
CoUninitialize();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
***********************************************************************
void CTestDialog::OnButtonOpen()
{
// TODO: Add your control notification handler code here
static char BASED_CODE szFilter[]="Bitmap Files (*.bmp)|*.bmp||";
CFileDialog *fd;
fd=new CFileDialog(TRUE,NULL,NULL,OFN_HIDEREADONLY,szFilter,this);
if(IDOK!=fd->DoModal())
return;
else
AfxMessageBox(fd->GetFileName());
delete fd;
}
|
|
|
|