|
|
GetIconInfo() does not return HBITMAP. It returns BOOL. If the function succeeds, the return value is nonzero and the function fills in the members of an ICONINFO structure whose pointer was passed as a parameter. GetIconInfo() creates bitmaps for the hbmMask and hbmColor members of the ICONINFO structure. The calling application must manage the bitmaps and delete them when they are no longer necessary or resource leakage will occur.
|
|
|
|
|
|
Not trying to be. I'm just wondering why you told Pah he didn't need "all that code" without explaining what he did need and didn't need. It didn't seem all that helpful as an answer to his question and seems to imply:
HBITMAP hBmp = GetIconInfo();
|
|
|
|
|
What is ATL and COM...
particulars. please...
|
|
|
|
|
a template library for making robust COM objects.
|
|
|
|
|
and COM is an abbr. for Component Object Model - the programming style, where you build your software from components. Difference between plain old c++ class (or any other language class) is that components are binaries, not in source form. One of main benefits is, that you can replace parts of your binaries without need of recompiling the whole application. This is important for big projects.
Second important benefit is the language interchangeability - components itself can be written in virtually any language. Then you can build your application as a mixture of C++, Visual Basic, Pascal... just use language which is better for the task...
etc.
|
|
|
|
|
I am beginner too,very think you !;P
I am like programiing
|
|
|
|
|
Hi
I'm getting the following error:
parse error before ';' for the following program. It is a stripped down version.
<<header file>>
template <class T>
class C
{
private:
......
protected:
typedef struct _slot
{
T* obj;
int l;
} slot;
public:
........
};
template class C <char*> //forced instantiation.
<<cpp file>>
template <class T>
int C<T>::func(T* obj,int id)
{
slot* s = new slot; //This works.
.....
map<int,slot<T>*>::iterator it; //I get the error here <-------
....
}
Any idea ?
cheers
Projyal
|
|
|
|
|
sorry , please read
map<int,slot<T>*>
as
map<int,slot*>
cheers
Projyal
|
|
|
|
|
The following compiles OK in MSVC++ 6.0sp5:
#pragma warning(disable:4786)
#include <map>
template <class T>
class C
{
protected:
typedef struct _slot
{
T* obj;
int l;
} slot;
public:
int func(T* obj,int id);
};
using namespace std;
template <class T>
int C<T>::func(T* obj,int id)
{
slot* s = new slot;
map<int,slot*>::iterator it;
return 0;
}
template class C <char*>;
int main()
{
return 0;
} So I guess your problem lies elsewhere.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
is there any one who know how i can add DIALOGBAR in one application,because i want to add it in my application in the long of the right of window and i will add in it some control as slider buton ......
|
|
|
|
|
I'm porting portions of the WTL 7.0 code for Windows CE (Pocket PC 2002). The question is about CFrameWindowImpl and CFrameWindowImplBase : What is the rationale for writing code for one or the other? Specifically: Some work must be done in OnCreate , like creating the menu bar, sizing the frame according to SIP state, and other stuff. Now, should this go into CFrameWindowImpl or CFrameWindowImplBase ?
I'm trying to make sense of the design decisions that must be considered when designing WTL classes...
João Paulo
|
|
|
|
|
Hi,
I am working on a list view control which displays thumbnails. What I want to do is to add a functionality that allows user to drag a thumbail from my list view and drop it into windows explorer or Internet explorer.
I have successfully handled drag and drop from Windows explorer & Internet Explorer on my list view control.
Important thing to note is that I am only using ATL and not MFC!!!
Can anybody help me out????
Best regards,
Pious.
|
|
|
|
|
1. MSDN Article Q214814 "HOWTO: Implementing Basic Drag and Drop In a Tree Control"
2. MSDN key words "ListView_CreateDragImage;LVN_BEGINDRAG"
3. Take the tree sample and replace with appropriate listview messages/macros
|
|
|
|
|
I am running into a warning -- when I use CString's as member variables inside DLL exportable classes {_declspec(dllexport)}
rfservice.h(30): warning C4251: 'RFService::m_Time' : class 'ATL::CStringT<basetype,stringtraits>' needs to have dll-interface to be used by clients of class 'RFService'
with
[
BaseType=char,
StringTraits=ATL::StrTraitATL<char,atl::chtraitscrt<char>>
]
Should I heed this warning? Should I wrap CString into a DLL-exportable class? What should I do?
-p
|
|
|
|
|
http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b134980
PRB: C4251 & C4275 Compiler Warnings While Compiling an AFXDLL
The information in this article applies to:
The Microsoft Foundation Classes (MFC), when used with:
Microsoft Visual C++, 32-bit Editions 2.0
Microsoft Visual C++, 32-bit Editions 2.1
Microsoft Visual C++, 32-bit Editions 2.2
This article was previously published under Q134980
SYMPTOMS
The Compiler issues the following warning for a class derived from one of the MFC classes:
warning C4275: non dll-interface class XXX used as base for dll-interface class YYY
A related warning is issued when an object of some MFC class is embedded as a data member of a user-defined class:
warning C4251: identifier : class XXX needs to have dll-interface to be used by clients of class YYY
This problem no longer occurs in vc 4.0 or later.
CAUSE
The DLL version of MFC does not export its classes by declaring them with "class __declspec(dllexport)." Instead, it exports its classes through entries in the EXPORTS section of its module definition (.def) file.
Because the compiler has only the header files to work with, it cannot determine whether the MFC classes were actually exported, and therefore it issues the warning.
RESOLUTION
Because the MFC classes are in fact exported, these warnings can be safely ignored. As shown in the DLLHUSK sample, you can disable these warnings by using the following pragma statements:
<br />
#pragma warning(disable: 4275)<br />
#pragma warning(disable: 4251)<br />
On the other hand, if the warnings refer to some user-defined class rather an MFC class, you should ensure that the class is exported before disabling these warnings.
STATUS
This behavior is by design.
|
|
|
|
|
How to make window with LButtonDown event using WTL?
Write MFC List Class using STL?
Write Add,sub and Mul functions using ATL?
|
|
|
|
|
About every fourth build takes an eternity!
(I think it is when not performin an incremental link, but a fresh one)
The build output is filled with several idl-filepaths.
Does anyone know of anything like a pch for midl?
|
|
|
|
|
I’m getting the following errors:
atlctrls.h(1585) : error C2065: 'ImageList_Read' : undeclared identifier.
I would greatly appreciate if anyone can tell me why I’m getting the above error.
Here is my stdafx.h herder file:
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#if !defined(AFX_STDAFX_H__731756F9_46C8_4C84_843A_D84A4E3C42C1__INCLUDED_)
#define AFX_STDAFX_H__731756F9_46C8_4C84_843A_D84A4E3C42C1__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define STRICT
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
#define _ATL_APARTMENT_THREADED
#pragma warning( disable : 4541 ) // disable warning 4541
#pragma warning( disable : 4530 ) // disable warning 4530
// MFC
#include <afxwin.h>
#include <commctrl.h>
#include <afxdisp.h>
// WTL/ATL
#include <commctrl.h>
#include <atlbase.h>
#include <commctrl.h>
#include <atlapp.h>
#include <commctrl.h>
//You may derive a class from CComModule and use it if you want to override
//something, but do not change the name of _Module
class CExeModule : public CComModule
{
public:
LONG Unlock();
DWORD dwThreadID;
HANDLE hEventShutdown;
void MonitorShutdown();
bool StartMonitor();
bool bActivity;
};
extern CExeModule _Module;
#include <commctrl.h>
#include <atlcom.h>
#include <atlwin.h>
#include <atlctl.h>
#include <comdef.h>
#include <atlhost.h>
#include <atldlgs.h>
#include <atlctrls.h>
// WINDOWS
#include <tchar.h>
#include <direct.h>
#include <stdio.h>
#include <stdlib.h>
// STL
#include <typeinfo>
#include <algorithm>
#include <stdexcept>
#include <exception>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <list>
#include
#include <vector>
#include <time.h>
#include <urlmon.h>
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__731756F9_46C8_4C84_843A_D84A4E3C42C1__INCLUDED)
Thank you,
|
|
|
|
|
Maybe your WINNT version macro is set too low. Change it from 0x0400 to 0x0500.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I'm having a bit of a problem with vector iterators. I've got the following defined:
<br />
std::vector<TrayIcon*> trayIconList;<br />
typedef std::vector<TrayIcon*>::iterator trayIconItem;<br />
Where TrayIcon is class that has GetWnd() and GetID() methods. So, I've created the following function:
<br />
trayIconItem FindTrayIcon(NOTIFYICONDATA *iconData)<br />
{<br />
trayIconItem iter;<br />
<br />
for (iter = trayIconList.begin(); iter != trayIconList.end(); iter++)<br />
{<br />
if (iter->GetWnd() == iconData->hWnd && <br />
iter->GetID() == iconData->uID)<br />
break;<br />
}<br />
<br />
return iter;<br />
}<br />
I'm assuming I have to dereference the 'iter' iterator, since during the compile, I get the following:
<br />
main.cpp: In function `trayIconItem FindTrayIcon(NOTIFYICONDATA*)':<br />
main.cpp:459: request for member `GetWnd' in `<br />
*(&iter)->__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator->()<br />
const [with _Iterator = TrayIcon**, _Container = std::vector<TrayIcon*,<br />
std::allocator<TrayIcon*> >]()', which is of non-aggregate type `TrayIcon*'<br />
main.cpp:460: request for member `GetID' in `<br />
*(&iter)->__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator->()<br />
const [with _Iterator = TrayIcon**, _Container = std::vector<TrayIcon*,<br />
std::allocator<TrayIcon*> >]()', which is of non-aggregate type `TrayIcon*'<br />
Can someone please point me in the right direction?
Thanx!
Chris
|
|
|
|
|
Replace every occurrence of
iter-> with
(*iter)-> (remember that you have iterators to pointers.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you much!
Chris
|
|
|
|
|
I create a windows explorer like application. When an item is selected in
treecontrol, the corrosponding items are shown in the list view. The problem
is that when I select an item in the list view, all icons are displayed correctly
except for .htm and .html files. The file assosiations are ok. The code I use is
struct LISTITEMINFO {<br />
LISTITEMINFO() {memset(this, 0, <br />
<br />
sizeof(LISTITEMINFO));}<br />
ITEMIDLIST* lpi;<br />
IShellFolder* pParentFolder;<br />
TCHAR szName[_MAX_PATH];<br />
int iIcon;<br />
DWORD dwAttrs;<br />
};<br />
<br />
<br />
BOOL CMainFrame::FillListView(CTreeItem hItem, SHCONTF shFlag)<br />
{<br />
CWaitCursor wait;<br />
LPITEMIDLIST pidlFolder;<br />
<br />
TVITEM tvi;<br />
tvi.mask = TVIF_PARAM; <br />
tvi.hItem = hItem;<br />
if (!m_FolderTree.GetItem(&tvi)) {<br />
return FALSE;<br />
}<br />
TREEITEMINFO* pItem = (TREEITEMINFO*) tvi.lParam;<br />
pidlFolder = pItem->pidlFullyQual;<br />
IShellFolder* piFolder;<br />
CComPtr<IShellFolder> piDesktopFolder;<br />
::SHGetDesktopFolder(&piDesktopFolder);<br />
<br />
HRESULT hr = piDesktopFolder->BindToObject(pidlFolder, <br />
<br />
NULL, __uuidof(IShellFolder), reinterpret_cast<void**>(&piFolder));<br />
if (FAILED(hr)) <br />
piDesktopFolder.QueryInterface(&piFolder);<br />
<br />
IEnumIDList* piEnum;<br />
hr = piFolder->EnumObjects(NULL, shFlag , &piEnum);<br />
if (FAILED(hr)) return hr;<br />
<br />
INT iOverlayIndex(0);<br />
DWORD dwStyle(0);<br />
LPITEMIDLIST pidlNext;<br />
SHFILEINFO sfi;<br />
INT nCounter = 0;<br />
<br />
while (S_OK == piEnum->Next(1, &pidlNext, NULL))<br />
{<br />
LPITEMIDLIST* ppidlChild = new <br />
<br />
LPITEMIDLIST(pidlNext);<br />
if (NULL == ppidlChild) return E_OUTOFMEMORY;<br />
LPITEMIDLIST pidlAbsChild;<br />
pidlAbsChild =Pidl_Concatenate(pidlFolder, <br />
<br />
*ppidlChild);<br />
<br />
sfi.iIcon = 0;<br />
<br />
<br />
::SHGetFileInfo((LPCSTR)(LPCITEMIDLIST)pidlAbsChild, 0, <br />
&sfi, sizeof(SHFILEINFO), <br />
SHGFI_PIDL | SHGFI_DISPLAYNAME | <br />
<br />
SHGFI_ATTRIBUTES | <br />
SHGFI_SYSICONINDEX | <br />
<br />
SHGFI_SMALLICON);<br />
<br />
if (0xFFFFFFFF == sfi.dwAttributes)<br />
sfi.dwAttributes = 0;<br />
<br />
dwStyle = sfi.dwAttributes & SFGAO_GHOSTED ? <br />
<br />
LVIS_CUT : 0;<br />
dwStyle |= sfi.dwAttributes & SFGAO_LINK ? <br />
INDEXTOOVERLAYMASK(2) : 0;<br />
dwStyle |= sfi.dwAttributes & SFGAO_SHARE ? <br />
INDEXTOOVERLAYMASK(1) : 0;<br />
<br />
LISTITEMINFO* pItemInfo = new LISTITEMINFO;<br />
pItemInfo->dwAttrs = dwStyle;<br />
pItemInfo->iIcon = sfi.iIcon;<br />
pItemInfo->lpi = pidlAbsChild;<br />
pItemInfo->pParentFolder = piFolder;<br />
lstrcpy(pItemInfo->szName, sfi.szDisplayName);<br />
<br />
LVITEM lvInsert;<br />
lvInsert.cchTextMax = _MAX_PATH;<br />
lvInsert.iImage = <br />
<br />
I_IMAGECALLBACK;<br />
lvInsert.iItem = nCounter++;<br />
lvInsert.iSubItem = 0;<br />
lvInsert.pszText = LPSTR_TEXTCALLBACK;<br />
lvInsert.mask = <br />
<br />
LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM;<br />
lvInsert.lParam = <br />
<br />
(LPARAM)pItemInfo;<br />
<br />
int n = m_ListView.InsertItem(&lvInsert);<br />
m_ListView.AddItem(n, 1, LPSTR_TEXTCALLBACK, <br />
<br />
I_IMAGECALLBACK);<br />
m_ListView.AddItem(n, 2, LPSTR_TEXTCALLBACK, <br />
<br />
I_IMAGECALLBACK);<br />
m_ListView.AddItem(n, 3, LPSTR_TEXTCALLBACK, <br />
<br />
I_IMAGECALLBACK);<br />
delete ppidlChild;<br />
}<br />
piEnum->Release();<br />
return TRUE;<br />
}<br />
<br />
and function is called using FillListView(pnmtv->itemNew.hItem, <br />
<br />
SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN | <br />
<br />
SHCONTF_FOLDERS)
any help?
Thanks
|
|
|
|