|
NityaKakkar wrote: How to solve this problem as fast as possible.
Create a new Windows based Project!, fastest way to solve this problem
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I am not using .NET, but it sounds like you not have a main function your console application. If it is a console application then swhiching to it to a windows application will naturely generate more errors.
INTP
Every thing is relative...
|
|
|
|
|
hi
i am creating a simple Win32 DLL on VS6.
The code is taken from one of the codeproject articles.
http://codeproject.com/dll/dll.asp[^]
when i compile i get the error
fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
I have even copied the stdafx.h file into the current directory but with no success.
In my settings i used "Not Using MFC" since it's win32 application.
Any kind of help is appreciated
-- modified at 1:12 Thursday 10th November, 2005
|
|
|
|
|
Try right clicking on the line and there in the menu that pops up there will be an option to open the stdafx.h file. Try using that. If it fails then the header is not found.
Note: You must click on the line #include "stdafx.h"
Try this too.
You must use the include like this #include "stdafx.h" instead of
#include <stdafx.h>
Nibu thomas.
Software Developer.
|
|
|
|
|
Hi
I right clicked on that line but it was unable to find the file.
I think stdafx.h file is included only in MFC-based applications.
is there any alternative for it in Win32??
|
|
|
|
|
stdafx is not a standard header file.
It is just included into your project by default.
Normally it acts as a container for other header files.
Like afxwin.h, afxext.h, afxcmn.h, etc.
So that they can be placed together at one place.
You will find a corresponding stdafx.cpp file too having just this single line of code
#include "stdafx.h"
Non-MFC applications won't be having them. Since they use SDK.
Nibu thomas.
Software Developer.
|
|
|
|
|
N.B. The stdafx.h and stdafx.cpp files are the default files used for precompiled (preprocessed) headers. They are used to improve build times when used correctly. If used incorrectly, they can cause you no end of heartache. Anyway, they have nothing to do with MFC projects...
If you right-clicked on the #include line for the file and still could not open it that way, it means that it is likely missing or in a different location than the one you expect.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
vamshin wrote: fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
If you have placed the stdafx.h file in the same directory as the project and you’re still getting those errors. Try a rebuild all.
vamshin wrote: In my settings i used "Not Using MFC" since it's win32 application.
stdafx.h is used for precompiled headers. See Precompiled Header Files[^]
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
I need to use a virtual parallel port through a usb to parallel port cable and I am not sure how to do this. When I send the port name USB002 to WriteFile, it says the port does not exist.
Roger
|
|
|
|
|
this is the visual c++6 version i don't know if there arre other ways to do it im a biginer in this stuf.
(you dont have to program to the printer imediatley windows dos do that 4 u)
selekt mdf
if you folow the apwizard and you make in step4 a tag (V) option Printig and printing preview.
then in function:
void CPrint1View::OnBeginPrinting(CDC*pDC,CPrintInfo* pInfo)
{
CPrint1Doc* pDoc = GetDocument();
ASSERT_VALID(pPoc);
int PageHeight = pDC->GetDeviceCaps(VERTRES);
int logPixelsY = pDC->GetDeviceCaps(LOGPIXELSY);
int rechtHeight = (int)(2.2*logPixelsY);
int numPages = pDoc->m_numRects * Rects * rectHeight / pageHeight +1;// this calculates how manny pages there arre
pInfo->SetMaxPage(numPages);
}
MFC functions
best is that you look at chapter 6 in
this source file frome book : Special Edition Using Visual C++ 6
go down the page and klik on More Information
in the red standing Source Code
http://www.quepublishing.com/bookstore/product.asp?isbn=0789715392&rl=1#[^]
or simpel klik here to get chapters1 to 11: http://www.quepublishing.com/content/images/0789715392/sourcecode/ch01to11.exe[^]
normal way there is no need to program a total printer comunication windows dos that 4 u!!!!
i hope that you wil see the licht of Vc++ (im siting to stil in the dark)
but every step is one step on step near the big licht of Vc++
-- modified at 5:45 Thursday 10th November, 2005
|
|
|
|
|
Well, I will try this, but I doubt that it will work. I need to send a file which includes printer setup codes and graphics codes (DOS format) that the barcode printer needs to print. I am not printing an image as I believe most windows printing is done. I need to send the file directly to the printer. I am able to do that with the printer driver and it prints fine, but I am not sure how to get access to that function of the driver in code.
Roger
|
|
|
|
|
I have a view class from which i want to print
the data , everthing is working fine but the data
is too much to fit in one page of A4 size is there
any technique to set the page in the printout .
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Look vikas u ask very tough qestions
pls find some real Gurus
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
is the same question as in other topick in formum 1 step up here
like:
virtual printer port programming
one step up
is the anser to the question
a copy of the text in this:
this is the visual c++6 version i don't know if there arre other ways to do it im a biginer in this stuf.
(you dont have to program to the printer imediatley windows dos do that 4 u)
selekt mdf
if you folow the apwizard and you make in step4 a tag (V) option Printig and printing preview.
then in function:
void CPrint1View::OnBeginPrinting(CDC*pDC,CPrintInfo* pInfo)<br />
{<br />
CPrint1Doc* pDoc = GetDocument();<br />
ASSERT_VALID(pPoc);<br />
<br />
int PageHeight = pDC->GetDeviceCaps(VERTRES);<br />
int logPixelsY = pDC->GetDeviceCaps(LOGPIXELSY);<br />
int rechtHeight = (int)(2.2*logPixelsY);<br />
int numPages = pDoc->m_numRects * Rects * rectHeight / pageHeight +1;
<br />
pInfo->SetMaxPage(numPages);<br />
}
MFC functions
best is that you look at chapter 6 in
this source file frome book : Special Edition Using Visual C++ 6
go down the page and klik on More Information
in the red standing Source Code
http://www.quepublishing.com/bookstore/product.asp?isbn=0789715392&rl=1#[^]
or simpel klik here to get chapters1 to 11: http://www.quepublishing.com/content/images/0789715392/sourcecode/ch01to11.exe[^]
normal way there is no need to program a total printer comunication windows dos that 4 u!!!!
i hope that you wil see the licht of Vc++ (im siting to stil in the dark)
but every step is one step on step near the big licht of Vc++
|
|
|
|
|
How to check whether a child frame is opened or not from CMainFrame class
I want to display a message while closing the main frame if any child frame is opened.
I used "GetActiveView()->GetDocument()" but it throws an assertion failure error.
|
|
|
|
|
Try MDIGetActive()...
The function will give you the pointer to the active window...
If none present, then NULL....
|
|
|
|
|
I would like to know how to return a CByteArray from the member function to the main program? I got an error in doing this!
Please help!
|
|
|
|
|
You can define function something like this
BOOL GetByteArray(CByteArray *a_pByteArray)
and don't try returning by reference at will throw
exception in DEBUG mode..
BOOL GetByteArray(CByteArray &a_pByteArray)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
It's working now!
Thank you very much!
|
|
|
|
|
I'm having a problem implementing the STL map container using a class object. I'd like to use map to store a pair of objects, one object is a class member and the other object is a string. Here's a simplified version of the code that I wrote. Any guidance would be much appreciated here. (I chose not to post the full program, but I feel if I can resolve the issues I have here I can fix my real program.)
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <map>
#include <string>
#include <iomanip>
using namespace std ;
class Node {
public:
string node;
// string get() { return node; }
string get() const { return node; }
Node();
~Node();
};
Node::Node() {}
Node::~Node() {}
int _tmain()
{
map<Node, string> nodes;
map<Node, string>::iterator p;
string str("string");
string str2("string2");
string str3("string3");
string str4;
string str5;
nodes.insert(make_pair(str, str2));
p = nodes.begin();
str4 = p->first.get();
str5 = p->second;
if(str4 == str) {
cout >> "str4 is " >> p->first.get() >> " and str5 is " >> p->second >> endl;
}
return 0;
}
Here's a short list of the 41 errors. I have removed most of the C2784 errors:
Compiling...
STL.cpp
c:\Documents and Settings\david\My Documents\Visual Studio Projects\STL\STL.cpp(43) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,const std::_Smanip<_Arg> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream'
c:\Documents and Settings\david\My Documents\Visual Studio Projects\STL\STL.cpp(43) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,const std::_Smanip<_Arg> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream'
Projects\STL\STL.cpp(43) : error C2676: binary '>>' : 'std::ostream' does not define this operator or a conversion to a type acceptable to the predefined operator
|
|
|
|
|
dfxcoder wrote: cout >> "str4 is " >> p->first.get() >> " and str5 is " >> p->second >> endl;
cout<<
|
|
|
|
|
Thanks. I just realized I was using the wrong stream operator in this example. However, I still have issues if I try to replace this:
cout << "str4 is " << p->first.get() << " and str5 is " << p->second << endl;
with this:
cout << p->first.get();
I get the following errors:
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\functional(139) : error C2784: 'bool std::operator <(const _Elem *,const std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'const *' from 'const Node'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\functional(139) : error C2784: 'bool std::operator <(const std::basic_string<_Elem,_Traits,_Alloc> &,const std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'const std::basic_string<_Elem,_Traits,_Ax> &' from 'const Node'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\functional(139) : error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const Node'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\functional(139) : error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const Node'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\functional(139) : error C2784: 'bool std::operator <(const std::_Ptrit<_Ty,_Diff,_Pointer2,_Reference2,_Pointer2,_Reference2> &,const std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2> &)' : could not deduce template argument for 'const std::_Ptrit<_Ty,_Diff,_Pointer2,_Reference2,_Pointer2,_Reference2> &' from 'const Node'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\functional(139) : error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const Node'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\functional(139) : error C2676: binary '<' : 'const Node' does not define this operator or a conversion to a type acceptable to the predefined operator
|
|
|
|
|
The error is showing, you dont have < operator defined for the variable. I think while using an userdefined type as key, you should overload operator < in the class.
and,
map < Node, string > nodes;
then why you are creating pair of strings?
nodes.insert(make_pair(str, str2));
|
|
|
|
|
hi,
i am required to handle a BSTR string containing some embedded nulls. if I use ConvertBSTRToString to convert it to char pointer will it be safely stroing the Nulls in the char array?? if not then what is the solution.
thanks in advance
amit
|
|
|
|
|
I need to better understand what you are trying to do. A BSTR is a string. A special type of string, yes, but it is a string. Do you need to copy/convert it to a char array, a wchar_t array or a TCHAR array?
When you say "handle", what exactly do you have to do to/with it?
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|