|
|
REPOST[^]
You asked this question a couple of days ago. I asked you to use ShellExecute. Did you try it out? You can also use CreateProcess as per Hamid's suggestion.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
BTW if you put your exe in <drive letter.>\windows\system32 folder and then you don't need to full path to execute your exe with system command
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
_AnShUmAn_ wrote: if you put your exe in <drive letter.="">\windows\system32 folder
that's an awful solution. system folder should never be altered by any application.
Being in the path should suffice BTW.
|
|
|
|
|
I would phrase it as "Only if you know what you are doing and are very sure about it you can go ahead with it" Many applications do modify the system32 folder
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
it's not because many application do it means it's good to do it.
if they do, it's because they are coded by lazy programmers who don't know they can add their installation folder in the path.
Microsoft (in a "Windows Best Practices" book i forgot the name) deprecates to write in such directories like system/, system32/, windows/ and so on...
modified on Tuesday, July 1, 2008 8:46 AM
|
|
|
|
|
Double Thanks for the input
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Welcome
|
|
|
|
|
Having read the replies, and having been there, the following suggestion:-
The Current working directory is easily changed, be it inadvertedly or otherwise. For instance, browsing with CFileDialog may change it. This can give rise to peculiar situations: Now it works, Now it doesn't. My approach is to use GetModuleFileName(). This gives the fully qualified file path to the file that is executing. Strip this back to the Directory of the current exe, and you have a starting point.Work out from here where 'CharacterAnimation.exe'is stored, and adjust the path accordingly.
So, the relative location between your exe and your target must be fixed!
If that is not the case, you should alow the user to browse for the file.
It is also good practice to default to a browse box (e.g. CFileDialog) if things go wrong, and the file cannot be found where expected.
And, ofcourse you should use ShellExecute() in stead of system.
Hope this is helpfull
Bram van Kampen
|
|
|
|
|
Hi, i placed CDateTimeCtrl (ShortDate style) om my dialog, and when I'm calling 'DoModal()' app crashes. When I debug I find it crushes at:
BOOL CDateTimeCtrl::SetTime(_In_ const COleDateTime& timeNew)<br />
function, at line:
ASSERT(timeNew.GetStatus() != COleDateTime::invalid);
where timeNew.m_dt=0.0000..., and timeNew.m_status is invalid???
The more oddly is that I never call this function (SetTime) in my code, so it must be called internally?!
I'm using VC++ VS2008, on XP!
All I needed is a simple control from which users can pick date (do not need time)!
Thanks in advance!
modified on Tuesday, July 1, 2008 4:44 AM
|
|
|
|
|
Set a valid time to the control before calling DoModal().
An Assertion tells you that there is something REALLY bad .
Greetings from Germany
|
|
|
|
|
I remove control from my dialog and put simple place holder and created CDateTimeCtrl in InitDialog() member function, everything worked fine.
<br />
m_DateTime.Create(WS_CHILD|WS_VISIBLE|DTS_SHORTDATEFORMAT,rc,this,IDC_DATETIME);<br />
But how I can add member variable to my control (CString)?
Before I did it through Wizard!?
|
|
|
|
|
Solved, It just didn't work for some time for no reason, now it's OK!
|
|
|
|
|
Hi,
The following code complied properly in Vc++ 7.1.When I implemented the same code in VC++ 6.0 its giving the errors(I am not much used to VC++6.0).
The code is reading the data present in an XML file.
\****************************************************************\
MSXML::IXMLDOMNodePtr m_pDSNNode;
CString parNamevalue;
_bstr_t parName="name";
_bstr_t parval="value";
for(MSXML::IXMLDOMNodePtr pChild = m_pDSNNode->firstChild;
NULL != pChild;
pChild = pChild->nextSibling)
{
if (MSXML::NODE_ELEMENT== pChild->nodeType)
{
MSXML::IXMLDOMElementPtr pElement=pChild;
parNamevalue=pElement->getAttribute(parName);
if(parNamevalue.CompareNoCase("DataSourceName")==0)
{
strDSNName=pElement->getAttribute(parval);
strDSNName.TrimLeft();
strDSNName.TrimRight();
break;
}
}
}
\**********************************************\
The compile errors I got are
(1) error C2227: left of '->firstChild' must point to class/struct/union
(2) error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class _variant_t' (or there is no acceptable conversion)
(3)error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class _variant_t' (or there is no acceptable conversion)
Someone help me out of this problem
Thanks in advance
Regards
Engilela
|
|
|
|
|
I guess VC 6 dont know the MSXML::IXMLDOMNodePtr. Define the right WIN_VER and IE.
Comment all error lines out to find the primary error.
Better use a newer version of VC, VC6 is outdated.
Greetings from Germany
|
|
|
|
|
Hi KarstenK,
Thank u very much for your reply. I have changed MSXML to MSXML2 and tested the code.But i am getting the same errors. Our project is in VC6.0 so i cont use latest version. So help me out of this problem.
Regards
Engilela
|
|
|
|
|
Are you including all libs, headers, APIs and/or other files that the MSXML need? Maybe is by default in later versions of VC++ but in the 6.0 you will need them extra.
The C2227 is telling you the same as if you use a class from a dll whose headers where not properly included.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
I used the code in tne article titled "Comparing Two Bitmaps for Equality".I get some errors as,
'GetDC' : function does not take 1 parameters
wher i used HDC hdc = GetDC(NULL); and
error C2446: '<' : no conversion from 'unsigned long' to 'unsigned char *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast where i used BYTE *pLeftBits = new BYTE<BitmapInfoLeft.bmiHeader.biSizeImage>;
Please help
modified on Tuesday, July 1, 2008 12:52 AM
|
|
|
|
|
corrected the 2nd error.please help with the first.
|
|
|
|
|
projectip wrote: HDC hdc = GetDC(NULL);
Use GetDC()
projectip wrote: error C2446: '<' : no conversion from 'unsigned long' to 'unsigned char *' ...
Doesn't the error message itself say that unsigned long cannot be converted to unsigned char* and the function would be taking unsigned char* as a parameter
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Now it gives error,'initializing' : cannot convert from 'class CDC *' to 'struct HDC_
|
|
|
|
|
::GetDC
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I get a warningconversion from 'unsigned long' to 'unsigned char', possible loss of data
|
|
|
|
|
CDC *pDC = GetDC();
HDC hDC = pDC->GetSafeHDC()
...
...
ReleaseDC(pDC);
the fruits of your success will be in direct ratio to the honesty and sincerity of your own efforts in keeping your own records, doing your own thinking and, reaching your own conclusions.
..surviving in autumn..in love with spring..
|
|
|
|
|
I get a warning
conversion from 'unsigned long' to 'unsigned char', possible loss of data<br /> when i give BYTE *pLeftBits = new BYTE(BitmapInfoLeft.bmiHeader.biSizeImage);
|
|
|
|