|
hi all,
I have two ActiveX one parent and other child ActiveX.
I want the to establish communication between the two i.e parent and child control.(the container for Parent control is IE ).
To my knowledge. you have to provide a ClientSite for the Object so that you can host the Object in a container.
But I don't know how to create a Site Object in a Parent ActiveX so that I can give the ref of child Object.
Can anyone please help me,
Thanks in advance,
Abhishake
|
|
|
|
|
What I understand from above question is....You want to put Some Child ActiveX on Parent ActiveX and Communicate between them..if this is so...
Then use AtlAxCreateControl(....IUnKnown);
through this IUnknown pointer you can Advise/Addref to the child ActiveX)
regards
Balkrishna Talele
|
|
|
|
|
I am trying to add a status bar to my WTL dialog, and I'm not quite sure how to go about it. I tried this code in my OnInitDialog:
int indicator = ID_SEPARATOR;
m_statusBar.Create(m_hWnd);
m_statusBar.SetParts(1, &indicator);
m_statusBar.ShowWindow(SW_SHOW);
However, when dialog is created the status bar is created outside of the window floating at the top of the screen, which is very strange. All of the code samples show how to add it to CFrameWindowImpl, and I'd like to have the dialog editable in the dialog editor. Any ideas?
|
|
|
|
|
I'd think it was close to the same solution for MFC and adding toolbars to dialog based apps. I saw a ton of replies to that on a Google search yesterday when I was looking for something else.
|
|
|
|
|
Here is one solution, but it has a caveat.
Add a custom control in the VC resource editor, setting the class name to be "msctls_statusbar32". Positioning doesn't matter, it will get moved to the bottom of the dialog anyway.
However, the dialog's gripper is now obscured. I think I'm going to move to a frame window for this, it is a bit ridiculous.
|
|
|
|
|
OS: Win2K
Compiler: Visual Studio 6 sp5 and sp6, C++, Platform SDK Oct 2001.
I have created an ATL/COM EXE. It has a single, simple COM Object. I can build the component through the IDE. When I use nmake, the project builds and links but fails to return from the registration of the component--it hangs the server as though there were a memory leak. The COM Object does nothing--I could include it here, but if you created a new ATL/COM EXE and select from msdev menu Insert/New ATL Object... and select Simple Object, you would have what I have.
I have installed sp6 on my machine but that did not clean it up.
Has anyone else seen this problem? Solutions?
Thanks,
|
|
|
|
|
#include <atlmisc.h>
class NewNoteWindow;
typedef CWinTraits<WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_APPWINDOW | WS_EX_WINDOWEDGE> CMyWindowTraits;
typedef CFrameWindowImpl<NewNoteWindow, ATL::CWindow, CMyWindowTraits> CMyFrameWindow;
class NewNoteWindow : public CMyFrameWindow, public CUpdateUI<NewNoteWindow>,
public CMessageFilter, public CIdleHandler
{
public:
DECLARE_FRAME_WND_CLASS(NULL, 0)
char buf[5000000];
virtual BOOL PreTranslateMessage(MSG* pMsg)
{
return CMyFrameWindow::PreTranslateMessage(pMsg);
}
virtual BOOL OnIdle()
{
return FALSE;
}
BEGIN_UPDATE_UI_MAP(NewNoteWindow)
END_UPDATE_UI_MAP()
BEGIN_MSG_MAP(NewNoteWindow)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
CHAIN_MSG_MAP(CUpdateUI<NewNoteWindow>)
CHAIN_MSG_MAP(CMyFrameWindow)
END_MSG_MAP()
LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
return 0;
}
virtual void OnFinalMessage(HWND hWnd) {
delete this; // This is not working very well..
}
LRESULT OnCreate(LPCREATESTRUCT lparam) {
m_hWndClient = CreateWindowEx(WS_EX_CLIENTEDGE, NULL,"" , WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN,20, 20, 20, 20, m_hWnd, NULL, NULL, NULL);
// register object for message filtering and idle updates
CMessageLoop* pLoop = _Module.GetMessageLoop();
pLoop->AddMessageFilter(this);
pLoop->AddIdleHandler(this);
SetMsgHandled(false);
return 0;
}
};
When running the app under debug i get an Access Violation when I close the window. Why? It doesn't happen without delete this; but i see using my 5 meg buffer(in task manager) that the NewNoteWindow-object hasn't been deleted so i obviously have to delete it myself. Can someone help me make this work correctly?
|
|
|
|
|
|
So how am i supposed to delete the class instance then? i dont want a memory leak..
|
|
|
|
|
This may be a bug of ATL in VC6 and it will not apply to VS.NET.
See CWindowImplBaseT::WindowProc for details.
//Sample code of ATLWin.h in VC6
////////////////////////////////////////////////////////////
if(!bHandled) {
lRes = ::DefWindowProc(pThis->hWnd, uMsg, wParam, lParam);
if(uMsg == WM_NCDESTROY)
{
HWND hWnd = pThis->hWnd;
pThis->hWnd = NULL;
//clean up after window is destroyed
pThis->OnFinalMessage(hWnd);
}
}
//Sample codes of ATLWin.h in VC7
//////////////////////////////////////////////
if(!bHandled){
lRes = ::DefWindowProc(pThis->m_hWnd, uMsg, wParam, lParam);
if(uMsg == WM_NCDESTROY) {
// mark window as destryed
pThis->m_dwState |= WINSTATE_DESTROYED;
}
}
if((pThis->m_dwState & WINSTATE_DESTROYED) && pThis->m_pCurrentMsg == NULL)
{
HWND hWnd = pThis->m_hWnd;
pThis->m_hWnd = NULL;
pThis->m_dwState &= ~WINSTATE_DESTROYED;
pThis->OnFinalMessage(hWnd);
}
|
|
|
|
|
ok well how am i supposed to delete the windows then? right now i am just thinking of a garbage collector using a timer. i cant just leave the objects in memory as a leak..
|
|
|
|
|
|
Did you post this into the future? Is it 2003 where you are at?
--
Booohoo!
|
|
|
|
|
Nice!
What's new in 7.1 ? Wasn't 7.0 released when VS.NET03 was released?
R.Bischoff
.NET, Kommst du mit?
|
|
|
|
|
hi,
i m trying to make my COM server through ATL COM APP Wizard to handle asynchronous calls. But i have an error while trying to update the idl file for this purpose.
While adding these lines
coclass FullServ
{
[default] interface IFullServ;
interface ICallFactory;
}
it throughs the following error
error MIDL2337 : unsatisfied forward declaration : ICallFactory [ Coclass 'FullServ' ]
It will be so kind of u if u can help me out.
|
|
|
|
|
Hi everybody,
Does anybody know, how I can use a WTL splitter window in an MFC 6.0 project? I want to have a more flexible splitter window in my MFC application. please explain it in detail.
thanks in advance,
Roozbeh.
|
|
|
|
|
hi all,
I have created a two control using AtlAxCreateControl() function now i want to aline these control in a container window. and out of these two control one is a full control and other is composite control.
I guess i have to use the IOleObject's SetExtent() funtion to adjust the size of control. and for that I have to anyhow get the Interface pointer to IOleObject.
But how to get the interface pointer to QueryInterface(),IOleObject?
Thanks in advance,
Abhishake
|
|
|
|
|
Hi there,
I don't know what hWnd are you passing as a parameter to the AtlAxCreateControl function, you should ask that window to return you the control. But I think is easier if you use AtlAxCreateControlEx, it will return a IUnkown to the control, or you can host the control in a CAxWindow, in that case you do CAxWindow::CreateControl and then CAxWindow::QueryControl or again just in one step, CAxWindow::CreateControlEx
Regards,
Fabian
|
|
|
|
|
Hello Group.
I want to try to make this kind of program
Have 1 Database with the filds like the example
Name - Jose
Mail - jose@test.com
Name - Mary
Mail - mary@test.com
I want a kind of smtp filter, when the user send a mail from outlook by exemple do name Mary, the winsock send a mail to the database specified mail.
This is possible ??
Someone can help or post some exemple to something like this smtp filter ?
Best Regards
|
|
|
|
|
Hello !
1. Sorry for my English
2. Bloody beginner
3. I have a ATL Full Control, invisible at runtime.
It is placed in a HTML Page with the <OBJECT> Tag.
There is a custom Message:
-----------------------------------------------------
#define MY_TEST (WM_APP + 1)
....
LRESULT OnTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
....
BEGIN_MSG_MAP(CmyClass14)
CHAIN_MSG_MAP(CComControl<CmyClass14> )
DEFAULT_REFLECTION_HANDLER()
MESSAGE_HANDLER(MY_TEST, OnTest)
END_MSG_MAP()
-----------------------------------------------------
OK. Compiles fine.
But how do I Post my Message?
Here is what I tried:
PostMessage(MY_TEST) or
::PostMessage(this->m_hWnd, MY_TEST, 0, 0)
gives me an Assertion failure at runtime with "::IsWindow(hWnd)"
That tells me PostMessage needs a Window. (?)
PostThreadMessage(GetCurrentThreadID(), MY_TEST, 0, 0) or
::PostThreadMessage(GetCurrentThreadID(), MY_TEST, 0, 0)
works, but the message handler OnTest is never called.
What can I do ???
MfG
Sebastian
|
|
|
|
|
Hi there,
Sorry I don't have an answer for you, mainly because I don't know/understand what are you trying to do, but, I have a couple of comments for you.
First never do something like this to obtain a message id
#define MY_TEST (WM_APP + 1)
somebody else can be using the same id for a different message, always use
UINT RegisterWindowMessage( LPCTSTR lpString /* message string */ );
for your messages, this API guarantee the returning id is unique.
Second, why do you use a Control that is invisible at RunTime?, if your object has no visible interface, it may be better to use a Single object or even an ATL Class.
Post a brief description of what are you trying to achieve, I may be able to help you.
Regards,
Fabian
|
|
|
|
|
I will try to explain the idea:
The article "Firing Events among ActiveX Controls on the IE Browser" by Yasuhiko Yoshimura
( http://www.codeproject.com/com/firingeventsamongactivex.asp )
showed me a way to link up multiple client-controls to a server-control.
The client-controls in my scenario are visualisations of data fired from the server-control.
The server-control is a "interface" with no UI which:
1. Links up to a 3rd-Party-Queueing-System...
2. ... processes the incoming data...
3. ... and fires events to the client-controls for visualisation.
And so the server-control shall be invisible.
HTML-Page:
<OBJECT ID="SERVER" CLSID...>
<OBJECT ID="Client1" CLSID...>
<OBJECT ID="Client1" CLSID...>
....
But all this lays in far future.
My Problem: The invisible server-control has to catch custom messages (defined by the 3rdPartyAPI).
To simplify things and for testing I try to catch my own WM_APP+1 message.
And in the way I'm trying to post/map my message it doesn't work.
Was my explaining OK?
Any idea will help me a lot.
MfG
Sebastian
|
|
|
|
|
Hi
I think I'm starting to understand what you are trying to do.
The fact of having several objects hosted on IE is irrelevant to your
problem, isn't it?
The real issue here is how to capture messages from a 3rd party package, am
I right?
So, let me ask you, is this 3rd party queueing system a COM based server or
not?, if it is so, it should communicate using event and not messages.
The article that you mentioned, "Firing Events among ActiveX Controls on the IE Browser", clearly talks about events and not messages.
If it is not a COM server, can you show me a piece of documentation how
it is suppose to communicate back to your code? I'm saying this because is
very unusual for a library to send messages to a client, usually this is
done through call back functions, so what you are saying sounds a litle odd.
Anyways, comments aside, here is how you can do the test you mentioned before.
First, declare the id of the message you will use.
Add this line to the stdafx.h file so it will be available to the whole project
extern UINT UM_MYTESTMESSAGE;
now define its value.
Add this into your cpp file.
UINT UM_MYTESTMESSAGE = ::RegisterWindowMessage(_T("MyAppNameMyMessageName"));
Now how to capture the message, if your class derives directly or indirectly from a CWindowImpl it has a BEGIN_MSG_MAP macro, so add this line
BEGIN_MSG_MAP(CMyTest)<br />
MESSAGE_HANDLER(UM_MYTESTMESSAGE, OnMyMessageTest)
... it may be something else here<br />
END_MSG_MAP()
Then you have to provide the OnMyMessageTest implementation, so add this
<br />
LRESULT OnMyMessageTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)<br />
{<br />
MessageBox(_T("I got the message "));<br />
return 0;<br />
};<br />
And last, somebody has to send the message to this window, and I think here is where you have the problem, answering your question, yes, messages can only be send to a valid window, if you got an assertion here
ATLASSERT(::IsWindow(m_hWnd));
is because you sent the message when the window was not yet created, so, choose a place where the window you are send the message to, has already been created, then add this line
::SendMessage(hWnd, UM_MYTESTMESSAGE, 0, 0);
hWnd is a valid handler to the window where the message will be processed.
I hope this helps you, if you need an example project, let me know and I'll email one to you.
Regards,
Fabian
|
|
|
|
|
First of all thanks a lot for your effort to help me.
- The queueing system is a non-COM service. It uses messages to signal the queue-clients for incoming data.
- My invisible control is such a queue-client.
- My invisible control uses events to distribute the data-values to the other controls which visualize them.
It would be no problem if my invisible control wouldn't be invisible. It seems to me that there is no window created if a control is marked "invisible" (which was a little mislead to me). I tried to create a window inside my control, but this fails, too...
So I surrender and use the other possibility. My windowless control creates a thread which captures the queue-messages and fires the events....
...but multithreaded event-firing makes me shiver.
MfG,
Sebastian
|
|
|
|
|
I have C++ program which reads a binary file and creates an ascii result file. Ihave used the win32 dynamic dll project and exported my function like below.
__declspec(dllexport) __stdcall calculate(LPSTR sFileName)
it reads a huge file of around 206 MB and generates a ascii file of 300KB. I have used a FILE* object and fread and fprintf to do all the read writes.
when I run the prog for first time( after restarting) it takes a huge 48 secs with 216 MB free memory. on the second run with similar memory it takes only 20 secs. with the third run it even more reduces to 15 secs.
i am unable to understand why this might be happening. any light on this will be a great help.
if you need any more info please do write to me.
|
|
|
|
|