atl

Difference between unsigned char and char pointers

不羁的心 提交于 2019-12-10 16:07:08
问题 I'm a bit confused with differences between unsigned char (which is also BYTE in WinAPI) and char pointers. Currently I'm working with some ATL-based legacy code and I see a lot of expressions like the following: CAtlArray<BYTE> rawContent; CALL_THE_FUNCTION_WHICH_FILLS_RAW_CONTENT(rawContent); return ArrayToUnicodeString(rawContent); // or return ArrayToAnsiString(rawContent); Now, the implementations of ArrayToXXString look the following way: CStringA ArrayToAnsiString(const CAtlArray<BYTE>

Copying a bitmap from another HBITMAP

隐身守侯 提交于 2019-12-10 14:21:58
问题 I'm trying to write a class to wrap bitmap functionality in my program. One useful feature would be to copy a bitmap from another bitmap handle. I'm a bit stuck: void operator=( MyBitmapType & bmp ) { HDC dcMem; HDC dcSource; if( m_hBitmap != bmp.Handle() ) { if( m_hBitmap ) this->DisposeOf(); // copy the bitmap header from the source bitmap GetObject( bmp.Handle(), sizeof(BITMAP), (LPVOID)&m_bmpHeader ); // Create a compatible bitmap dcMem = CreateCompatibleDC( NULL ); m_hBitmap =

how to update row data fetched using ATL OLE database in C++ from simple SQL server table

喜你入骨 提交于 2019-12-10 12:20:04
问题 I am experimenting with OLE database programming using Microsoft ATL and C++ with Visual Studio 2005. I have created a sample Windows console program along with a simple database with a single table containing two columns, a 10 character (ANSI numeric digits) id and a signed 32 bit long count. There are two rows in the table. The database, table, and rows were created with SQL Server 2005 Server Management Studio Express. I need to know the method used with ATL to update the data in a row

Problem in hosting ActiveX on Vista (in a Visual Studio 6 C++ application)

可紊 提交于 2019-12-10 12:04:33
问题 I just installed Visual Studio 6 (SP5) on a Vista Enterprise machine. Had some problems but I think it’s set up alright. The problem is my VC++ 6 application fails when trying to host an ActiveX. I was able to compile it ok, though got a warning message from Vista about the rc.exe (“This program has known compatibility issues” ). When I debugged it I saw that my class that derives from CAxDialogImpl fails on its Create() method. The same application worked just fine on XP! Is there a known

qt C++ exception on basic_string destructor on double click run only

眉间皱痕 提交于 2019-12-10 11:41:34
问题 I have following code: CAtlString str = currentFolder->whatsThis().toStdWString().c_str(); currentFolder is qt QTreeWidgetItem*. When I run program from VS2010 it works ok. But when I start program by double click in the same folder (x64/Debug or Release), I have exceptions: Unhandled exception at 0x00007ffe2a07572a (ntdll.dll) in test.exe: 0xC0000005: Access violation reading location 0xffffffffffffffff. on dealloc in basic_string destructor: ~basic_string() // xstring { // destroy the

How to make WebBrowser control with transparent background?

情到浓时终转凉″ 提交于 2019-12-10 10:19:20
问题 I try to make my WebBrowser control transparent, so if the HTML loaded into it has no background, the underlying window should be visible. I`ve broke my head trying different ways. There is a transparent background in Microsoft Sidebar application. In gadget`s HTML <g:background> tag can be used, but this tag is not available in usual webBrowser control. I`ve also investigate in DirectX Transform filters, which can be applied to the HTML elements in IE, but have no success. Any help would be

“class not registered” which class?

拟墨画扇 提交于 2019-12-10 10:14:32
问题 Consider this code: try { ISomeObject pObj(__uuidof(SomeClass)); ISomeObject pObj2(__uuidof(SomeOtherClass)); } catch ( _com_error& e ) { // Log what failed } I.e. I have a block of code which instanciates my objects. Sometimes (a bad install) it failes because some class wasn't properly registered. (I don't have a particular problem, rather general discussion here.) Is there some way to, from the caught exception or otherwise, realize what class failed? A have pondered to make a wrapper of

SQL Server CE 3.5 update row error DB_E_ERRORSOCCURRED column error is DBSTATUS_E_SCHEMAVIOLATION

僤鯓⒐⒋嵵緔 提交于 2019-12-10 07:39:31
问题 I am investigating moving a small and simple SQL Server database to SQL Server CE and am currently using a small prototype to investigate basic operations with SQL Server CE with the following operations in mind: (1) programmatically create a table, (2) insert new records, (3) read existing records, and (4) update existing records. The prototype is having a problem with updating existing records when using the Accessor and the bound members of the Accessor struct. The select statement works

Detect clicking inside listview and show context menu

孤街浪徒 提交于 2019-12-09 18:51:18
问题 I have a listview created as a resource and loaded on a dialog window. I want to detect and show a context menu only when items within the listview have been clicked. MESSAGE_HANDLER(WM_CONTEXTMENU,OnContextMenu) LRESULT OnContextMenu(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { int iSelected = -1; int iFocusGroup = -1; iSelected = SendMessage((HWND)wParam, LVM_GETNEXTITEM, -1,LVNI_SELECTED); iFocusGroup = ListView_GetFocusedGroup((HWND)wParam); if( iSelected != -1 &&

关于在VS环境开发ActiveX控件不能在部分win10或者win8电脑上注册的解决方案

℡╲_俬逩灬. 提交于 2019-12-09 18:14:01
问题描述: VS2008上利用ATL(动态模板库)编写的项目ActiveX控件在部分电脑上可成功注册并运行,但部分电脑上无法注册特别是Win10环境上。 目标: 在Win7、Win8、Win10等环境下成功注册ActiveX控件。 解决方案: 通过对问题的分析,可以发现部分电脑是可以注册的,为什么部分不可以?通过了解后发现能注册的电脑是安装过VS或者安装某些软件时候自动安装了VS运行环境,那么问题可能就是这个。然后针对这个问题进行了三种方案的研究,两种方案验证可行,那么总结出问题就是运行环境问题导致不能注册,下边分别说明和比较: 方案一(存在问题) 既然项目依赖运行库,那么其它插件为什么不需要运行库,因此首先针对项目进行了研究。发现项目编译生成dll文件时,采用的是动态链接运行库文件,因此修改编译属性为静态链接后重新编译运行项目,注册成功。 属性修改方法:项目属性-》配置属性修改“C/C++/Code Generation” -》运行时库,将/MD或/MDd 改为 /MT或/MTd,这样就实现了对VC运行时库的静态链接,在运行时就不再需要VC的dll了。 /MD和/MDd:动态链接库文件,/MD为release版本,/MDd为debug版本。 /MT和/MTd:静态链接库文件,/MT为release版本,/MTd为debug版本。 结论: 经过和项目负责人确认之后