|
If you're asking what is it used for, it's used for most methods when you write a COM interface definition. The "standard" methods have a return type of HRESULT and a calling convention of __stdcall .
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
I'm currently working on an imaging application. I use a subclassed file dialog to allow the user to import items into my app.
I want to be able to allow the user to select images / folders so they can recursively import the items from the subfolders.
I've inserted a handler into my code to deal with the open button clicked command with the intention of creating a list of the currently selected images / folders.
However whenever I try and access the list view the number of selected items is zero.
I've tried calling CListBox::GetSelCount() and CListBox::GetSelItems() , both with no success.
Has anyone been able to access the contents of the file list in a WTL file dialog?
|
|
|
|
|
Errrrm - CListViewCtrl rather CLIstBox?
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Hi
I have the following
class MyClass
{
private:
std::ofstream out;
public:
MyClass() {out.open("C:\\test.txt" , std::ios::out);}
template <typename T> MyClass& operator<<(const T& t)
{
out << t;
return *this;
}
};
and it works well...
MyClass myinstance;
myinstance << "Hello " << 2.4;
except...the logical way for a new line is std::endl so...
myinstance << "Hello" << std::endl;
but this throws a compiler error of
<br />
'class MyClass &__thiscall MyClass::operator <<(const T &)' : cannot use function template 'class std::basic_ostream<_Elem,_Traits> &__cdecl std::endl(class std::basic_ostream<_Elem,_Traits> &)' as a function argument<br />
Do I have to implement my own std::endl? Basically, I'm stuck...
Any info on this, much appreciated.
Cheers
Angel.
******************************************************
I once bought a book called 'Learn to read in 21 days'
Nigel Spoon - 1998
|
|
|
|
|
Your operator is missing some stuff that should be there - check out my article for info:
http://www.codeproject.com/vcpp/stl/iostreaminserters.asp[^]
To be honest, it's long enough since I did this sort of thing that I don't know if any of that will help, but it will improve your implimentation anyhow.
Don't forget that std::endl sends an endline AND flushes the stream. I don't know if this could cause your problem, but it's something that is often overlooked.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Many thanks - excellent article as well. Some cut'n'pasting here I reckon to improve my implementation - thanks again!
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
Note what the error message says about endl : cannot use function template 'class std::basic_ostream<_Elem,_Traits> &__cdecl std::endl(class std::basic_ostream<_Elem,_Traits> &)'
You're trying to pass a template to the function, not an instantiation of a template , which is not legal because a template all by itself isn't anything, it's just... well, a template.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
How did I not see that ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I am busy with developing an ActiveXControl for analysis of data from a Database.
One option shall be the visualization of data as a chart. Therefor I would like to use e.g. the ActiveX-ChartControl from MS (the MSChart Control).
How can I create during runtime an ActiveX Control like MSChart in an ActiveX Control?
Thanks,
Thomas
|
|
|
|
|
Hello,
I created an ActiveX (DLL file) with VC++ & ATL. Il works perfectly, but when I install it via a webpage, it appears that according to IE, this ActiveX has a "damaged" status.
I don't know exactly what "damaged" means, as the ActiveX runs perfectly, and that it has been numerically signed with a Verisign certificate.
Can somebody tell me what does "damaged" status mean, and what should I do to make this ActiveX have a normal status within Internet Explorer ?
Thank you.
|
|
|
|
|
one CDateSource instance ,can it use in multithread ?
if it can't ,how to resolve?
|
|
|
|
|
Hi
I am developing web service as well as a Winform client for transferring some data.
I just wand to know some of the exceptions during the transactions say for example
1. If web service as well as client is running in the same machine, if the IIS is not running means which exceptions will be thrown in the client side
2. If an error (say access violation or any other error) happened in the web service which exception will be thrown from the web service and how to catch in the client program
3.If the web service is running in the remote machine if the cline is unable to find the web service which exception will be thrown
4. If the web service is running in the remote machine and there is no network connection between the web service and the client , how it is possible to detect from the client side.
5.Each and every exception at run time is important for me for the cases like above.
Could any one provide some information or code sample regarding the same?
|
|
|
|
|
Hi,
I need to have a dipath message mapppin. In MFC there is BEGIN_DIPATCH_MAP whereas my program is in wtl how can i use the macro in it. Pls provide a solution or an alternate.
Regards
saravanan
|
|
|
|
|
Hi,
I need to convert the mfc code to atl for connecting to the windows shell. Please provide me some ideas or sample coding regarding this. I've enclosed the MFC coding below.
LPCONNECTIONPOINTCONTAINER pContainer;
LPCONNECTIONPOINT pXConnection = NULL;
DWORD dwCookie = 0;
CoInitialize(NULL);
if(m_pInterface == 0)
{
if(m_pInterface.CreateInstance(__uuidof(SHDocVw::ShellWindows)) == S_OK)
{
if ((m_pInterface != NULL) && SUCCEEDED(m_pInterface->QueryInterface (IID_IConnectionPointContainer,(LPVOID*)&pContainer)))
{
if (SUCCEEDED( pContainer->FindConnectionPoint (__uuidof(SHDocVw::DShellWindowsEvents, &pXConnection)))
{
ASSERT(pXConnection != NULL);
pXConnection->Advise( GetIDispatch(FALSE), &dwCookie);
pXConnection->Release();
}
pContainer->Release();
}
}
}
Regards
saravanan
|
|
|
|
|
Is there any ATL template/ wizard to implement a Outgoing IDispatch Interface at the client side.
If not how should it be implemented in the client side.
Preetham Raghunanda
|
|
|
|
|
I write a nt service, it need connect to database to update data.
I use CDataSource|CSession|CDynamicAccesor to implement it, it can't work, in other program, it just works fine. I can't know how to resolve it!
I can run the service.exe on CMD, it works, but from MMC to start the service, it can't work. return "Unknown error", why???
big is big...
|
|
|
|
|
what are you talking about ?
what database do you use ?
what error is returned ? any description ?
how do you proceed ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Probably you cannot authenticate on database server. Possibly you set SSPI authentication and when you start your service manually it use your account in your domain (and you have access to the database). When you start as service, it has LOCAL SYSTEM account and cannot login to database server.
|
|
|
|
|
Can u give me code for putting Icon(Bitmap Images) which is in a file,pasting on the toolbar button of Outlook
|
|
|
|
|
Hi,
I'm using the ATL OLEDB classes and I get the following error:
"Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done."
when I query the database with a query that uses the "DISTINCT" keyword. Here is a sample of my code.
<br />
HRESULT hr;<br />
CDataSource ds;<br />
CSession session;<br />
CCommand<CDynamicAccessor, CRowset, CMultipleResults> m_Accessor;<br />
<br />
<br />
CComBSTR bstrUser(strUserId);<br />
CComBSTR bstrPassword(strPasswd);<br />
CComBSTR bstrServer(strSvrName);<br />
CComBSTR bstrDatabase(strDbName);<br />
<br />
CDBPropSet dbinit(DBPROPSET_DBINIT);<br />
dbinit.AddProperty(DBPROP_AUTH_PASSWORD, bstrPassword);<br />
dbinit.AddProperty(DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO, false);<br />
dbinit.AddProperty(DBPROP_AUTH_USERID, bstrUser);<br />
dbinit.AddProperty(DBPROP_INIT_CATALOG, bstrDatabase);<br />
dbinit.AddProperty(DBPROP_INIT_DATASOURCE, bstrServer);<br />
<br />
hr = ds.Open(_T("SQLOLEDB"), &dbinit);<br />
<br />
if ( SUCCEEDED(hr) )<br />
{<br />
hr = session.Open(ds);<br />
}<br />
else<br />
{<br />
session.Close();<br />
ds.Close();<br />
exit(1);<br />
}<br />
<br />
CDBPropSet propset(DBPROPSET_ROWSET);<br />
propset.AddProperty(DBPROP_IRowsetChange, true);<br />
propset.AddProperty(DBPROP_IRowsetScroll, true);<br />
propset.AddProperty(DBPROP_CANFETCHBACKWARDS, true);<br />
propset.AddProperty(DBPROP_UPDATABILITY, <br />
DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE );<br />
<br />
char Query[] = "select distinct dl_num from deal"<br />
LONG lRowsAffected = 0;<br />
<br />
hr = myAccessor.Open(m_session, Query, &propset, lRowsAffected);<br />
If I remove the DISTINCT keyword, the query works fine
Are there some things I need to set for the DISTINCT and GROUP BY keywords to work? We are using SQL Server 2000. Thanks for your help.
|
|
|
|
|
I am new to WTL/ATL, and I am trying to make a popup style window like MSN Messenger has. I have a class that has CWindowImpl as it's base. When I try to create the window, the error I get is: The system cannot find the file specified.
In my .h file, I have:
DECLARE_WND_CLASS("CInfoPopup")
and then to create the object, I have
this->mParent = theParent;<br />
HWND hwndMain;<br />
<br />
HINSTANCE hInstance = _AtlBaseModule.GetResourceInstance();<br />
WNDCLASSEX wcx;<br />
<br />
ZeroMemory(&wcx,sizeof(WNDCLASSEX));<br />
wcx.cbSize = sizeof(WNDCLASSEX);<br />
wcx.style = CS_HREDRAW|CS_VREDRAW | CS_DBLCLKS;<br />
wcx.lpfnWndProc = ::DefWindowProc;<br />
wcx.cbClsExtra = 0;<br />
wcx.cbWndExtra = 0;<br />
wcx.hInstance = hInstance;<br />
wcx.hIcon = NULL;<br />
wcx.hCursor = LoadCursor(NULL, IDC_ARROW);<br />
wcx.hbrBackground = (HBRUSH)(COLOR_WINDOW);<br />
wcx.lpszMenuName = NULL;<br />
wcx.lpszClassName = "CInfoPopup";<br />
wcx.hIconSm = NULL;<br />
<br />
if (!RegisterClassEx(&wcx))<br />
return 0;<br />
<br />
hwndMain = CreateWindowEx(WS_EX_NOPARENTNOTIFY | WS_EX_TOPMOST, "CInfoPopup", "", WS_POPUP, 0, 0, 0, 0, this->mParent->m_hWnd, NULL, hInstance, NULL);<br />
I have also tried registering the class, and then
CWindowImpl<CInfoPopup>::Create(this->mParent->m_hWnd, rect, "", CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS, WS_EX_NOPARENTNOTIFY | WS_EX_TOPMOST, 0U, NULL);
When I do that, I get: The specified module could not be found.
Any help would be appreciated!
|
|
|
|
|
Don't call RegisterClass() yourself, ATL does that the first time you create a window using that C++ class - look at the code behind DECLARE_WND_CLASS and you'll see it.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Thanks for the reply. Unfortunately I am still having problems. If I use
CreateWindowEx(WS_EX_NOPARENTNOTIFY | WS_EX_TOPMOST, "CInfoPopup", NULL, WS_POPUP, 0, 0, 0, 0, NULL, NULL, hInstance, NULL);
I get "Cannot find window class".
If I use
CWindowImpl<CInfoPopup>::Create(this->mParent->m_hWnd, rect, "CInfoPopup", WS_POPUP, WS_EX_NOPARENTNOTIFY | WS_EX_TOPMOST, 0U, NULL);
I get "The system cannot find the file specified".
Which call should I use, and do you have any idea why I am getting those errors? Thanks!
|
|
|
|
|
Use the CWindowImpl window traits parameter to set the default styles:
typedef CWindowTraits<WS_POPUP, WS_EX_NOPARENTNOTIFY|WS_EX_TOPMOST> InfoPopupTraits;
class CInfoPopup : public CWindowImpl<CInfoPopup, CWindow, InfoPopupTraits>, ...
{ ... }; Then create a window using CInfoPopup which makes ATL register the window class:
CInfoPopup wnd;
wnd.Create ( mParent->m_hWnd, rect );
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
I did exactly what you said and I get the error "The system cannot find the file specified." Is there something wrong with my class? I am trying to convert "Taskbar Notification dialog" By John O'Byrne (http://www.codeproject.com/dialog/TaskbarNotifier.asp)from MFC to WTL. Thank you so much for your help. Sorry for being such a dope.
|
|
|
|
|