Feedback wanted - DispHelper

This is a discussion on Feedback wanted - DispHelper within the A Brief History of Cprogramming.com forums, part of the Community Boards category; DispHelper aims to allow Windows C/C++ programmers to use COM objects in a simple, script like manner. If anyone wants ...

  1. #1
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544

    Feedback wanted - DispHelper

    DispHelper aims to allow Windows C/C++ programmers to use COM objects in a simple, script like manner.

    If anyone wants to try it out or give feedback feel free. Suggestions, criticisms, bugs, crushing silence, you know the sort of thing.

    Download DispHelper Version 0.75(BETA) - 90KB

    The following samples are provided. All samples can be compiled as C or C++.

    word.c
    Demonstrates outputting formatted text to a Word document and getting user feed back with the help of the office assistant. Demonstrates using Word as a spell checker.

    excel.c
    Demonstrates outputting formatted data to Excel and using it to create a chart. Demonstrates using a safe array to efficiently insert data into Excel.

    email.c
    Demonstrates sending an email with CDO, Outlook and Eudora.

    ado.c
    Demonstrates reading and manipulating data from a data source using ActiveX Data Objects.

    corel.c
    Demonstrates outputting formatted text to a WordPerfect document.

    speech.c
    Demonstrates using Microsoft Agent and SAPI to provide text-to-speech.

    MSHTML.c
    Demonstrates ui-less html parsing and manipulation of the html document object model(DOM) using MSHTML. Provides functions to parse html from a string, a website or a file.

    regexp.c
    Demonstrates using the VBScript.RegExp object to provide support for regular expressions. Provides a function to extract hrefs from a web page using a regular expression.

    xml.c
    Demonstrates using MSMXL to download a web page, read an RSS feed and read and manipulate XML with the XML document object model(DOM).

    wmi.c
    Demonstrates using Windows Management Instrumentation(WMI). Samples include enumerating installed hot fixes, purging print queues, starting a program, monitoring starting and terminating processes, and monitoring file creation. All of these samples can target the local or a remote computer.

    pocketsoap.c
    Demonstrates using the PocketSoap toolkit to utilise several web services. Play the 'Who wants to be a millionaire' quiz with the help of a web service.

    soap.c
    Demonstrates using the MSSoap toolkit to utilise several web services. Web services demonstrated include Google search, spell checker and cache viewer.

    iexplore.c
    Demonstrates controlling Internet Explorer via COM. Demonstrates using an Internet Explorer window to display or retrieve information from the user.

    scriptctl.c
    Demonstrates using the MSScriptControl to run a VBScript or JScript.

    dexplore.c
    Demonstrates controlling Microsoft's new help system for developers, dexplore.

    dcom_alt_creds.c
    Demonstrates one way of accessing a remote COM object using alternate credentials.

    wia.c
    Demonstrates using Windows Image Acquisition(WIA) to manipulate images. Demonstrates taking a snapshot from a video device.

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Sorry about the extra post, didn't want to make the
    previous post unreadable with 'wide' code.

    Here's a couple of samples(error checking ommitted):

    Code:
    /* ***********************************************
     * RSSRead:
     *   Demonstrates reading an rss feed using MSXML.
     *
     ============================================*/
    void RSSRead(LPCTSTR szURL) {
    
    	DISPATCH_OBJ(xmlDoc);
    	struct RSS {
    		LPWSTR szTitle, szLink, szDescription;
    	} RSSItem;
    
    	/* Load the rss document from the URL */
    	dhCreateObject(L"MSXML.DOMDocument", NULL, &xmlDoc) );
    	dhPutValue(xmlDoc, L".Async = %b", FALSE) );
    	dhCallMethod(xmlDoc, L".Load(%T)", szURL) );
    
    	FOR_EACH1(xmlNode, xmlDoc, L".documentElement.getElementsByTagName(%S)", L"item") {
    
    		ZeroMemory(&RSSItem, sizeof(RSSItem));
    
    		dhGetValue(L"%S", &RSSItem.szTitle,       xmlNode, L".selectSingleNode(%S).text", L"title");
    		dhGetValue(L"%S", &RSSItem.szLink,        xmlNode, L".selectSingleNode(%S).text", L"link");
    		dhGetValue(L"%S", &RSSItem.szDescription, xmlNode, L".selectSingleNode(%S).text", L"description");
    
    		wprintf(L"Title: %s\nLink: %s\nDescription: %.140s\n\n",
    				 RSSItem.szTitle, RSSItem.szLink, RSSItem.szDescription);
    
    		dhFreeString(RSSItem.szTitle);
    		dhFreeString(RSSItem.szLink);
    		dhFreeString(RSSItem.szDescription);
    
    	} NEXT(xmlNode);
    
    	SAFE_RELEASE(xmlDoc);
    }
    Code:
    /* ********************************************
     * MonitorProcessActivity:
     *   Monitors process startup and termination on local or remote computer.
     *
     * =========================================== */
    void MonitorProcessActivity(LPCWSTR szComputer) {
    
    	DISPATCH_OBJ(wmiSvc);
    	DISPATCH_OBJ(wmiEventSrc);
    
    	dhGetObject(getWmiStr(szComputer), NULL, &wmiSvc) );
    
    	dhGetValue(L"%o", &wmiEventSrc, wmiSvc, L".ExecNotificationQuery(%S)",
    	         L"SELECT * FROM __InstanceOperationEvent WITHIN 1 WHERE (__Class = '__InstanceCreationEvent' OR __Class = '__InstanceDeletionEvent') AND TargetInstance ISA 'Win32_Process'") );
    
    	while (TRUE) {
    		DISPATCH_OBJ(wmiLatestEvent);
    		LPWSTR szProcessName = NULL;
    		LPWSTR szClassName   = NULL;
    
    		dhGetValue(L"%o", &wmiLatestEvent, wmiEventSrc, L".NextEvent") );
    
    		dhGetValue(L"%S", &szProcessName, wmiLatestEvent, L".TargetInstance.Name");
    		dhGetValue(L"%S", &szClassName,   wmiLatestEvent, L".SystemProperties_(%S)", L"__Class");
    
    		if (szClassName && 0 == wcscmp(L"__InstanceDeletionEvent", szClassName))
    			wprintf(L"TERMINATED: \t%s\n", szProcessName);
    		else
    			wprintf(L"STARTED:    \t%s\n", szProcessName);
    
    		dhFreeString(szProcessName);
    		dhFreeString(szClassName);
    		SAFE_RELEASE(wmiLatestEvent);
    	}
    
    	SAFE_RELEASE(wmiEventSrc);
    	SAFE_RELEASE(wmiSvc);
    }

  3. #3
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    That bad? I wasn't serious about the crushing silence!

    I can understand if no one can be bothered having a look but can anyone comment on whether this is a worthwhile project or should I give it a ceremonial burial at sea.

    The 'how do I put a chart in Excel' or 'how do I send an email' sort of questions seem to come up fairly regularly so I thought this might be of some use. However, I may have been deluding myself.

    No one thinks any of the samples listed could be at all useful?

    Thanks.

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,742
    1. It would be better on the windows board
    2. Everyone is on holiday
    I am not a windows programmer, so I can't comment on it in any depth
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Regular Expression Feedback
    By sean in forum Tech Board
    Replies: 13
    Last Post: 05-28-2009, 03:26 PM
  2. Getting a message with wanted lparam from queue
    By BrownB in forum Windows Programming
    Replies: 6
    Last Post: 12-24-2007, 08:37 PM
  3. Developers Wanted
    By Quasicom in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 08-24-2005, 01:46 AM
  4. I just wanted....
    By ILoveVectors in forum C++ Programming
    Replies: 0
    Last Post: 06-22-2005, 10:29 PM
  5. Primary game build, feedback welcome
    By Clyde in forum Game Programming
    Replies: 37
    Last Post: 07-10-2002, 06:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21