|
Typically you would override OnFinalMessage() to delete this. If you are still using VC6 (ATL3) then you might encounter some problems with this solution though (http://vcfaq.mvps.org/com/10.htm[^]).
|
|
|
|
|
Thanks. Will look it up and let you know if it solves my problem.
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
|
|
|
|
|
I am an MFC host and willing to develop an parallel application using ATL.
I have developed one class simulate which displays engine piston movement on screen.
and i have four threads for four cylinder.
Using ATL I developed a control which can show one cylinder running.
But with help of multithreading I want to show four cylinders.
Is it possible to develop such control.
|| ART OF LIVING ||
|
|
|
|
|
I Declare a custom ListViewCtrl like this:
class CListCtrlImpl :
public CWindowImpl<clistctrlimpl, clistviewctrl="">
{
public:
BEGIN_MSG_MAP(CListCtrlImpl)
END_MSG_MAP()
CListCtrlImpl(){};
virtual ~CListCtrlImpl(){};
};
I want to do something when click the ScrollBar
class CListCtrlImpl :
public CWindowImpl<clistctrlimpl, clistviewctrl="">
{
public:
BEGIN_MSG_MAP(CListCtrlImpl)
MESSAGE_HANDLER(WM_ONVSCROLL, OnVScroll)
END_MSG_MAP()
CListCtrlImpl(){};
virtual ~CListCtrlImpl(){};
LRESULT OnVScroll(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if (GetFocus() != m_hWnd) SetFocus();
return 0;
}
};
for this code, the OnVScroll function can execute, but the SCrollBar doesn't work well, the content doesn't scroll any when I drag the SCrollBar ,
can every help me, Thanks to all!
-- modified at 21:03 Tuesday 27th June, 2006
|
|
|
|
|
LRESULT OnVScroll(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
:
bHandled = FALSE;
return 0;
}
|
|
|
|
|
|
hi guys
i m getting a problem of insertion into the database.The application has been developed using java-beans,jsp and database as mysql server and the application is deployed in red hat linux 7.0(which is a server)
The actual problem is the data gets inserted every time but sometimes the data does not gets inserted into one table but the other tables are updated
thanks in advance
ratish
|
|
|
|
|
You need a java forum not a C++ forum. Give a little more detail when describing your problem.
-- modified at 8:59 Tuesday 27th June, 2006
|
|
|
|
|
Hi,
I have created an ATL executable.
It has only CExeModule (base -> CComModule)
I inserted a dialog. and in _tWinMain ,
I create this dialog and show.
So when I execute this exe itself, dialog shows up.
Now I want this COM exe to be used in a VB program.
I give the reference to this particular component .
But in code how may I use this to show my dialog in my exe COM.
had there been an Interface with method showdialog (where dialo will be created and showed),
I would have used similar to..
Dim obj as Object
Set obj = new MyInterface
obj->showdialog
1. But without such interface , how can I show up my dialog in VB , if the dialog itself is created at the entry point of com i.e. in _tWinMain
2. If the ATL exe has interface and method (to show dialog), then how can I use ATL exe itself to show the dialog.
Thanks
Row
|
|
|
|
|
You souldn't put the call the show the dialog in WinMain . You should use the ATL wizard to add a COM object to the project the put the call to show the dailog in one of the interface methods implemented by the object.
Steve
|
|
|
|
|
I have a win32 library with no interfaces , just only exported functions.
e.g. One of those is .. bool getInfo (char *string, int counter);
I created a ATL exe , inserted a simple object.No I want to link the above library to my ATL project.
So in Project->settings->link, I gave the lib name and directory of the lib file.
Now I want to use this function getInfo in my atl program.
SO I added one method in my interface say CallLibFunction
And in that method I want to call getInfo..
Are these steps ok?
Please let me know, any other precaution or regarding data types???
Kindly let me know.
Row
|
|
|
|
|
You may need to declare the getInfo signatrure to satisfy the compiler.
bool getInfo (char *string, int counter);
Implimentation will be taken from the .lib file.
cheers...milton KB
|
|
|
|
|
You need to include a header file that should be provided with the library.
|
|
|
|
|
I'm trying to create a .dll using ATL, which I want use in C#.
Can anybody please guide me to create a simple method / function which takes string in input parameters and returns the same(string)..
I tried a lot but always faced problem of returing string back to calling function in C#.
I did the same with C++ class library successfully but when it comes to ATL its not the same.
As I'm using other SDK API's in creation of .dll and I can't go with Class Library its having problem with "CLR and MTd". Which can't go together. Finally I decided to stick to ATL.
Now please guide me to create the methods which I can use in C# to get the string value.
Arun
|
|
|
|
|
I assume that you don't use attributes in your project, and you want to have a property named 'Title' of type BSTR (COM string type)
in your IDL file:
interface IYourInterface: IDispatch{
[propget, id(1), helpstring("property Title")] HRESULT Title([out, retval] BSTR *pVal);
[propput, id(1), helpstring("property Title")] HRESULT Title([in] BSTR newVal);
};
in the header file of your object:
public:
STDMETHOD(get_Title)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_Title)(/*[in]*/ BSTR newVal);
private:
_bstr_t m_bstrTitle; // variable holding the property value
and in the implementation file of your object:
STDMETHODIMP CYourClass::get_Title(BSTR *pVal)
{
*pVal = m_bstrTitle.copy();
return S_OK;
}
STDMETHODIMP CYourClass::put_Title(BSTR newVal)
{
m_bstrTitle = _bstr_t(newVal);
return S_OK;
}
-- modified at 15:53 Monday 19th June, 2006
|
|
|
|
|
hello @ Roozbeh69 thanks for that solution but I have faced few problems which are listed below :
I have created property using wizard but when it comes to
<br />
private:<br />
_bstr_t m_bstrTitle;
<br />
and in the implementation file of your object:<br />
<br />
STDMETHODIMP CYourClass::get_Title(BSTR *pVal)<br />
{<br />
*pVal = m_bstrTitle.copy();
return S_OK;<br />
}<br />
<br />
STDMETHODIMP CYourClass::put_Title(BSTR newVal)<br />
{<br />
m_bstrTitle = _bstr_t(newVal);
return S_OK;<br />
}<br />
and As per me the syntax which u have given varies a lot from auto generated one. I'm using VS 2005.
Once again I would like to clear what exactly I'm trying after ...
I want to create a .dll using ATL. After I want to create a method inside this, which I can call from C#.
This method should take Filepath(string) as input while invoking from C# and should return some string back to C#.(not pointer)
Please guide me if possible with a proper working code.
Thanking you,
Arun
|
|
|
|
|
No need to call the .copy() or to create a new _bstr_t out of the BSTR u r gettign into the property put.
corrected code below:
<br />
STDMETHODIMP CYourClass::get_Title(BSTR *pVal)<br />
{<br />
*pVal = m_bstrTitle; <br />
return S_OK;<br />
}<br />
<br />
STDMETHODIMP CYourClass::put_Title(BSTR newVal)<br />
{<br />
m_bstrTitle = newVal;<br />
return S_OK;<br />
}
Regarding the method u need to create, the IDL signature will be:
[id(1), helpstring("your atl method signature")] HRESULT YourATLMethod([in] BSTR Filepath, [out,retval] BSTR* ReturnString);
and the C++ implimentation signature will be:
STDMETHODIMP CYourClass::YourATLMethod(BSTR Filepath, BSTR* ReturnString)<br />
{<br />
_bstr_t bstrFilepath = Filepath;<br />
_bstr_t bstrReturnstring = _T("some string here");<br />
*ReturnString = bstrReturnstring ;<br />
return S_OK;<br />
}
cheers ...milton kb
|
|
|
|
|
Hi Milton,
Yes, it solved my problem. Really thank u very much man.
Thanking U,
Arun
|
|
|
|
|
STDMETHODIMP CYourClass::YourATLMethod(BSTR Filepath, BSTR* ReturnString)
{
use the BSTR FilePath to get the BSTR to return, you can also use a LPCOLESTR
CComBSTR TheReturnString = L"the string";
*ReturnString = SysAllocString(TheReturString.m_str); //or any BSTR or LPCOLESTR to be allocated by the system using the pointer given by the com client
return S_OK;
}
|
|
|
|
|
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
|
|
|
|