Google Answers Logo
View Question
 
Q: Visual Studio 2005, Visual C++, Getting started, ( No Answer,   2 Comments )
Question  
Subject: Visual Studio 2005, Visual C++, Getting started,
Category: Computers > Programming
Asked by: impakistan-ga
List Price: $2.00
Posted: 11 Jun 2006 06:30 PDT
Expires: 11 Jul 2006 06:30 PDT
Question ID: 737187
Im beginner to Microsoft Visual Studio 2005,

I am interested in c++ part only.

There are lots of possibilities of starting a new project. CLR, ATL,
MFC.I need you to explain, which is most effective and best.
(in terms of compatibility with older OS like win98 and also in terms
of latest technology .NET)

Secondly, How can i call an activex or COM object. say with prog id:
WScript.Shell in c++ program and invoke simple method say Echo with
sample strng. All you need is to get me started. I need your help!

p.s Wscript.Shell is Windows Scripting host object. we can create it
in VB simply with CreatObject method. i know it can be created in C++
using something like CoCreateInstance  but im not able to do so. :(

Clarification of Question by impakistan-ga on 14 Jun 2006 10:34 PDT
Leave the second part as im done with it. just explain the first part.
ATL, CLI, CLR, MFC, STL. what are they and when should they be used?
Answer  
There is no answer at this time.

Comments  
Subject: Re: Visual Studio 2005, Visual C++, Getting started,
From: capndurk-ga on 15 Jun 2006 20:41 PDT
 
clr, atl, mfc, and others are just c++ libraries used to make
programming easier. however, it's really all a matter of opinion.
personally, i use windows api and i don't touch any of the libraries,
including the popular mfc.

if you're getting started with visual c++, i recommend sticking with
the api, but it's just what you want to do. read this article for the
information i found on it:

http://winprog.org/tutorial/apivsmfc.html

this guy knows his stuff when it comes to windows programming. they
also have a channel on irc if you need further help; i would know, the
programmers there have helped me countless times.

good luck :)
Subject: Re: Visual Studio 2005, Visual C++, Getting started,
From: impakistan-ga on 17 Jun 2006 17:13 PDT
 
thanks capndurk-ga.. its really great to see ur reply...

anyways, here is what i learnt:

in Visual Basic, we have to lines of code: using WSH SHELL OBJECT.
(microsoft.com/scripting)

=========
obj=CreateObject("WScript.Shell")
obj.PopUp("Hello World")
=========

here is equvilant in C++ (MAN COUNT THE LINES)

==========
// acHRESUtivex.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <string>
using namespace ATL;

HRESULT hresult;

DISPID dispid;

DISPPARAMS par;

OLECHAR FAR* szMember = L"PopUp";

VARIANT param;
int _tmain(int argc, _TCHAR* argv[])
{
  CoInitialize(NULL);
  CLSID Clsid;
  IUnknown *iF;
  IDispatch *pDispatch;
  CLSIDFromProgID(L"WScript.Shell", &Clsid);
  HRESULT h=CoCreateInstance(Clsid, NULL, CLSCTX_INPROC_SERVER,
IID_IDispatch, (void **)&pDispatch);
  
  hresult = pDispatch->GetIDsOfNames(IID_NULL,&szMember,1,
LOCALE_SYSTEM_DEFAULT,&dispid);

  BSTR msg = (L"Hello World!");
  param.vt=VT_BSTR;
  param.bstrVal=msg;
  par.rgvarg=&param;
  par.rgdispidNamedArgs=&dispid;
  par.cArgs=1;
 
  pDispatch->Invoke(dispid,IID_NULL,LOCALE_SYSTEM_DEFAULT,DISPATCH_METHOD,&par,NULL,NULL,NULL);

return 0;
}

=======================

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy