Setting up debugging environment - ASP.NET and Flex Builder

July 11, 2008 at 9:07 PMAmer Gerzic

Unlike Silverlight, Flex Builder does not integrate with Visual Studio programming environment. Therefore, debugging ASP.NET or Flex applications can become very cumbersome, especially when they become very large. However, with Flex Builder 3, Adobe has made possible to utilize built in ASP.NET web server (Cassini) to debug Flex applications. Following post describes one possible way to set up both environments to make debugging easier.

More...

Posted in: .NET | Adobe Flex | ASP.NET

Tags: , , ,

Creating and linking CLR stored procedures for SQL Server 2005

May 18, 2008 at 10:24 AMAmer Gerzic

SQL Server 2005 has been released for a while now, and most of the new features are well known throughout programming community. Right after the initial release, I downloaded a copy of SQL Server 2005 Express, eager to explore new features. At first, there was a lot of reading and browsing the documentation; then I moved onto converting smaller projects to SQL Server 2005 edition, and finally I decided to move larger projects to my new favorite DBMS. Throughout conversion process, I was poised to utilize the newest feature of SQL Server 2005: CLR Stored Procedures.
More...

Posted in: .NET | C# | SQL Server

Tags: , , ,

How to disable context sensitive help in MFC?

May 31, 2007 at 5:05 PMAmer Gerzic

Couple of days ago, I worked on an MFC application that required special functionallity of F1 key. At first, I thought that all I need is to override application's PreTranslateMessage function and trap the F1 key. However, I was wrong. Every time I pressed F1 key, the application performed custom function, but also popped message box saying that help file could not be located. My first thought was that MFC/Windows is placing a windows hook to trap such functionality and that the workaround might not be very elegant. Fortunatly that was not the case. After some investigation, I noticed the following code:

BEGIN_MESSAGE_MAP(CDRSApp, CWinApp)
    ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()

In other words, main application is getting notification to handle help request and is passing it to default MFC implementation. Once the ON_COMMAND line is commented out, such hadling is disabled.

Posted in: CPP | MFC

Tags: , , ,

Enumerating System Devices on Windows

August 11, 2006 at 5:09 PMAmer Gerzic

Occasionally an application execution depends on installed devices. For example, USB memory card might be needed for storing/reading application specific files. But how do we know that such device is inserted/installed on the system?

Below is the code that enumerates all installed devices on a windows system.

HDEVINFO hInfoList = ::SetupDiGetClassDevs(NULL, NULL, NULL,
        DIGCF_PRESENT | DIGCF_ALLCLASSES | DIGCF_PROFILE);
if(hInfoList != INVALID_HANDLE_VALUE)
{
    SP_DEVINFO_DATA spdid;
    spdid.cbSize = sizeof(SP_DEVINFO_DATA); 

    DWORD dwIndex = 0;
    while(::SetupDiEnumDeviceInfo(hInfoList, dwIndex, &spdid))
    {
        CString strEntry = _T(""); 

        TCHAR szName[4096] = {0}; 

        if(::SetupDiGetClassDescription(&spdid.ClassGuid, 
                                        szName, 
                                        4096, 
                                        NULL))
        strEntry += szName;
        strEntry += " | "; 

        if(::SetupDiGetDeviceRegistryProperty(hInfoList, &spdid, SPDRP_DEVICEDESC, 0,
            (PBYTE)szName, 4096, 0))
        {
            strEntry += szName;
        }
        
        strEntry += " | "; 

        if(::SetupDiGetDeviceRegistryProperty(hInfoList, 
                &spdid, SPDRP_FRIENDLYNAME, 0, 
                (PBYTE)szName, 4096, 0))
        {
            strEntry += szName;
        } 

        m_DevList.AddString(strEntry); 

        ++dwIndex;
    }
} 

::SetupDiDestroyDeviceInfoList(hInfoList);

Posted in: CPP | Win32 API

Tags: , , , , ,