|
Hi,
I'm creating an ActiveX control to be embedded into a web page. This control contains a child dialog with a number of controls in it. The problem is that certain key presses are not received by this child dialog, specifically, TAB, cursor keys and (importantly) Backspace.
I understand that certain key presses such as TAB and cursor keys require PreTranslateMessage to be overridden in the COleControl derived class. I have done this.
I also know that I should be calling LockInPlaceActive on the control when it is activated so that I can capture these WM_KEYDOWN messages, but when I debug this control when it is embedded into a web page (and viewed in Internet Explorer), LockInPlaceActive always returns FALSE.
Does Internet Explorer disallow in place active? Is there any way that pressing Backspace in a child Edit control of the ActiveX control will actually edit the text rather than returning to the previous web page?
Thanks in advance.
Derek Waters
|
|
|
|
|
You need to implement IInputObject to receive those keystrokes. Search for IInputObject in MSDN - I know I've come across at least one article that describes how to do what you want.
--Mike--
http://home.inreach.com/mdunn/
"Holding the away team at bay with a non-functioning phaser was an act of unmitigated gall. I admire gall."
-- Lt. Cmdr. Worf
|
|
|
|
|
Thanks Michael,
I actually found that Knowledge Base article "Q168777 - PRB: MFC ActiveX Control in IE Doesn't Detect Keystrokes" helped (with a bit of fiddling).
Derek.
|
|
|
|
|
Hello All
I use ClassWizard to generate a class derived from COleDispatchDriver to warp around a COM object, but the
method that get generated say "method 'SessionOpened' not emitted because of invalid return type or parameter type"
anyone has any idea why??
psksvp/
========================
class INoteAcceptorEvents : public COleDispatchDriver
{
public:
INoteAcceptorEvents() {} // Calls COleDispatchDriver default constructor
INoteAcceptorEvents(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
INoteAcceptorEvents(const INoteAcceptorEvents& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
// method 'SessionOpened' not emitted because of invalid return type or parameter type
// method 'SessionClosed' not emitted because of invalid return type or parameter type
// method 'UnableToOpenSession' not emitted because of invalid return type or parameter type
// method 'LockGranted' not emitted because of invalid return type or parameter type
// method 'LockTimeOut' not emitted because of invalid return type or parameter type
// method 'LockReleased' not emitted because of invalid return type or parameter type
// method 'AvailabilityChanged' not emitted because of invalid return type or parameter type
// method 'XFSErrorEvent' not emitted because of invalid return type or parameter type
// method 'BanknotesEncashed' not emitted because of invalid return type or parameter type
// method 'BanknoteProcessingComplete' not emitted because of invalid return type or parameter type
// method 'BanknotesRefunded' not emitted because of invalid return type or parameter type
// method 'BankNotesInRefundSlotError' not emitted because of invalid return type or parameter type
// method 'BanknotesRejected' not emitted because of invalid return type or parameter type
// method 'BanknotesTaken' not emitted because of invalid return type or parameter type
// method 'Enabled' not emitted because of invalid return type or parameter type
// method 'EscrowFull' not emitted because of invalid return type or parameter type
// method 'NoBanknotesEntered' not emitted because of invalid return type or parameter type
// method 'UnableToEnable' not emitted because of invalid return type or parameter type
// method 'UnableToEncash' not emitted because of invalid return type or parameter type
// method 'UnableToRefund' not emitted because of invalid return type or parameter type
// method 'BanknotesInserted' not emitted because of invalid return type or parameter type
// method 'UnableToClear' not emitted because of invalid return type or parameter type
// method 'Cleared' not emitted because of invalid return type or parameter type
// method 'BanknotesWithdrawn' not emitted because of invalid return type or parameter type
// method 'BNAExceptionEvent' not emitted because of invalid return type or parameter type
};
|
|
|
|
|
Are the intefaces of the COM object using oleautomation compatible types ? It could be that you are trying to make a wrapper object for a COM object with a custom (c++) interface by using COleDispatchDriver.
-Nick-
|
|
|
|
|
I'm VERY new to vc++. I am attempting to use DAO's findfirst function. All works OK unless there is an apostophe in the query string (for example "Joe's Place").
Code sample:
m_pMySet->FindFirst("[Favorite Bars] = 'Joe's Place'");
Will not work, but
m_pMySet->FindFirst("[Favorite Bars] = 'Joes Place'");
will.
Any help appreciated
Richard
|
|
|
|
|
Hi!
Try doubling up on apostrophes within the string you're looking for... e.g.:
m_pMySet->FindFirst ("[Favourite Bars] = 'Joe''s Place'");
this is how SQL Server treats them, anyway
nb
|
|
|
|
|
Thans Nick,
I'll give it a try!
Richard
|
|
|
|
|
Hi,
In this example Favorite Bars is field name ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi,
Yes Favourite Bars is a field name. FindFirst works OK until a key is passed that contains an apostrophe (Joe's Place, for example). I've tried everything I know to work around this (which isn't much).
All ideas appreciated!
Richard
|
|
|
|
|
How can I
type cast a CString to a LPTSTR
to avoid this error:
'type cast' : cannot convert from 'char *(__thiscall CString::*)(int)' to 'char *'
|
|
|
|
|
Try CString::GetBuffer.;)
Oscar L.
|
|
|
|
|
I did but I get a type cast error too.
|
|
|
|
|
Code problem:
This is the structure of rvi:
typedef struct _RVITEM
{
UINT nMask;
INT iItem;
INT iSubItem;
LPTSTR lpszText;
INT iTextMax;
INT iTextColor;
INT iImage;
INT iCheck;
INT iBkColor;
UINT nPreview;
INT iIndent;
UINT nState;
LPARAM lParam;
INT iOverlay;
_RVITEM() : nMask(0), iItem(RVI_INVALID), iSubItem(-1), lpszText(NULL), iTextMax(0), iTextColor(-1), iImage(-1), iCheck(-1), iBkColor(-1), nPreview(0), iIndent(-1), nState(0), lParam(0), iOverlay(0) {};
} RVITEM, FAR* LPRVITEM;
CString strDato;
//The followin returns a CString: pBdeDb->GetFieldAsString(1,&bIsBlank);
strDato = pBdeDb->GetFieldAsString(1,&bIsBlank);
//strncpy(strDato, Dato, strDato.GetLength());
rvi.iSubItem = 0;
rvi.lpszText = strDato.GetBuffer;//<--------------Problem---------
rc.SetItem(&rvi);
|
|
|
|
|
Sorry. Use -> strDato.GetBuffer(0);
But, remember that this buffer is temporary if strDato is local variable.!! To avoid this, create a buffer :
rvi.lpszText = new char[strDato.GetLength()];
strcpy(rvi.lpszText, strDato);
Oscar L.
|
|
|
|
|
Thank you very much.
|
|
|
|
|
Te aconsejo usar strcpy(rvi.lpszText, strDato.GetBuffer(0));
Cheers!!!
Carlos Antollini.
|
|
|
|
|
Ese tambien funciona. La diferencia esta en que la primera devuelve un LPCTSTR (que es constante y es menos peligrosa) y la segunda devuelve un LPTSTR que se puede modificar directamente.
Si deseas poder usar cast:
strcpy(rvi.lpszText, (LPCTSTR) strDato);
Oscar L.
|
|
|
|
|
Abusando de tu amabilidad:
Podrias enseñarme como convierto de:
double a LPTSTR.
BOOL PTSTR.
COleDateTime a LPTSTR.
Long a LPTSTR.
int a LPTSTR.
|
|
|
|
|
Jose!
Dale un vistazo a la documentación de CString::Format con la cual podes realizar las conversiones tipo sprintf.
De igual forma COleDateTime tambien tiene el método COleDataTime::Format.
Oscar L.
|
|
|
|
|
y que tal de int, long y BOOL a LPTSTR
|
|
|
|
|
Gracias.
Podrias echarme la mno con mi otra pregunta.
de como convertir de los otros diferentes tipos de datos a LPTSTR
|
|
|
|
|
Usa wsprintf.
LPTSTR str = NULL;
int n = 1000;
malloc((LPTSTR)str, 256); //or the size that you want
wsprintf(str, "%d", n); //int -> LPTSTR
Check the documentatión about wsprintf for other types.
Carlos Antollini.
|
|
|
|
|
También tenes las funciones itoa() y ltoa() para convertir the int y long a Ascii
luego lo convertis a LPCTSTR.
El booleano es sencillo.
BOOL bVAl = TRUE;
LPTSTR str = bVal ? "TRUE": "FALSE";
Saludos
Carlos Antollini.
|
|
|
|
|
Is there any site that has VC++ source code for N-ary tree? Or is there such class provided by MS Visual studio?
|
|
|
|