Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
SQL Server

Home >Search > Articles & Samples > Visual C++ .NET
What's New - What's Hot
Listings for AddIns AddIns (422)
Listings for Attributes Attributes (5)
Listings for Class Libraries Class Libraries (216)
Listings for Collection Collection (25)
Listings for Compiler Compiler (24)
Listings for Component Component (80)
Listings for Controls Controls (689)
Listings for DataBase DataBase (158)
Listings for Debugging Debugging (164)
Listings for Email Email (16)
Listings for Error Handling Error Handling (5)
Listings for Event Handling Event Handling (15)
Listings for Exception Handling Exception Handling (53)
Listings for FAQ FAQ (63)
Listings for File Management File Management (145)
Listings for Graphics&Chart Graphics&Chart (437)
Listings for Language Reference Language Reference (79)
Listings for Miscellaneous Miscellaneous (1175)
Listings for OOP OOP (529)
Listings for Performance/Optimization Performance/Optimization (83)
Listings for PlugIns PlugIns (48)
Listings for Regular Expression Regular Expression (47)
Listings for Sample Programs Sample Programs (1827)
Listings for Security Security (107)
Listings for Socket Programming Socket Programming (152)
Listings for Threading Threading (325)
Listings for Tips & Tricks Tips & Tricks (430)
Listings for Type Casting Type Casting (4)
Listings for Web Services Web Services (69)
Listings for Windows Form Windows Form (156)
Listings for XML XML (77)

Sizing Windows for Text Strings, Creating Nonrectangular Windows, Activating an Open Document     
Total Hits: 55  |  Today: 0Author: Paul DiLascia      Rating:  
Read Reviews | Write Review |  Your Rating: 

Based on the contents of a text file, I dynamically create con-trols in a subclass of CWnd. Using the following code in my Create method, I managed to create all the controls based on the message font the user selected in the Display Properties dialog. Now that I have the font, how can I determine what the height and width of the static control should be so that the text will be displayed in full?
First of all, just so everyone knows what Werner is talking about, the Display Properties dialog...

Prevent Users from Performing Normal GUI Operations     
Total Hits: 47  |  Today: 0Author: Paul DiLascia      Rating:  
Read Reviews | Write Review |  Your Rating: 

I'm working on a Visual C++® SDI project where I have two splitter windows (form views) within my main frame. Is there a way to keep the user from moving and resizing the frame window and child windows while maintaining a title bar in each?
I feel so sorry for users sometimes; programmers are always trying to protect users from themselves, preventing this or that normal GUI operation. It annoys me to no end when some program prevents me from sizing the window or using cut or paste or otherwis...

CD Burning and Device Discovery with IMAPI     
Total Hits: 83  |  Today: 0Author: Paul DiLascia      Rating:  
Read Reviews | Write Review |  Your Rating: 

I read your January 2004 column about getting the drive letter and about using the GetDriveType function to find out if a disk drive is a CD (DRIVE_CDROM), but how can I know if the CD drive is a recording device? Also, how do I write files to a recordable CD? Windows® XP lets you drag and drop files using Windows Explorer to write files to a CD. Can you tell me if there is a way I can do this from my program without requiring my users to purchase third-party software such as Nero or Roxio? Are ...

Get the Main Window, Get EXE Name     
Total Hits: 59  |  Today: 0Author: Paul DiLascia      Rating:  
Read Reviews | Write Review |  Your Rating: 

How can I find the main window for a process? I'm writing a Spy-like tool and I need to get the main window (HWND) for a process so I can send it a message like WM_ACTIVATEAPP. Which main window do you mean? A process can have more than one. Microsoft® Outlook® is a good example. If you start Outlook, you get a window listing your Inbox and other folders. If you open e-mail, you get another window that displays the message. Both are main windows in the sense that they have no parent or owner. If...

Inline Virtual Functions, AVI Files in EXEs, and the DynPrompt Sample App     
Total Hits: 51  |  Today: 0Author: Paul DiLascia      Rating:  
Read Reviews | Write Review |  Your Rating: 

How does C++ handle inline virtual functions? When a function is inline and virtual, will code substitution take place or is the call resolved using the vtable?
The answer is, it depends. To see why, let's consider each case—inline and virtual—separately. Normally, an inline function is expanded, well, inline....

Enabling Menus in MFC Apps, Changing the Behavior of Enter with DLGKEYS Sample App     
Total Hits: 55  |  Today: 0Author: Paul DiLascia      Rating:  
Read Reviews | Write Review |  Your Rating: 

I'm trying to enable and disable the menus in my MFC app. I call CMenu::EnableMenuItem with the main menu and proper flags (MF_ENABLED), but nothing seems to happen. My menu item is always enabled. How do I disable the menu items?
There must be something contagious in the air because all of a sudden I keep getting questions about how to enable menu items. Perhaps a slew of new MFC programmers has recently entered the programming community....

Call Unmanaged DLLs from C#, Killing Processes Cleanly     
Total Hits: 73  |  Today: 0Author: Paul DiLascia      Rating:  
Read Reviews | Write Review |  Your Rating: 

How do I call a DLL or Win32® API function from my C# code if the function has a string (char*) output parameter? I can pass a string for an input parameter, but how do I get the returned string? Also, how do I call functions that require a struct or a callback, like GetWindowsRect and EnumWindows? I'm trying to convert from C++ and MFC, and I can't cope!
One of the major benefits of Microsoft® .NET is that it provides a language-independent development system. You can write classes in Visual...

Initializing C++ Class Members and Incorporating the Places Bar in your MFC Apps     
Total Hits: 64  |  Today: 0Author: Paul DiLascia      Rating:  
Read Reviews | Write Review |  Your Rating: 

Technically your friends are right, but in most cases it makes no difference. There are two reasons to use the second syntax, which is called a member initialization list: one is necessity, the other efficiency.
Let's examine the first reason—necessity. Suppose you have a class member that is itself a class or struct, and this class only has one constructor that requires an argument. Since CMember has an explicit constructor, the compiler does not generate a default constructor (one with no a...

Write Faster Code with the Modern Language Features of Visual C++ 2005     
Total Hits: 195  |  Today: 0Author: Stephen Toub      Rating:  
Read Reviews | Write Review |  Your Rating: 

The introduction of the Visual Studio® .NET 2003 C++ compiler was a mouthwatering experience for enthusiasts of the C++ language. With 98 percent conformance to the ISO C++ standard, Visual C++® .NET 2003 was truer to these standards than any previous version and incorporated language support for features such as partial template specialization. It also included enhanced buffer security checks and improved compiler diagnostics. C++ developers joined the ranks of developers using C# and Visual Ba...

ATL Virtual Functions and vtables     
Total Hits: 50  |  Today: 0Author: Paul DiLascia      Rating:  
Read Reviews | Write Review |  Your Rating: 

I've noticed that many of the classes in the ActiveX® Template Library (ATL) are declared with ATL_NO_VTABLE, which expands to __declspec(novtable). The documentation for __declspec(novtable) says that this prevents the vtable pointer from being initialized in the class's constructor and destructor, but I don't really understand what that means and why it's important. Can you explain?
Well, I can try. As with anything, to understand what __declspec(novtable) is all about, you have to understa...

Typename, Disabling Keys in Windows XP with TrapKeys     
Total Hits: 87  |  Today: 0Author: Paul DiLascia      Rating:  
Read Reviews | Write Review |  Your Rating: 

Can you explain the purpose of the typename keyword in C++? When should I use it instead of ? Is there some difference between the two?
The short answer is that typename and class are synonymous at the start of a template definition, but sometimes you need the typename to tell the compiler that a symbol in a template represents a type name. Find furhter details and many other answers of your queries, Read on to learn more!...

Displaying a JPG in your MFC Application     
Total Hits: 148  |  Today: 0Author: Paul DiLascia      Rating:  
Read Reviews | Write Review |  Your Rating: 

Sometimes programmers who use Visual Basic® seem to have it so easy. Just plop a picture control in your form and awaaay you go...while C++ programmers have to fret and strut. What are we supposed to do, write our own JPG decompression functions?
Of course not! In fact, C/C++ programmers can use the very same (almost) picture control their Visual Basic counterparts use. I kid you not. The Visual Basic picture control is based on a system COM class, IPicture (see Figure 1). IPicture manages a ...

Programming Windows Forms with Managed Extensions for C++     
Total Hits: 154  |  Today: 0Author: Chris Sells and Sam Gentile      Rating:  
Read Reviews | Write Review |  Your Rating: 

Programmers have a long history of developing Windows® GUI applications using C and C++. For many of us, this history dates back to the Windows 2.0 days when we used the C-based 16-bit Windows API and it took tens of lines of code just to display a window. Fortunately, as the years have gone by, the level of abstraction has gotten higher and better. In 1992, Microsoft released the Microsoft Foundation Class Library version 1.0 as part of the Programmer's Workbench. The Microsoft Foundation Class...

Building Managed Resources from Win32 Resources     
Total Hits: 111  |  Today: 0Author: Grant Bolitho      Rating:  
Read Reviews | Write Review |  Your Rating: 

Resources within .NET — based applications are stored in a different format and accessed in a different manner than a traditional Windows application. This article examines a technique and supplies a command line utility that can be used to convert resources in the Win32 Resource Compiler script format to a .NET resource file and then build it into a managed assembly with embedded resources. In traditional Windows applications, resources are often embedded into Win32 DLLs using the Resource Comp...

Hello World in Managed Extensions for C++     
Total Hits: 113  |  Today: 0Author: MSDN      Rating:  
Read Reviews | Write Review |  Your Rating: 

In Managed Extensions for C++, the #using directive is similar to the #import directive, which is used to incorporate information from a type library. Note that these are different from the #include directive, which is for incorporating source code rather than prebuilt libraries. Also, to import the namespace into the program — in other words, to make it convenient to reference System objects without having to fully qualify their paths —....

Compiler Security Checks In Depth     
Total Hits: 25  |  Today: 0Author: Brandon Bray      Rating:  
Read Reviews | Write Review |  Your Rating: 

Software security is a major concern for the high-tech industry, and the most feared and misunderstood software vulnerability is the buffer overrun. Today, the mention of a buffer overrun is enough to make people stop and listen. All too often, the technical details get lost in the transcription, and the general public comes away with a rather alarming view of a rather fundamental problem. To address this problem, Visual C++ .NET introduces security checks to assist developers in identifying buf...

Solution to Travelling Salesman Problem     
Total Hits: 209  |  Today: 0Author: omkar joshi      Rating:  
Read Reviews | Write Review |  Your Rating: 

Hereby, I am giving a program to find a solution to a Traveling Salesman Problem using Hamiltonian circuit, the efficiency is O (n^4) and I think it gives the optimal solution. Though I have provided enough comments in the code itself so that one can understand the algorithm that I m following, here I give the pseudocode....

How to handle document events in a Visual C++ .NET application     
Total Hits: 75  |  Today: 0      Rating:  
Read Reviews | Write Review |  Your Rating: 

This step-by-step article discusses how to handle document events for the WebBrowser control in Visual C++ .NET 2003. This information also applies to handling document events in Visual C++ .NET 2003 when you automate Internet Explorer....

How to prevent the OLE Server Busy dialog box from appearing during a lengthy COM operation     
Total Hits: 81  |  Today: 0      Rating:  
Read Reviews | Write Review |  Your Rating: 

If you call a method on a COM server from an MFC COM client application and if the method takes a long time to process and return back, you won't be able to do anything on the client application and the OLE Server Busy dialog box pops up. This article explains how you can increase the time-out period of the COM call and also shows you how to avoid this dialog box....

Owner-Draw Menus with .NET and Managed C++     
Total Hits: 114  |  Today: 0Author: Developer      Rating:  
Read Reviews | Write Review |  Your Rating: 

This article illustrates just how easy it is to owner-draw a menu item using .NET and Managed C++.
First, it presents the steps for creating an owner-draw menu and shows how to implement those in your application. The second section then shows you how to use the simple, yet effective, owner-draw menu class that accompanies the article. That way, if you're in a hurry, you can simply plug the class into your application now and go back and read the code at your leisure....

Disclaimer - Privacy
© 2002-2017