Click here to Skip to main content
15,897,518 members
Home / Discussions / COM
   

COM

 
GeneralCOM Pin
8-Aug-01 0:14
suss8-Aug-01 0:14 
GeneralCalling the 2nd + method Pin
Brad Bruce7-Aug-01 8:39
Brad Bruce7-Aug-01 8:39 
GeneralATL Dialog based control wizard Pin
7-Aug-01 7:24
suss7-Aug-01 7:24 
GeneralRe: ATL Dialog based control wizard Pin
Aaron Schaefer7-Aug-01 8:41
Aaron Schaefer7-Aug-01 8:41 
QuestionMFC ASSERT called by IE, need to reboot? Pin
Joe Hastings7-Aug-01 3:25
Joe Hastings7-Aug-01 3:25 
Generalput <map> in dispparams Pin
parag7-Aug-01 3:04
parag7-Aug-01 3:04 
GeneralUsing ActiveX VB dll in VC Pin
6-Aug-01 20:06
suss6-Aug-01 20:06 
GeneralAutomating Visual C++ Project Creation Pin
Steve Thresher6-Aug-01 0:19
Steve Thresher6-Aug-01 0:19 
You can use the following VB Script to create a project:

Set objMSDEV = WScript.CreateObject("msdev.application")

objMSDEV.addproject "test","c:\myapp",TRUE

objMSDEV.ActiveProject.AddFile "test.cpp"objMSDEV.QuitWScript.Echo "Done"


From this I have determined that the following C++ code should also generate a project:

#include "stdafx.h"

#include <stdio.h>

#include <atlbase.h>
extern CComModule _Module;
#include <atlcom.h>
#include <initguid.h>
#include <comdef.h>

#include <ObjModel\appauto.h>
#include <ObjModel\appdefs.h>
#include <ObjModel\appguid.h>

#include <ObjModel\bldauto.h>
#include <ObjModel\bldguid.h>
#include <ObjModel\blddefs.h>

#include <ObjModel\textauto.h>
#include <ObjModel\textguid.h>
#include <ObjModel\textdefs.h>

#include <ObjModel\dbgauto.h>
#include <ObjModel\dbgguid.h>
#include <ObjModel\dbgdefs.h> 

IApplication *pApp;

int main(int argc, char* argv[])
{  
	// Initialize COM libraries  
	HRESULT hr = CoInitialize(NULL);  
	if(FAILED(hr))  
	{    
		printf("Failed to initialize the COM libraries\n");    
		return FALSE;  
	}  

	// Obtain the IApplication pointer  
	hr = CoCreateInstance(CLSID_Application, NULL, CLSCTX_LOCAL_SERVER, IID_IApplication, (void**)&pApp);  
	if(FAILED(hr))  
	{    
		printf("Failed to create an instance of MSDEV\n");    
		CoUninitialize();  
	}  

	CComBSTR bProjectName("project");  
	CComBSTR bPath("c:\\myproject");  
	CComBSTR bType("Application");  
	VARIANT_BOOL bCreateDirs=VARIANT_FALSE;	  

	// Create the project files  
	pApp->AddProject(bProjectName,bPath,bType,bCreateDirs);  

	// Quit from Visual C++  
	pApp->Quit();  
	pApp=NULL;  

	// Uninitialize COM libraries  
	CoUninitialize();  

	return 0;
}


The problem is the call to add the project generates the following error:

Debug Error!

Program: test.exe
Module:
File: i386\chkesp.c
Line: 42

The value of ESP was not properly saved accross a function call. 
This is usually a result of calling a function declared with one 
calling convention with a function pointer declared with a different 
calling convention.


Can any body tell me what I am doing wrong?

Thanks for any help you can provide.
Steve.
GeneralExtension of the IE5 context-menu Pin
Yks5-Aug-01 18:59
Yks5-Aug-01 18:59 
GeneralRe: Extension of the IE5 context-menu Pin
Todd Smith5-Aug-01 19:32
Todd Smith5-Aug-01 19:32 
GeneralRe: Extension of the IE5 context-menu Pin
Not Active6-Aug-01 3:03
mentorNot Active6-Aug-01 3:03 
QuestionGet the MAC-address from a host computer? Pin
Heidyon3-Aug-01 0:00
Heidyon3-Aug-01 0:00 
GeneralActiveX component in an exe Pin
2-Aug-01 15:53
suss2-Aug-01 15:53 
GeneralATL wizard with multiple tables Pin
Bigge2-Aug-01 0:32
Bigge2-Aug-01 0:32 
GeneralRe: ATL wizard with multiple tables Pin
Not Active2-Aug-01 4:42
mentorNot Active2-Aug-01 4:42 
GeneralRe: ATL wizard with multiple tables Pin
Bigge2-Aug-01 5:36
Bigge2-Aug-01 5:36 
GeneralRe: ATL wizard with multiple tables Pin
Wictor Wilén2-Aug-01 5:04
Wictor Wilén2-Aug-01 5:04 
GeneralRe: ATL wizard with multiple tables Pin
Bigge2-Aug-01 5:23
Bigge2-Aug-01 5:23 
GeneralRe: ATL wizard with multiple tables Pin
Wictor Wilén2-Aug-01 7:07
Wictor Wilén2-Aug-01 7:07 
GeneralInteracting COM dlls from Java using JNI Pin
Shamant31-Jul-01 23:42
Shamant31-Jul-01 23:42 
Generalaccessing IE as the ATL/ActiveX parent Pin
31-Jul-01 11:05
suss31-Jul-01 11:05 
GeneralRe: accessing IE as the ATL/ActiveX parent Pin
2-Aug-01 4:40
suss2-Aug-01 4:40 
GeneralATL client Pin
31-Jul-01 4:25
suss31-Jul-01 4:25 
GeneralRe: ATL client Pin
Not Active31-Jul-01 15:23
mentorNot Active31-Jul-01 15:23 
GeneralRe: ATL client Pin
31-Jul-01 22:47
suss31-Jul-01 22:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.