|
Hi everybody,
I have a WTL wizard generated MDI application with a form (Dialog based) view. The form has several controls on it. When it looses the focus (for example because of showing a message box) and then gets the focus again, the last active control wont have keyboard focus (In fact the first control gets the keyboard focus instead).
I want to know why it happens and what the solution is?
Thanks in advance
|
|
|
|
|
Hi,
Does anyone know how to declare an enum type in Vs7 so that it is exposed on the COM interface in an ATL project?
It is easy to do this in VS6, you just edit the IDL file, compile and it's done. In VS7 however, the IDL file is
compiled from the ATL interface header file. I've tried declaring the enum in this header file, but when it's
compiled only the interface code appears in the generated IDL file.
Any help greatly appreciated
Ian McLauchlan
|
|
|
|
|
Create an idl file say commonidlItems.idl with contetc as below:
import "oaidl.idl";<br />
import "ocidl.idl";<br />
<br />
typedef [uuid(565699C1-CD68-4d49-A2B0-44D424682489), version(1.0)]<br />
enum {<br />
item1 =0,<br />
item2 = 1,<br />
item3 = 2,<br />
} MyEnum;
include the idl file in the ids if u need to use the enum as paramtyer to com methods. This can be done as below
import "commonidlItems.idl";
To use the enums in the CoClass implimentations, you have to generate the header file.
Type midl commonidlItems.idl in the VS command promt to generate the corresponding header file.
add the generated headerfile to the project.
you are all set then.
cheers...milton Kb
|
|
|
|
|
I need simple ATL activex tutorial
|
|
|
|
|
|
Hello,
I wrote a com object in C++.ATL.
I did a small header file for general definitions.
When I include that file in other classes I got error such as missing ; etc
example of the header file:
#ifndef __LIC_T_H
#define __LIC_T_H
#include
using namespace std;
#define FILE_BUFFER_SIZE 100
#define ENCRYPT_ELEMENT_NUM 4
struct Lic_t
{
};
#endif
thanks
|
|
|
|
|
include stdafx.h as the first #include statement int he header file or disable using porecompiled header file in the project settings.
cheers...milton kb.
|
|
|
|
|
Hi,
I am posting here cos none answers in ATL group.
I have a dialog box in my ATL exe, I want to use/link a C Library. AFter clicking OK button on the dialog on of C functions should execute .
How to do this. linking the Clibrary and opening the C function.
marcoslav
-- modified at 3:10 Friday 16th June, 2006
|
|
|
|
|
extern "C" should work, I believe
|
|
|
|
|
Hi,
I have some problem with this fn.
IMultiMediastream::GetDuration(..);
but this fn. worked well
IMultiMediastream::SetState(STREAMSTATE_RUN);
how to solve this problem
|
|
|
|
|
I need to marshall an interface to a apartment threaded component.The component has type library marshalled interface(oleautomation).
I plan to use CoMarshalInterThreadInterfaceInStream/CoGetInterfaceAndReleaseStream(IStream) based marshalling ,but it cannot be sent across as void*(not automation-compatible datatype).
Is there some way to marshall this interface without using GIT?
|
|
|
|
|
rana74 wrote: it cannot be sent across as void*(not automation-compatible datatype).
What does this mean?
"across" what?
If you mean across apartment boundaries it doesn't matter whether the interface is automation compatible or not.
If it's an interface method that takes an interface pointer it should be passed as an IDispatch* if the interface is automation compatible which means it should not be cast into a void*.
What are you trying to do/call that requires a void*?
rana74 wrote: Is there some way to marshall this interface without using GIT?
Sure, CoMarshalInterThreadInterfaceInStream/CoGetInterfaceAndReleaseStream is the way to do it.
It's supposed to be hard, otherwise anybody could do it!
Regarding CodeProject: "resistance is pointless; you will be assimilated"
|
|
|
|
|
Hi all,
I have customized controls for button(ownerdrawn), listbox, listctrls, etc. They were intended for MFC applications. They are working fine in MFC dialogs in ATL.
But when they put directly in ATL composite control, there are many painting problems. Button is not getting painted (a gray rectangle can be seen). List box and list control are painted as default.
What could be wrong? Or is there any limitation between ATL and MFC connectivity?
- NS -
|
|
|
|
|
NS17 wrote: What could be wrong? Or is there any limitation between ATL and MFC connectivity?
Have you tried the REFLECT_NOTIFICATIONS() macro in your message map?
--
100% natural. No superstitious additives.
|
|
|
|
|
Jörgen Sigvardsson wrote: Have you tried the REFLECT_NOTIFICATIONS() macro in your message map?
Yesterday there were some progress... Yes, I used REFLECT_NOTIFICATIONS() macro. I read in MSDN that there is some changes in messages. For eg., instead WM_DRAWITEM there is OCM_DRAWITEM, etc. So I tried to map this message to drawing function in Button class. Then the button worked fine.
Now my doubt is that,can I map all these OCM_ functions permanently? I need to use the controls in both MFC and ATL based applications without changing the code.
Thank you.
- NS -
|
|
|
|
|
Can't you just have two handlers (eg. for WM_DRAWITEM and OCM_DRAWITEM) that point to the same function?
You can dig around atlwin.h to see how the reflections are done.
OCM_DRAWITEM = WM_DRAWITEM + OCM__BASE
|
|
|
|
|
OK. I understood. I have to try it. Thank you.
- NS -
|
|
|
|
|
How do I find out which version of ATL and WTL is installed on a System? Is there a way?
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
WTL can't be installed, it's just header files.
For ATL, you can look at the version of atl.dll. But apps can be compiled with ATL code staticly linked, so again there's nothing that is installed.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Michael Dunn wrote: WTL can't be installed, it's just header files.
So How do I know which version of ATL and WTL I am using or is present on the System?
Michael Dunn wrote: But apps can be compiled with ATL code staticly linked
How do I achieve it?
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
TechyMaila wrote: So How do I know which version of ATL and WTL I am using or is present on the System?
Oh, you mean when compiling. Ok, the versions are in the _ATL_VER and _WTL_VER symbols.
Use the MinDependency build targets to staticly link ATL.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
If you use ATL control containment you need "ATL.dll" even if your statically linking.
Steve
|
|
|
|
|
I code this, but no use?
why?
How to add Timer in activex ?
BEGIN_MSG_MAP(ClistSample)
MESSAGE_HANDLER(WM_TIMER, OnTimer)
END_MSG_MAP()
LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return 0;
}
alantop
|
|
|
|
|
I believe you will need a Window to get timer messages. It doesn't work in window-less controls.
1- You could use the Multimedia timer.
2- Or you could just create a hidden window that would receive the timer messages.
3- Or create a thread that sleeps for the specified amount of time, and calls a function of your program. (quite inaccurate timing).
this is this.
|
|
|
|
|
You need to start the timer.
UINT nMilliseconds = 1000;
::SetTimer(hWnd,ID_TIMER,nMilliseconds,NULL);
when finish stop it with
::KillTimer(hWnd,ID_TIMER);
|
|
|
|