|
_Application::CreateDispatch() returns a BOOL .
The _Application class derives from COleDispatchDriver .
You should provide a pointer to a COleException in the call to CreateDispatch() to get hold of the error.
Read how here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I do not see com initialization code in your program.
call CoInitialize/CoInitializeEx to initialize COM.
I hope it helps.
Check rogers reply..
Regards,
Sandip.
modified on Friday, October 17, 2008 7:50 AM
|
|
|
|
|
The call chain of AfxOleInit() eventually calls ::CoInitializeEx() and sets up an STA.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Ohh.. Thanks for the info..
Regards,
Sandip.
|
|
|
|
|
SRKSHOME wrote: if(!AfxOleInit())
You need to call OleInitialize(NULL) instead.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Thanks a lot David. It did work.
|
|
|
|
|
hi,
I'm using Visual Studio 2005 Professional Edition.
I created a project on .NET Framework (Windows Embedded CE 6.0).
When i run my project in DEBUG mode on my emulator, i get an error read as :
"Application Error:
Application MyProject.exe encountered a serious error and
must shutdown."
Please advise how to resolve this.
For info:
I have no such problem when I run my application in RELEASE mode.
S.O.S
Ema
|
|
|
|
|
Debugging would be a great idea. Also, try an appropriate forum. This is the native programming forum (C++/MFC).
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Why you asked this question here?
|
|
|
|
|
|
You can ask on the .NET Framework[^] but whats your language you used for your program c++ or?
|
|
|
|
|
Using C++...Anyway i've posted this question in .NET Framework section...
Thanks!
Ema
|
|
|
|
|
Hi all,
What's the most appropriate place to define this.
TCHAR szTempFile[MAX_PATH];
I've define it on the header file, is that OK.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
No - it can cause problems. If the header file is included in more than one source file (i.e. a body file) then the linker will complain about szTempFile being multiply defined (actual error will depend on your actual compiler). Effectively each body file gets its own variable with global scope called szTempFile. When the linker comes along it sees multiple versions of the variable and causes the error
The rule is that a variable name can be declared more than once but only defined once. The above line is a definition. Definitions should always live in the body files. If you want to share the variable between multiple body files then you need to include a declaration of the variable in the header file. You do this by putting the keyword extern in front of the declaration as follows
extern TCHAR szTempFile[MAX_PATH];
Graham
Librarians rule, Ook!
|
|
|
|
|
Yes, I tried it. But compiler give me an error 'illegal storage class'
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Which compiler? I created a test project in VS2003 and it works fine
File foobar.h
#pragma once
extern TCHAR szTempFile[MAX_PATH];
File foo.cpp
#include "stdafx.h"
#include "Foobar.h"
void DoIt()
{
szTempFile[0] = _T('a');
}
File bar.cpp
#include "stdafx.h"
#include "Foobar.h"
TCHAR szTempFile[MAX_PATH];
Graham
Librarians rule, Ook!
|
|
|
|
|
if you're coding C++, the best place for such a declaration is still in the class definition, as a member...
|
|
|
|
|
The most appropriate place is the place that gives the variable
the scope you desire.
If its scope is the duration of a function, put it in a function.
If its scope is global, put it anywhere outside a function.
etc...
Header files are typically for declarations. Variable instances
should be placed in source (c/cpp) files. Yours is an instance, so
shouldn't be in a header file.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How to know the mouse right clicking the cerain icon in the toolbar?
I want to open a caustomized setting dialog if I click the certain icon in the toolbar by the right button of mouse.
|
|
|
|
|
Hi All
I hava a problem to read specific string from file.I am useing CStdioFile class.Code is here
[code]
CString ab;
CStdioFile file;
if (file.Open(_T("\\App.txt"), CFile::modeRead | CFile::modeNoTruncate))
{
while(file.end)
{
file.ReadString(ab);
}
file.Close();
}
[/code]
In my line is like this
Mr. As 10 Developer
Mr. PC 19 Analyst
Now i want to read Mr. As and Mr. Pc Name only.How can i read this.Plz help me
modified on Friday, October 17, 2008 3:47 AM
|
|
|
|
|
lpVCcode wrote: CSting
Wow, a MFC class wrapping the former Police's singer.
Well, you have to parse the single lines, using, for instance CString::Tokenize [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Wow, a MFC class wrapping the former Police's singer.
I'm so glad I wasn't drinking coffee when I read that
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You can use of CString::Find.
|
|
|
|
|
lpVCcode wrote: Now i want to read Mr. As and Mr. Pc Name only.How can i read this.
Use AfxExtractSubString() in ab .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
is there some way to check status of printer(selected from CPrintdialog selection) means either its Ready, offline or unable to connect with server ??
like GetDeviceName() gives name of printer but how to check its status.........
pls help
|
|
|
|