Click here to Skip to main content
15,885,941 members
Everything / Desktop Programming / ATL

ATL

ATL

Great Reads

by Michael Dunn
A tutorial on writing a shell extension that can be used on the Send To menu.
by Michael Dunn
A tutorial on writing a shell extension that provides custom drag and drop functionality.
by Tim Smith
Color picker control for WTL applications including optional support for XP themes
by Ernest Laurentin
Full-fledged ATL Windowless ActiveX Container. Ideal for hosting Windows Media Player, Transparent Flash and Silverlight Animations.

Latest Articles

by Javad Taheri (drjackool)
Show or hide, reorder, save and restore list view column headers
by Shivprasad koirala
This blog will discuss the difference between server.transfer and response.redirect.
by Nick Pirocanac
Linker errors due to CStringT template classes and ATL vs. MFC issues
by Midi_Mick
Using ATL and STL to create collections of COM objects without circular references

All Articles

Sort by Score

ATL 

26 May 2006 by Michael Dunn
A tutorial on writing a shell extension that can be used on the Send To menu.
24 May 2006 by Michael Dunn
A tutorial on writing a shell extension that provides custom drag and drop functionality.
13 Jun 2002 by Tim Smith
Color picker control for WTL applications including optional support for XP themes
5 Mar 2009 by Ernest Laurentin
Full-fledged ATL Windowless ActiveX Container. Ideal for hosting Windows Media Player, Transparent Flash and Silverlight Animations.
25 Sep 2008 by Rajesh R Subramanian
Of all your questions I've attempted, this is the toughest one, Christian.First off, .NET and C++ (I will say only C++ in this message. But, When I say C++, include the frameworks and libraries built on and around it - MFC, ATL, WTL, etc.,) are...
16 Jul 2002 by soptest
How MS implements them and why they do not want you to see the source code of those functions.
14 Oct 2009 by Alex Blekhman
Example of handling real-life challenges when hosting WebBrowser control: separate creation of hosting window and the control, keyboard shortcuts, control's dimensions, etc.
8 May 2005 by Brian C Hart
We build our new server and install it on the server machine.
29 Dec 2006 by Michael Dunn
How to use power status notifications to make your applications conserve power when necessary.
29 Jun 2009 by Michael Dunn
Create custom tasks in your app's jump list on Windows 7
30 Jul 2002 by Vagif Abilov
Guidelines to migrate ATL-based Windows service application to Visual C++.NET
4 Jun 2001 by Leon Finker
Describes how to add various Microsoft Management Console UI items using ATL
13 Sep 2012 by Wendelius
This is an alternative for "SQL Server: Query to find upcoming birthdays for the current week"
11 Aug 2000 by Brian C Hart
We look at connection points and set up the server's end of one. We'll also finish implementing our SayHello() method.
18 Sep 2003 by Zac Howland
An article on using component categories to create pluggable components
13 Aug 2009 by Stuart Dootson
The way I'd approach it is like this:1. Define functions that return random voewls and random consonants - here's a random vowel function:char RandomVowel(){ const char vowels[] = {'a', 'e', 'i', 'o', 'u'}; // Use rand() to get a number...
1 Sep 2009 by PARK Youngho
A tool that enumerates all fonts installed on Windows, and shows you the preview so as to help you code conveniently.
12 Oct 2009 by Jörgen Sigvardsson
In addition to what Stuart said, if you really don't want to change the function signature from floatto double, you can always use literals that are typed as float. If you add the suffix f to the floating point numbers, they will be typed float.Your examples would then be function(1.2f, 2f) and func
8 Apr 2009 by joseangelmt
We are going to enable your application to write entries in HKEY_LOCAL_MACHINE, elevating your application when necessary.
22 Aug 2008 by Perspx
I don't know about removing power but you can lock volumes with DeviceIoControl() with the FSCTL_LOCK_VOLUME which means that your process has exclusive access to that volume. Take a look at the documentation here. You could do this with the CD...
17 Oct 2009 by Rajesh R Subramanian
hanlei0000000009 wrote:I need my program sleep 1 microsecond, but Sleep() can not do this.Neither can any other API do this (under Windows). Windows was never designed to provide this kind of functionality (it is not a real-time OS). If you use something like Sleep(2), your program may sleep for 2 m
27 Jun 2001 by Rashid Thadha
An outlook control and framework that can be used in your WTL Application
3 Apr 2001 by Michael Dunn
This article shows how to add your own pages to Control Panel applets by writing a property sheet handler.
11 Jul 2002 by Pavel Kobyakov
A DevStudio add-in described provides two interesting IDE integration features: adding a new tab to VC WorkspaceView window and running an arbitrary process under IDE with output sent to "Build" tab of VC Output window.
22 Aug 2008 by Jijo.Raj
ameyakoshti wrote:1st of all i want to know whether it is possible to disable usb portsTo disable USB ports, check this[^]. You have to programatically access the registry and set the key.ameyakoshti wrote:and CD rom "POWER" through VC++.I hope...
30 Jan 2009 by CPallini
"text && text" If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.This is going on my arrogant assumptions....
11 Aug 2000 by Brian C Hart
Here we add a method to our DCOM-remoted object, and start on implementing its functionality.
18 Apr 2001 by Erik Thompson
Create an ATL Server to generate random tips using a Server Response File
27 Aug 2001 by George Anescu
A context menu handler shell extension for extracting icons from .exe and .dll files
28 Jul 2003 by Katasonov
Easiest way to add XML persistence to an existing IDispatch based ATL COM object.
30 Sep 2002 by Ernest Laurentin
Shows how to use Microsoft Script Hosting inside existing ATL/WTL Application
22 Aug 2008 by vikas amin
its simple by modifying the registery , check this linkhttp://forums.msdn.microsoft.com/en-US/vcgeneral/thread/15469774-bd67-4bed-b797-32a899eb79d3[^] Vikas AminMy First Article on CP" Virtual Serial Port "[^]modified on Thursday, July 24, 2008...
2 Aug 2009 by «_Superman_»
In an executable, there must be one entry point that can be called by the loader, runtime etc.There cannot be any ambiguity here.That is why we can have only one main function in a console program and only one WinMain function in a windows...
8 Aug 2009 by David Crow
See here. "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." -...
13 Feb 2009 by «_Superman_»
SetEndOfFile can be used to extend or truncate a file. «_Superman_»
26 Feb 2010 by Eugen Podsypalnikov
There are two steps:// Set WS_EX_LAYERED on this window SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);// Make this window 70% alphaSetLayeredWindowAttributes(hwnd, 0, (255 * 70) / 100, LWA_ALPHA);Here is only one variable hwnd - handle...
5 Aug 2000 by Konstantin Boukreev
Describes an ActiveX Control to use OLE Automation to set an object's properties.
22 Apr 2009 by Stuart Dootson
Use std::inserter[^] or std::back_inserter[^] for the output iterator. That causes the items to be inserted into the container without having to know what size it should be before you've constructed it.If you're using a vector or list as the...
3 Aug 2008 by hoxsiew
int count; // Loop counter variableint correct;char correct_answers[count] = {B, D, A, A, C, A, B, A, C, D, B, C, D, A, D, C, C, B, D, A}This can only cause problems. correct_answers[count] should probably be correct_answers[NUM_QUESTIONS] since...
1 Aug 2009 by Bacon Ultimate Cheeseburger
Simply make a call to GetObjectType().
13 Aug 2009 by Stuart Dootson
Using Spy++ on a sample application I just built, it would seem that instead of edt1, you now want to use cmb13 (0x47c). I guess they decided that as that field is (now) actually a combo-box, that would be a better ID to use. Java, Basic, who...
13 Oct 2009 by Cedric Moonen
No, you can't select the type of the class this way. However, by using pointers (or references), you can manipulate all buildings the same way by manipulating pointers to the base class (this is called polymorphism, google for it if you want more information).What you want are virtual constructors,
5 Feb 2013 by Gokulnath007
To get instant control over Outlook and various operations of outlook.
30 Nov 1999 by Gerolf Reinwardt
An article that discusses drawing a control at designtime
16 Apr 2001 by Igor Sukhov
The ATL and MFC versions of the class that implements a dialog for selecting users(computers) within the Windows Network.
19 Dec 2008 by Stuart Dootson
I think you need to add the WTL include directory to the include directory path for the resource compiler. Right-click on the project, select 'Properties', select Resources->General in the properties window and add the WTL include directory to...
21 Apr 2009 by liquid_
How to compute difference and intersection of two sets?There are functions set_difference and set_intersection which requires two pairs of iterators of source sets and output iterator of resulting set. Here, set can be any sorted container with...
22 Sep 2008 by Christian Flutcher
I am progressing with my C++ learning. I am stuck with the following code. void ChangeData(int** ptr){ int ab = 1000; // scope in this method *ptr = &ab;}int _tmain(int argc, _TCHAR* argv[]){ int a = 10; int* aPtr = &a; ChangeData(&aPtr); cout...
22 Sep 2008 by Russell'
The variable is destroyed, but not the contents.You know the abbress s you can continue to check it's value...but, as you sad, it is wrong, so do not do it. The system can use the same locatio of that variable in any moment after that the...
22 Sep 2008 by Cedric Moonen
Christian Flutcher wrote:I am confused how this is happening?Because you were lucky (or in your case, not ). In your ChangeData function, your local variable has a certain address which you store in your ptr variable. When the function exits,...
10 Oct 2008 by led mike
Gut Mikh Tappe wrote:Please let me know what to do Ok I will try. What you need to do is read the documentation.[^]Also reading this might help as well.[^]In my experience not all authors match every reader. So if you find reading those sources...
10 Dec 2008 by Kiran Pinjala
Hi,I have creted a MFC SDI project in VC 2008 and compiled in Vista OS. Now when i copied the project into XP OS system and opened. I can open all views(class view, solution explorer...) but the resource view...it is showing a MessageBox statingA...
29 May 2009 by «_Superman_»
Call GetLogicalDrives to get all the available drive letters.Call GetSystemDirectory to get the drive which contains the OS.Open the volume using CreateFile("\\.\C:", ...Here replace C: with the drive letter returned in GetSystemDirectory.Call...
1 Jul 2009 by David Crow
Caslen wrote:If it is my problem is there anyway to detect programatically whether a file is already open somewhere else?Open it exclusively. All other attempts will fail. "Old age is like a bank account. You withdraw later in life what you...
1 Aug 2009 by «_Superman_»
OnCreate is called just when the application requests that the Create function be called. So it is not guarenteed that the window is fully created. OnInitDialog is called after the window (in this case the dialog) is completely created.When you...
16 Oct 2009 by Stuart Dootson
Yeah, that's not happening...Why 1 microsecond, FFS? What are you trying to do? Because there may well be a better way.
3 Apr 2009 by David Crow
The union looks something like this:-----------------------| 512 |-----------------------| 00000010 | 00000000 |-----------------------| 2 | 0 |----------------------- "Old age is like a bank account. You withdraw...
21 Jan 2010 by Jast_in
You need to add a message handler to your button: ON_BN_CLICKED( BUTTON_ID, OnBtnClick )And, of course a function for that:afx_msg void ClassName::OnBtnClick(){MessageBox( "Some test text" );}I just tried it in my BHO for IE... works fine!
22 Jan 2010 by Jast_in
Add this 2 blocks to your class source file:BEGIN_MESSAGE_MAP(YourClassName, YourBaseClass)ON_BN_CLICKED( BUTTON_ID, OnBtnClick )END_MESSAGE_MAP()afx_msg void YourClassName::OnBtnClick(){MessageBox( "Some test text" );}Add this line to your class header...
16 Oct 2010 by Aescleal
If you're using C++ there's no reason to use printf or the whole god awful family of C relics. Use a stream. Then you get type safety and you won't try reading return addresses off the stack to interpret as strings. Consider rewriting along the lines of:int main(){ int d = 20; ...
25 Mar 2011 by Nuri Ismail
Have a look at this[^] nice CP Tip/Trick. TCHAR is well explained there. :)
25 Mar 2011 by mbue
For the first: TCHAR is not a type themselves - its a placeholder for the character type you use. This can be:* unicode characters (unsigned short or wchar_t)* ANSI characters (char).this depends on your project settings. You can plan your module to support both of them. Therefore you have...
6 Oct 2012 by Briti Sundar
May be you have missed to malloc first before insert into MyArray.MyDataStructure* pNewStruct;pNewStruct =(MyDataStructure* )malloc(sizeof(MyDataStructure));MyArray.Add(pNewStruct);Hope this will work.
5 Mar 2013 by jan.mach71
A small tool listing Administrators group members recursively using the ActiveDS library.
12 Aug 2000 by Paul Shaffer
An article on ATL COM event connection point threading issues
28 Aug 2001 by Adrian Bacaianu
This article shows how to make one ATL COM component with crypt/decrypt functions and how to use it in ASP programs. It shows also how to register a component in MTS.
19 Dec 2008 by josip cagalj
Hi to all. I'm trying to open some project wroted using WTL. When I try to rebuild it (using VS2008 on Win XP) I get the compile error as above. Now, "atlres.h" file is in directory which I added to my project settings properly and I don't know...
26 May 2009 by followait
I tried as below, but ostream cannot be instantiate?ifstream ifs1("file1");ifstream ifs2("file2");ostream oss;oss
26 May 2009 by Stuart Dootson
ostream is an abstract base class - that's why you can't instantiate it. Also, you can't use the insertion operator on streams to get what you're wanting.So...what do you mean by "memory binary stream"? If you were using strings, then this should...
15 Oct 2010 by fantasy1215
Please run the code below.int main(int argc, char* argv[]){ int ii = 20; char tmp[32] = "loveing"; printf("[%d]hello[%s]\n", tmp); //no integer fill the %d format char szData[52] = {0}; sprintf(szData, "[%d]saying [%s]\n",ii);//no string fill the %s format printf("%s", szData); return 0;}The...
9 Sep 2008 by SandeepNK
Sample code is as follows:class TestClass{CCriticalSection m_csTest;void Fun1() { m_csTest.Lock(); Fun2(); MessageBox("In Fun1 critical section."); m_csTest.Unlock();}void Fun2(){ m_csTest.Lock(); MessageBox("In Fun2 critical...
25 Sep 2008 by Christian Flutcher
I know .NET framework and C# well. Recently I started working with C++/CLI which I felt more interesting than C#. Since .NET framework is becoming popular, do you think MFC got obsolete? Are you guys doing any projects in MFC other than...
10 Oct 2008 by Mark Salsbery
In addition to super_ttd's reply...If you must use fopen(), then you should probably use a CStringA.CString has a generic internal character type, depending on whetherUNICODE or _UNICODE is defined.If you want to use the generic text CString,...
7 Jan 2009 by CPallini
I suppose it depends on color depth... See BITMAP struct definition [^], the bmBitsPixel member looks promising. If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. ...
8 Jan 2009 by Code-o-mat
Take a look at this[^], might be usefull. > The problem with computers is that they do what you tell them to do and not what you want them to do.
8 Jan 2009 by Hamid_RT
OR see CRichEditControl50W - A VC++ Rich Text Edit 4.1 MFC Control[^]. Of one Essence is the human racethus has Creation put the baseOne Limb impacted is sufficientFor all Others to feel the Mace(Saadi )
27 Jan 2009 by Garth J Lancaster
1) this sounds like homework - we dont do homework - at best we will give you hints, but if you're expecting us to jump in and solve all your issues, go to RentACoder or such 2) DONT GET IMPATIENT AND POST MORE THAN ONCE - most of us here have...
22 Jun 2009 by Stuart Dootson
Member 4399131 wrote:I assumed that the problem isn't in my coding technique, it must be generally in the algorithm I use!!!Yep.Member 4399131 wrote:Does somebody know a better algorithm to implement FindOneOf???Looking at their code (strpbrk -...
2 Aug 2009 by CPallini
Because there is only one application in your application... If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of...
6 May 2010 by sashoalm
Here's my try:#include using namespace std;int main(int argc, char* argv[]){ string name; static const int namelen = 15; static const char* letters[2] = { "bcdfghjklmnpqrstvwxyz", "aeiouy" }; static const letterlen[2] = { strlen(letters[0]), strlen(letters[1])...
13 Aug 2009 by softwaremonkey
Hi,In an older (MSVC++6.0) project I used HideControl(edt1) to hide the filename edit control in a CFileDialog derrived class, which worked fine at the time.When I compile this project with MSDEV2008, the code complies OK but control is no longer...
13 Aug 2009 by Stuart Dootson
Could you do all of the automation, including creation of the Word object, on the worker thread?Basically you're running foul of COM single-threaded apartments and things, I think. This article[^] explains them well. Java, Basic, who cares - it's...
31 Aug 2009 by Moreno Airoldi
Consider this as a rough idea:#include void PrintArrayClockwise(int *array, int rows, int columns){ int r = 0; int rh = rows / 2; int i; while (r
15 Aug 2009 by Stuart Dootson
birajendu wrote:I want to write some code which will double click a desktop shortcut. or the alternate way is how can i run a desktop shurtcut using Createprocess() api.If you know the path to the desktop shortcut, then you should be able to use...
16 Aug 2009 by David Crow
The SetActivePage() method looks promising. "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown"Fireproof doesn't mean the fire will never come. It means when the fire comes that you...
15 Jul 2008 by CPallini
1.From the same article, below your quoted sentence.The LEA instruction uses hardwired address generation tables that makes multiplying by a select set of numbers very fast (for example, multiplying by 3, 5, and 9). Twisted, but true.That means...
13 Mar 2009 by Cedric Moonen
Which kind of string ? C style strings ? Then use strcat. std::string ? Then use the + operator. Cédric MoonenSoftware developerCharting control [v1.5]OpenGL game tutorial in C++
10 Mar 2009 by Iain Clarke, Warrior Programmer
I've just noticed you posted the same question four hours before. You really should have more patience! People volunteer to answer these questions. Asking the same one again in a short time is not helpful to you...Iain. Codeproject MVP for C++, I...
10 Oct 2008 by Maximilien
George_George wrote:I am developing for both x86 and x64. I stop mouse on size_t in the code, and "typedef unsigned int size_t" is always displayed. I think it is not correct for x64. Since x64 size_t is 64-bit and unsigned int on x64 is 32-bit....
10 Oct 2008 by Chris Losinger
from io.h (and crtdefs.h)#ifndef _SIZE_T_DEFINED#ifdef _WIN64typedef unsigned __int64 size_t;#elsetypedef _W64 unsigned int size_t;#endif#define _SIZE_T_DEFINED#endif image processing toolkits | batch image processing
23 Feb 2010 by Eugen Podsypalnikov
Why should it be impossible ? :)class B;class A{...public: A(B* pB);...--When you will have to transport class instances by an interface -you could define a function like TakeData(IStream* pStream) :) The caller could create an IStream associated with...
3 Apr 2010 by Rod Kemp
To learn how to create plug-ins for Windows Media Player, see the Windows Media Player SDK[^].This should outline what you can and can't do with a plug-in in WMP.
27 May 2010 by Aescleal
If you're programming in C, then:strncpy( q, p, 499 );q[499] = '\0';will do the trick and work however long the string is. If you'd like to obfuscate things a bit more then you can combine the two lines into one by exploiting the return value of strncpy:strncpy( q, p, 499 )[ 499 ]...
31 May 2010 by Anu Koshy
if it is a text control, set "No Prefix" as True.That should solve the problem. :)
14 Jun 2010 by Paul Heil
Using the RAPI2 interface safely and effectively.
3 Aug 2010 by Jörgen Sigvardsson
You need to marshal calls across threads/apartments. See this[^] article for different ways to perform cross thread marshalling. CoMarshalInterThreadInterfaceInStream() would probably be the easiest approach. Look it up in the MSDN documentation. It's quite easy to use.
28 Jul 2011 by Manjuke Fernando
Using Update Cursors in SQL Server
5 Aug 2012 by Anna-Jayne Metcalfe
Theme support in Visual Studio 2012
17 Jan 2000 by Shaun Wilde
A wizard that allows you to create an ATL Property Page or Context Menu extensions