473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

But I'm not trying to run it in DOS mode!

Greetings,

I am running XP Professional.

I have an exe file written in VC++. When I try to run it it flashes a
command window at me and shuts down. I created a shortcut for it so I
could set it not to close the window right away and I see the message:
"This program cannot be run in DOS mode".

I did some reading on it (every message I could find about that
message on the newsgroups and the web). I tried starting up the
command window first (cmd.exe) and navigating to that directory and
running it that way and I got the same error.

I don't need it to run in DOS mode. There is no GUI front end on it,
but I'm perfectly fine with it being a 32 bit Windows app. Can
somebody point me in the right direction here?
Nov 16 '05 #1
3 2103
"John" <jo*************@hotmail.com> wrote in message
news:99**************************@posting.google.c om...
Greetings,

I am running XP Professional.

I have an exe file written in VC++. When I try to run it it flashes a
command window at me and shuts down. I created a shortcut for it so I
could set it not to close the window right away and I see the message:
"This program cannot be run in DOS mode".

I did some reading on it (every message I could find about that
message on the newsgroups and the web). I tried starting up the
command window first (cmd.exe) and navigating to that directory and
running it that way and I got the same error.

I don't need it to run in DOS mode. There is no GUI front end on it,
but I'm perfectly fine with it being a 32 bit Windows app. Can
somebody point me in the right direction here?


Do you want a persistent console window or no window at all? If the latter,
start over as a Win32 app instead of a console app. Just do what needs doing
and don't create any windows. If the former, I'm sure it's easy but I don't
know.
--
Jeff Partch [VC++ MVP]
Nov 16 '05 #2
Jeff,

Thanks for the suggestion. I tried that. Here's what happened:

I got the error: unresolved external symbol _WinMain@16

Then I added mainCRTStartup as the entry point symbol in my Projects
Settings => Links => Output and I'm back where I started (Dos mode
error).

I guess the program needs to be run in a console window, as it's
written to supply output to the screen. Any attempt to do so results
in confusion on the part of Windows as to whether it's an MS-DOS
program or a Win32 program.

BTW I am using VC++ 5.0.
Nov 16 '05 #3
Jeff (or anyone of course),

Maybe it would help if I posted my code.

The basic idea is to be able to create an appointment in Outlook (or
Exchange).

My boss's boss (i.e. the owner) has already told sales that we will
have this capability, so there are a number of people looking over my
shoulder here (although unobtrusively). I'm obviously not a C++
programmer by trade, and I actually don't need the program to be in
C++, but we don't have VB or DS.NET (yet) and I just need a working
prototype to wow the prospects for now. I got this code off the
internet.

Here are my questions, if anybody can help me out:

How can I get this program to compile and run?
How can I provide output (to a file would be fine)?
Should I be running this on the client or the server?

Here is my code:
// class1.cpp: implementation of the class1 class.
//
//////////////////////////////////////////////////////////////////////
#include <iads.h>
#include <adshlp.h>
#include <activeds.h>
#include <stdio.h>
#include <tchar.h>
#import <msado15.dll> no_namespace raw_interfaces_only
#import <cdoex.dll> rename_namespace("CDO") raw_interfaces_only
#import <cdosys.dll> no_namespace raw_interfaces_only
#include "class1.h"
#include <cdosysstr.h>
#include <cdosyserr.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
enum CdoFrequency
{
cdoSecondly = 1,
cdoMinutely = 2,
cdoHourly = 3,
cdoDaily = 4,
cdoWeekly = 5,
cdoMonthly = 6,
cdoYearly = 7,
};
enum CdoAttendeeRoleValues
{
cdoRequiredParticipant = 0,
cdoOptionalParticipant = 1,
cdoNonParticipant = 2,
cdoChair = 3
};
HRESULT GetDomainName(BSTR * bstrDomainName);
HRESULT SendMeetingRequest(BSTR bstrDomainName, BSTR bstrUser, BSTR
bstrRecipient);

struct StartOle {
StartOle() { CoInitialize(NULL); }
~StartOle() { CoUninitialize(); }
} _inst_StartOle;
//}

//class1::~class1()
//{
void main()
{
HRESULT hr = S_OK;
//
BSTR bstrDomainDNSName;
// Get Domain Name
hr = GetDomainName(&bstrDomainDNSName);

//printf("1");

// Create and send a recurring meeting request to a user
// TODO: change the second parameter to your mailbox name (meeting
organizer)
// TODO: change the third parameter to the recipient's e-mail address
or mailbox name
hr = SendMeetingRequest(bstrDomainDNSName, L"JohnS", L"JohnD");
}

//////////////////////////////////////////////////////////////////////////////////////////////////
// SendMeetingRequest
//
// Params: [in] BSTR bstrDomainName Domain DNS Name
// [in] BSTR bstrUser Meeting organizer's mailbox name
// [in] BSTR bstrRecipient Recipient's mailbox name
//
// Output: HRESULT
// Purpose: To demonstrate; 1.How to create a recurring appointment
// 2.How to add an exception to a recurring appointment
// 3.How to create a meeting request and send it
/////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT SendMeetingRequest(BSTR bstrDomainName, BSTR bstrUser, BSTR
bstrRecipient)
{
HRESULT hr = S_OK;

_bstr_t szCalendarURL ="file://./backofficestorage/" +
(_bstr_t)bstrDomainName + "/MBX/" + (_bstr_t)bstrUser + "/Calendar";

try{
CDO::IMessagePtr pMsg(_uuidof(CDO::Message));
CDO::IAppointmentPtr pAppt(_uuidof(CDO::Appointment));
CDO::IRecurrencePatternsPtr pRecPatterns;
CDO::IRecurrencePatternPtr pRecPattern;
CDO::IDataSourcePtr pDataSrc;
CDO::IAttendeesPtr pAttendees;
CDO::IAttendeePtr pAttendee;
CDO::IExceptionsPtr pExceptions;
CDO::IExceptionPtr pException;
CDO::ICalendarMessagePtr pCalendarMessage;

SYSTEMTIME st = {0};
SYSTEMTIME et = {0};

DATE dst, det;

// Specify the StartTime and EndTime values.
st.wYear = 2000;
st.wMonth = 2;
st.wDay = 1;
st.wHour = 13;
st.wMinute = 30;
et.wYear = 2000;
et.wMonth = 2;
et.wDay = 1;
et.wHour = 16;
et.wMinute = 30;

// Convert System value to double DATE
SystemTimeToVariantTime(&st, &dst);
SystemTimeToVariantTime(&et, &det);
// Set Appointment's properties.
pAppt->put_Subject(L"Exchange Server 2000 Training.");
pAppt->put_Location(L"Conference Room 444");
pAppt->put_TextBody(L"Please bring the course notes.");
pAppt->put_StartTime(dst);
pAppt->put_EndTime(det);

// Invite an Attendee.
pAppt->get_Attendees(&pAttendees);
pAttendees->Add(bstrRecipient, &pAttendee);
pAttendee->put_Role((enum
CDO::CdoAttendeeRoleValues)cdoRequiredParticipant) ;

// Create a Recurrence Pattern.
// Set the RecurrencePattern properties to make the Appointment a
bi-weekly Appointment.
pAppt->get_RecurrencePatterns(&pRecPatterns);
pRecPatterns->Add(L"ADD", &pRecPattern);
pRecPattern->put_Frequency((enum CDO::CdoFrequency)cdoWeekly);
pRecPattern->put_Interval(2); // every 2 weeks
pRecPattern->put_Instances(5); // end after 5 instances

// Create an Exception to the Appointment.
pAppt->get_Exceptions(&pExceptions);

// Delete the second instance from the series.
pExceptions->Add(L"DELETE", &pException);

// Specify the start time of the second Appointment in the series.
st.wYear = 2000;
st.wMonth = 2;
st.wDay = 15;
st.wHour = 13;
st.wMinute = 30;

SystemTimeToVariantTime(&st, &dst);

// dst is the StartTime of the second instance
pException->put_RecurrenceID(dst);

// Create a CalendarMessage
pAppt->CreateRequest(&pCalendarMessage);
pCalendarMessage->get_Message(&pMsg);

// Get the data source to save the Meeting into organizer's calendar.
pAppt->get_DataSource(&pDataSrc);

// Send the Meeting Request
hr = pMsg->Send();
if (SUCCEEDED(hr))
//_tprintf(_T("Recurring meeting request is sent.\n"));

// Optional : You can save the meeting into organizer's calendar.
hr = pDataSrc->SaveToContainer(szCalendarURL,
0,
adModeReadWrite,
adCreateOverwrite,
adOpenSource,
L"",
L"");
//if (SUCCEEDED(hr))
//_tprintf(_T("The meeting is saved to the organizer's calendar.\n"));
}
catch(_com_error &e)
{

//printf("HResult = %x\n", e.Error());
//printf("%S\n", e.Description());

}
return hr;

}

//////////////////////////////////////////////////////////////////////////////////////////////////
// GetDomainName
//
// Params: [out] BSTR * bstrDomainName
// Output: HRESULT
// Purpose: Retrieve the Domain DNS name.
/////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT GetDomainName(BSTR * bstrDomainName)
{
HRESULT hr = S_OK;
IADsADSystemInfo *pADsys;
hr = CoCreateInstance(CLSID_ADSystemInfo,
NULL,
CLSCTX_INPROC_SERVER,
IID_IADsADSystemInfo,
(void**)&pADsys);
hr = pADsys->get_DomainDNSName(bstrDomainName);

if (pADsys)
pADsys->Release();
return hr;
}
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Billy | last post by:
Hi, I'm trying to get the x and y cords for a window using "pageXOffSet" and "pageYOffSet" but all it returns is "undefined". Is this old syntax? How do I do this? Thanks, Billy
6
by: Frank Wilson | last post by:
Tom, It sounds to me like ASP, not ASP.NET is handling the request for WebForm1.aspx. This is most likely an IIS config issue that may have been caused by order of installation or...
3
by: Bruce D | last post by:
I'm new to .NET and I have a error that is coming up but it's not telling me where the error is coming from (no file). Is that because I'm doing something wrong...or is it a type of error that has...
6
by: ray well | last post by:
hi, i tried to run a asp .net project in debug mode, setting breakpoints along the way to debug some problem, and i get a error message "error while trying to run project", with no explaination...
2
by: David Hearn | last post by:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Description: An unhandled exception occurred during the execution of the current...
6
by: Steven | last post by:
Hi, I am trying to position 2 columns of links so that the first is at the left of the page and the second is at the right. The lines in each column should be left-justified. I have managed...
0
by: JohnnyBoy | last post by:
I am playing with a Microsoft code example that uses the creatFile call to open a stream to a serial COM port. When I execute the example, the createFile call fails with an error code 5...
22
by: Brad | last post by:
Hi, Am trying to read one byte at location 0xFFF0 000E in an embedded system. I cast a pointer to int, then try to stuff the above address in, then reference whats at the location? wont...
4
by: =?Utf-8?B?VGVycmFuY2U=?= | last post by:
I have an application that runs fine on my machine(of course) that access the local Sql Server. However, when trying to run this application from another machine I receive a Sql timeout error. I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.