|
I am currently working with a CAsyncSocket derived class in VS 2005 in a static binary and I have not experienced any problems.
However, more information would be useful:
1.) What version of visual studio?
2.) What is the error code?
3.) Did you AfxSocketInit() before creating the CAsyncSocket object?
For your second question, a static build does not require any of the MFC DLL's to be distributed with the binary, as long as your not using any third party API's.
The shared build will require MFC42.DLL a MSVCRT.DLL if you are using Visual Studio 6.0. If you are using a newer MFC version then you will need to distribute the updated DLL's which could be MFC 7.0 , MFC 7.1 or MFC 8.0
|
|
|
|
|
First of all thanks for the attention.
1) VC 7.0 (2002)
2) Access Violation error
3) Yes I did, In fact when I performe a shared build there is no problem at all.
So if I understood right I need to deliver 3 dll files:
MFC42.dll
MSVCRT.dll
MFC7_0.dll
DavidR
|
|
|
|
|
Hi all, happy new year!!!
I am a C++ newbie. I am wondering is there any package or library availalbe like arraylist or vector in java??? If it does have, could somebody tell me how to import the library and how to use it please???
Thanks in advance!!!
Asura
|
|
|
|
|
There are template classes for strings, vectors, arrays, etc. you can search for them in the msdn.
-Prakash
|
|
|
|
|
The C++ Standard Template Library (STL) has vector , list and deque containers, which provide features like those Java classes. There are various on-line tutorials for STL you can find through Google[^], but if you are going to use C++ and STL seriously you should buy The Book[^].
|
|
|
|
|
the post is not c++ related.
includeh10
|
|
|
|
|
includeh10 wrote: the post is not c++ related.
void main(...)
{
printf("Happy new year!!!\n") // Error on this line.
}
It gives me an compiler error on the printf line, dont know what the error is. Any one with a clue?
-Prakash
|
|
|
|
|
1. add the include file
#include <stdio.h>
2. comple ...
compiler says:
error C2143: syntax error : missing ';' before '}'
did you see above info?
so add ";" before your //
includeh10
-- modified at 11:16 Saturday 31st December, 2005
|
|
|
|
|
humm, thanks, its working now and this is what i got as the output.
Happy new year!!!
-Prakash
|
|
|
|
|
I think forgot his original post and toke you seriously.
INTP
Every thing is relative...
|
|
|
|
|
John R. Shaw wrote: think forgot his original post and toke you seriously.
anyways Happy New year Sir
"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
|
|
|
|
|
hi, i am new to usage of CListCtrl control. I want 2 display a image column as 1st column of the CListCtrl . I want 2 prevent only this column from being resized.
Cud someone suggest me a way to do the same.
Also is it possible to conditionally hide/show the images on this column?
If possible, cud some1 send a sample code as an illustration.
|
|
|
|
|
|
Hello All,
Not to toot my own horn...well, OK...to toot my own horn
You may recall my step-by-step DCOM tutorial for VC6, which I posted at
http://www.codeproject.com/com/HelloTutorial1.asp[^]
The tutorial isn't meant to reveal the underlying theory and gory detail of DCOM itself, just like the Scribble tutorial wasn't exactly meant to tour every nook and cranny of MFC. However, the tutorial shows each step to take to build a very simple DCOM server and client.
People have been asking me to update the tutorial for VS.NET. And, at last, the new tutorial series is in the midst of being written. Check it out at
Step 1: http://www.codeproject.com/useritems/HelloTutorial1NET.asp[^]
The tutorial is written in several "Steps" -- the main parts of the process. Step 1 is linked above, and each Step contains links to every other step.
Do me a favor, and use the rating at the bottom of each step to score that Step, and post to the Steps' message boards with your questions, and also suggestions on how to make a certain Step better etc. I welcome any and all input, and both positive kudos and constructive feedback together are great. Thanks!
Sincerely Yours,
Brian Hart
Department of Physics and Astronomy
University of California, Irvine
|
|
|
|
|
// CDib operated_dib;
GLOBALHANDLE hGMem ;
OpenClipboard();
hGMem = GetClipboardData(CF_DIB);
operated_dib.GetClipBoard (&hGMem);
int n=10;
int height=operated_dib.GetHeight();
int width=operated_dib.GetWidth();
........
here is the contents of the GetClipBoard (&hGMem),I donn't know where the mistakes are?
BOOL CDib::GetClipBoard(GLOBALHANDLE hGMem)
{
pDib = (BYTE*)GlobalLock(hGMem);
m_pBitmapInfo = (BITMAPINFO*) pDib;
m_pBitmapInfoHeader = (BITMAPINFOHEADER*) pDib;
m_pRGB = (RGBQUAD*)(pDib +
m_pBitmapInfoHeader->biSize);
int m_numberOfColors = GetNumberOfColors();
if (m_pBitmapInfoHeader->biClrUsed == 0)
m_pBitmapInfoHeader->biClrUsed =
m_numberOfColors;
DWORD colorTableSize = m_numberOfColors *
sizeof(RGBQUAD);
m_pData = pDib + m_pBitmapInfoHeader->biSize
+ colorTableSize;
if (m_pRGB == (RGBQUAD*)m_pData) // No color table
m_pRGB = NULL;
m_pBitmapInfoHeader->biSizeImage = GetSize();
m_valid = TRUE;
m_width=GetWidth();
m_height=GetHeight();
return m_valid;
}
|
|
|
|
|
greenapplezlp wrote: I donn't find the mistakes!
What Errors did u get??
|
|
|
|
|
Compiling and executeing the program are successful! but when I add the program above, Compiling is successful while executeing is wrong.It emerges a dialog box,which contents are as following--RobotVideo.exe 遇到问题需要关闭。我们对此引起的不便表示抱歉......
|
|
|
|
|
I dont know what your error message is, but it looks like you doing a lot of castin....be sure that the casts are valid and that any objects you cast inherit from the object you are casting to somewhere
Pablo
|
|
|
|
|
thank you for your enthusiastic help!
|
|
|
|
|
Hi All,
I am building an application using directshow to play mp3 and streaming files (e.g. asx format). It work fine when playing mp3, but it always prompt the error message "The source filter for this file could not be loaded." while I can play the link in WMP ..... Would anyone help to provide some possible solution?
Thanks a lot!
|
|
|
|
|
Could someone please give a novice a hand? class data { CString name; CString Address; CString age;};
vector<data> mydata. This will hold data I want to send to a database file.
Can someone show me how to format this class's data each time and send it to/receive from a file?
If I have to use a delimiter then how do I do this correctly and receive it correctly to place in a RECEIVING vector?
Please be patient with my ignorance and teach me!
PLEASE!
C++ is my favorite programming language
-- modified at 20:15 Friday 30th December, 2005
|
|
|
|
|
I would suggest you would need to Serialize your data using CArchive .. Ive bolded those words - use them in google/your fav. search engine and you should be able to find enough examples out there (I dont have any to hand)
.. otoh, a quick look finds :-
http://www.cis.temple.edu/~wolfgang/MFC-STLPaper.PDF[^]
and, even better, a series of 3 articles written by CP guru Ravi Bhavnani, first one is at ...
http://www.codeproject.com/cpp/serialization_primer1.asp[^]
hope this gets you started
There are other ways of course .. you could
1a) open a text file for writing
1b) iterate through your vector
1c) for every class element stored, write the data components, seperated by a delimiter to the file
1d) close the file
2a) open the file for reading
2b) while not eof read a line from the file
2c) parse the line for the delimiters, giving you the data (see tokenising/delimters)
2d) create the class with the data from 2c
2e) store the class from 2d into a vector
2f) close the file
or write and read as xml .. depends what the objective of the exercise is really
'g'
-- modified at 21:48 Friday 30th December, 2005
|
|
|
|
|
I don't understand at all serialization and the CArchive class. I this stage I would be movre comfortable with straight "C++" concepts rather than mixing Microsoft's MFC concepts.
I really do need real life examples to learn from.
Thanks,
Larry
C++ is my favorite programming language
|
|
|
|
|
then I'd suggest you're going to have to put together code that achieves points 1 & 2 of my original post .. MFC has a class CFile thats useful - there's plenty of code around the net that will show you how to use it ..
the link :- http://www.tolland.k12.ct.us/ths/compsci/jeffmaynes/maynes3.pdf[^]
would be a starter ..
other than that, a good c++ textbook should also show you this... Since you brought the point up, I suggested the MFC way of doing it because your data class had 3 CString members/elements, CString is MFC - not pure C++ !!
points 1 and 2 apply wether you're using MFC or not, if not, you'll have to read what the alternative to CFile is
<modified>
you could also look at things 'like' http://www.codeproject.com/file/textfile.asp[^] and using that as a starting point - its not that different to what you'll need to do
</modified>
'g'
-- modified at 2:02 Monday 2nd January, 2006
|
|
|
|
|
Hi-
Here is my problem-- I am having difficulty getting the following to work properly:
//the following was implemented in VS 2003 using Console App (.NET)
<br />
string str ="*********";<br />
str.append("\n psinfo");<br />
str.append("\n*********\n");<br />
<br />
ofstream myfile("C:\\TEMP.txt");<br />
<br />
if (!myfile)<br />
{<br />
cout << "error opening file" << endl;<br />
return -1;<br />
<br />
}<br />
myfile << str << ShellExecute(NULL, "open", "Psinfo.exe",NULL, "C:\\",SW_SHOWNORMAL)<<endl;<br />
myfile.close();<br />
<br />
return 0;
It compiles and runs, its just after execution, when I open the file "Temp.txt", the output is not correct!
here is the output in notepad:
(start output)
*********
psinfo
*********
0000002A
(end output)
So I know that it is writing the string I created and I also know that the Psinfo.exe is executing cause I can see it on the dos prompt. However, the output from the Psinfo.exe is not writing to the text file "TEMP.txt"!
Could anyone shed some light as to why the Psinfo.exe information is not writing to the TEMP.txt file.
FYI- I created a batch file like so...
(start of .bat file)
<br />
@echo off<br />
<br />
rem This env variable stores the log file path.<br />
set PTH=C:\TEMP.txt<br />
<br />
rem Get basic information about the machine.<br />
<br />
echo ************* >>%PTH%<br />
echo * PSINFO -d * >>%PTH%<br />
echo ************* >>%PTH%<br />
psinfo.exe -d >>%PTH%<br />
(end of .bat file)
and when the batch file is executed, the "TEMP.txt" file opened in notepad is similar to the following output:
(start of output)
*************
* PSINFO -d *
*************
System information for
Uptime:
Kernel version:
Product type:
Product version:
Service pack:
Kernel build number:
Registered organization:
Registered owner:
Install date:
Activation status:
IE version:
System root:
Processors:
Processor speed:
Processor type:
Physical memory:
Video driver:
Volume Type Format Label Size Free Free
(end output)
Which is exactly the output I am trying to get in the TEMP.txt file when implemented in VC++!
Thank you for your time.
|
|
|
|