atl

Implementing ActiveX Control for web browser

大城市里の小女人 提交于 2020-01-07 08:32:26
问题 My requirement is to develop a ActiveX control which can send the byte stream to serial port. The ActiveX control should expose only one function like SendData(char* data, int nLen, int nPort) This function should be able to be invoked by pressing a button developed in java rendered in Internet Explorer(both 32 and 64 bit). I am confused whether i should go with windowless ActiveX control using MFC/ATL or Browser Helper Objects. In future i may need to support Firefox also. Any help will be

Avoiding disconnected context warning when shutting down a thread on which STA COM objects have been created

删除回忆录丶 提交于 2020-01-06 04:38:07
问题 I am working on a COM API written in C++ with ATL, which clients will be expected to use in C# via it's COM interop facilities. Currently all the COM objects are only written to support the single threaded apartment model. Some of the functions of this API cause a separate worker thread to be spawned, which listens for events from a server. In response to events from the server this worker thread creates some fairly simple COM objects, and then passes these objects to a COM event. There are

What decides whether RegisterTypeLib writes to win32 or win64?

断了今生、忘了曾经 提交于 2020-01-05 15:06:53
问题 I am working with two ATL-based COM projects. The both implement DllRegisterServer as just STDAPI DllRegisterServer(void) { // registers object, typelib and all interfaces in typelib return _Module.RegisterServer(TRUE); } which ends up calling ::RegisterTypeLib(pTypeLib, bstrPath, szDir); in atlbase.h:6516. But for some reason this call makes one of the projects create HKEY_CLASSES_ROOT\TypeLib\<guid>\<version>\0\win64 when registered using regsvr32.exe on Windows 7 32 bit. The other project

Can't get the handle of a Cwnd Class in MFC Windowless Activex?

╄→гoц情女王★ 提交于 2020-01-05 12:23:14
问题 I have asked two questions earlier about this and for each post there was some solutions i tried them, but the problem still exist. My first question was : why a windowless Activex does not return the Handle. the suggestion was "change the creation setting an make windowless activate off, i have tried it but still m_hWnd property has returned zero as GetSafeHwnd() method has did. the second one was the same question this one focused on COleControl class and it's ancestor CWnd. the solution

GetModuleHandleEx usage example. WTL internationalisation

本秂侑毒 提交于 2020-01-05 04:29:07
问题 I am trying to do internationalization in a WTL GUI application .. in my drop down selection change handler (which is used for language selection I do something like this): int selected = (int)::SendMessage(m_cbLang, CB_GETCURSEL,0,0); HMODULE hmod; int retCode = 0; switch(selected) { case 0: retCode =::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_PIN, NULL, &hmod); ATL::_AtlBaseModule.SetResourceInstance(hmod); break; case 1: retCode =:

Which VC++ runtime version do I choose - static or dynamic?

家住魔仙堡 提交于 2020-01-04 05:05:00
问题 I'm developing a 64-bit in-proc VC++ ATL COM server that basically just redirects all calls to an out-proc COM server. So my COM server basically does nothing. Initially it used the C++ runtime in a DLL ( /MD compiler switch). I've noticed that when I deploy it on a clean 64-bit Win2k3 regsvr32 fails with an error: LoadLibrary({fileName}) failed – This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. Google

c++ How to get a COM object Coclass's progid at runtime

本小妞迷上赌 提交于 2020-01-04 04:40:13
问题 I need to write a function that dynamically extracts the progid from a COM object. Is this possible? What's the best way to do it? EDIT: All the coclasses I need to process implement IProvideClassInfo 回答1: First of all, there is no guarantee the information is available in first place. Even if you just instantiated an object using ProgID, you might be unale to get it back. The easiest is to query one of IPersist and friends ( IPersistStream etc.) interfaces, and call IPersist::GetClassID to

Does ATL/WTL still require the use of a global _Module variable?

自闭症网瘾萝莉.ら 提交于 2020-01-02 05:33:06
问题 I'm just starting up a new ATL/WTL project and I was wondering if the global _Module variable is still required? Back a few years when I started working with WTL it was required (at least for ATL 3.0) that you define a global variable such as: CAppModule _Module; To get ATL to work correctly. But recently I've read somewhere that this may not be required anymore (yet the wizard generated code still uses it). Also I did a search through the Visual C++ include directories and it only picked up

ATL COM class registration .rgs file defaults

旧巷老猫 提交于 2020-01-02 03:11:07
问题 I'm creating a COM server executable, and have run into a problem with class registration. When I created my class object, the automatically generated .rgs file looked like this: HKCR { NoRemove CLSID { ForceRemove {4C6DAD45-64B4-4C55-81C6-4CE125226421} = s 'Test Class' { ForceRemove Programmable LocalServer32 = s '%MODULE%' { val ServerExecutable = s '%MODULE_RAW%' } TypeLib = s '{EAA173CA-BDBC-463A-8B7A-B010EFA467BC}' Version = s '1.0' } } } This created the registry entries correctly for

ATL COM class registration .rgs file defaults

落花浮王杯 提交于 2020-01-02 03:11:01
问题 I'm creating a COM server executable, and have run into a problem with class registration. When I created my class object, the automatically generated .rgs file looked like this: HKCR { NoRemove CLSID { ForceRemove {4C6DAD45-64B4-4C55-81C6-4CE125226421} = s 'Test Class' { ForceRemove Programmable LocalServer32 = s '%MODULE%' { val ServerExecutable = s '%MODULE_RAW%' } TypeLib = s '{EAA173CA-BDBC-463A-8B7A-B010EFA467BC}' Version = s '1.0' } } } This created the registry entries correctly for