Using Visual C++ 6.0

Link. June 15, 2007. Comments [0]. Posted in: C++ | Development

I've been spending most of my time this week back in the unmanaged world, writing C++ code again in good old Visual C++ 6.0. To make it even more fun, this was OLE DB with ATL. To be honest, took me a couple of hours to get the hang of it again, but after that my C++ started to come back more easily.

I did finally remember one of the reasons I moved off C++ to the managed code: Strings. Man, dealing with strings in C++ is just painful, even with CString, CComBSTR, _bstr_t, std:string and std:wstring at your disposal. Or maybe, that's just another reason it can be a pain in the neck. Anyway, if you find yourself writing OLE DB code again, the RowsetViewer tool in the MDAC SDK is a godsend :-).

One thing that I can say in favor of Visual C++ 6.0: The thing is freaking fast compared to Visual Studio 2005. However, I didn't remember there was no obvious way to change the font and font size, so using VC++ 6.0 on a hi-res screen isn't a particularly nice experience.

Martyn Lovell on the Secure CRT

Link. April 28, 2006. Comments [0]. Posted in: C++

There's a video posted over on Channel 9 featuring Martyn Lovell from the Visual C++ team talking about the Secure CRT. For those of you still using C++ this might be interesting...

C++/CLI with WSE 3.0 Sample

Link. March 27, 2006. Comments [1]. Posted in: .NET | Web Services | C++

I've just uploaded a new sample showing the use of WSE 3.0 from C++/CLI. The sample consists of a C++/CLI ASMX Service which allows users to upload/download files, query file information and list available files, and a simple C++/CLI Winforms client.

SimpleFileServer_Client.png The sample illustrates the following features:

  • UsernameToken-based authentication
  • Use of a simple UsernameTokenManager class for authentication (password==username)
  • MTOM use for upload/download of files between client and server

Some useful tips when creating WSE applications with C++/CLI are:

  1. To create the client-side proxy, don't use the Add Web Reference wizard in Visual Studio, instead use WSDL.EXE with the /language:CPP option and then add the generated .H file into your project. This is because you'll want to modify the generated code (to have the proxy class derive from WebServicesClientProtocol instead of the usual HttpClientProtocol), and the Add Web Reference wizard is not good for that: It actually compiles code to a separate DLL, and it also will re-generate the proxy code from the WSDL when you do a Rebuild-All.
  2. You can use policy files for both client- and server-side security policy configuration; the sample uses a very simple policy requesting UsernameToken based authentication. What you cannot do is use the WSE Settings wizard to edit the policy file directly. However, you can easily start with basic policy by copy-pasting it from the WSE documentation (watch out, errors abound!) or from one created in a sample C# project.
  3. Make sure you manually add a reference to Microsoft.Web.Services3.dll to your C++/CLI projects. You will also need to manually modify the Web.Config and app.config files to include the relevant WSE3 sections to them. For example, here's the web.config lines added for the service:

   <configSections>

      <section name="microsoft.web.services3"

         type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

   </configSections>

   ...

   <system.web>

      ...

      <webServices>

         <soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

      </webServices>

   </system.web>

 

   <microsoft.web.services3>

      <messaging>

         <mtom serverMode="always" />

      </messaging>

      <security>

         <securityTokenManager>

            <add localName="UsernameToken"

                 type="SimpleFileServer.CustomUsernameTokenManager, SimpleFileServer"

                 namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/>

         </securityTokenManager>

      </security>

      <policy fileName="policy.config"/>

   </microsoft.web.services3>

 

Hope someone finds this useful!

 

Syndicate

About

Tomas Restrepo is a software developer located in Colombia, South America. His interests include .NET, Connected Systems, PowerShell and lately dynamic programming languages. More...

tomasrestrepo @ twitter My Flickr photostream My saved links on delicious My Technorati Profile

email: tomas@winterdom.com
msn: tomasr@passport.com

View my profile on LinkedIn

MVP logo

Ads


Links

Categories

Statistics

Total Posts: 1024
This Year: 94
This Month: 1
This Week: 2
Comments: 795

Blogroll

Archive

Other

Copyright © 2002-2008, Tomas Restrepo.

Powered by: newtelligence dasBlog 2.1.8139.823

Sign In