|
I used function VarBstrFromI1 conver char to BSTR:
//Adsoft.cpp
STDMETHODIMP CMyData::get_CGetComputerName(BSTR *pVal)
{
// TODO: Add your implementation code here
char szHostName[200];//char* szHostName
gethostname(szHostName,strlen(szHostName));
struct hostent* strTemp;
strTemp=gethostbyname(szHostName);
if(strTemp !=NULL)
strcpy(szHostName,strTemp->h_name);
BSTR* abc;
if(VarBstrFromI1(szHostName,abc)==S_OK)
pVal=abc;
return S_OK;
}
Program error:
error C2660: 'VarBstrFromI1' : function does not take 2 parameters
-- modified at 0:19 Friday 26th August, 2005
|
|
|
|
|
Thangnc wrote:
if(VarBstrFromI1(szHostName,abc)==S_OK)
error C2660: 'VarBstrFromI1' : function does not take 2 parameters
reflecting a bit, what does the error description tells you ?
it is because you call VarBstrFromI1 with two parameters, when it does take 2 ones.
see its declaration/definition to understand how it works...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I'm amazed that you even bothered to reply. You must have a young and not yet tired soul!
Good music: In my rosary[^]
-- modified at 15:42 Friday 26th August, 2005
|
|
|
|
|
Jörgen Sigvardsson wrote:
You must have a young and not yet tired soul!
maybe... or i was just under a good day !
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I created project Client/Server by ATL export file Adsoft.DLL.
But Build to appear any error.
MySocket.obj : error LNK2001: unresolved external symbol __imp__socket@12
Debug/AdSoftClientDLL.dll : fatal error LNK1120: 1 unresolved externals
//Adsoft.idl
[id(1), helpstring("method Get")] HRESULT SetPort();
//Adsoft.cpp
STDMETHODIMP CMySocket::SetPort()
{
// TODO: Add your implementation code here
SOCKET m_str;
m_str=socket(AF_INET,SOCK_STREAM,0);// error when to call function a here
if(!m_str)Messabox(NULL,"ERROR !!!","?????",MB_OK)
return S_OK;
}
if can you send back to give me a example
Thanks All !
|
|
|
|
|
Have you called the initialisation function for the sockets library?
Steve S
Developer for hire!
|
|
|
|
|
I write all idem.I unused direction for use function this
You can help me? I am in urgent need of project
Thanks Steve S!
|
|
|
|
|
Now I've read the question properly...
You aren't linking with the WinSock library. You need to add either wsock32.lib or ws2_32.lib to the options for the linker, depending on whether you're using Winsock 1.x or 2.x
You do this from the project property pages, specifically the Input property page in the Linker folder.
Steve S
Developer for hire!
|
|
|
|
|
To succeed beyond one's expectations .
Thank you very much !
|
|
|
|
|
Hi i am new to STL .can any one suggest me a good article with which i can start learning STL.
|
|
|
|
|
|
Nithya.. wrote:
can any one suggest me a good article with which i can start learning STL.
This section will help:-
http://www.codeproject.com/vcpp/stl/[^]
"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
|
|
|
|
|
|
toxcct wrote:
little finger faster faster...
Litle tox getting faster and faster and faster ................ , hows you study going!
"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
|
|
|
|
|
ThatsAlok wrote:
hows you study going
it's not the easiest period... the last project has just started on for 1 month, and i have to continue the Series 2 & 3 + the new version of VisualCalc (most important feature is to put the Parser into its own class, into its own DLL too)...
hey, about that, maybe you could help me ; i'll making some researches by my side on this, but the help of some other good programmers may help.
As i never did this before, i wonder how i can load what i put in a dll into the exe project... of course, i would prefer a dynamic link...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
As i never did this before, i wonder how i can load what i put in a dll into the exe project... of course, i would prefer a dynamic link...
thats very simple, when ever you need just mail me! i am always on your side!
"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
|
|
|
|
|
sure, but posting on the forum would permit everybody to aknowledge on the subject...
however, i just found smth interresting on that point, so i think i have enough infos for the moment to realize this.
thx anyway.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi Tox,
toxcct wrote:
As i never did this before, i wonder how i can load what i put in a dll into the exe project... of course, i would prefer a dynamic link...
What do you mean by that ? Maybe I can help 'cause I'm quite familiar with dynamic loading of dll's...
Just let me know if I can help.
|
|
|
|
|
actually, i am expecting to separate the parser of my VisualCalc into its own class, but deported toward a new DLL.
but as i never made MFC DLLs, and never called DLL into a MFC program, i don't know how to do this.
but as i said to Alok, a teacher gave me today a good tutorial on the subject, so i'll try it when i have some time (on evening)...
now, you say you're familiar with dynamic loaded library ; i accept any advice on that coding, even if i found how to solve my problem...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
cedric moonen wrote:
I'm quite familiar with dynamic loading of dll's...
Me too... But i believe you got much more Knowledge in this and almost every regard!
"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
|
|
|
|
|
If I want an STL list to contain either ints or floats and I want to allow the user to make the decision at runtime (i.e. via a prompt) who can I accomplish that? Pseudo:
list myList;
if (user_says_int)
myList = list<int>;
else
myList = list<float>;
|
|
|
|
|
i don't know if there's a more simple way ; here is what i suggest. Make some wrappers for the types you want to decide on, and each should inherit from a base class :
class Types {
};
class Integer : public Types {
public:
int Value;
int operator int() { return Value; }
};
class Float : public Types {
public:
float Value;
float operator float() { return Value; }
};
then, your list will always be a list<Types> but the polymorphism will allow you to use either int or float...
see what i mean ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
see what i mean ?
Yes, but it probably doesn't work as desired. You can insert 'Types' objects into the list but cannot do much with them afterwards.
|
|
|
|
|
Roland Pibinger wrote:
You can insert 'Types' objects into the list but cannot do much with them afterwards
sure you can, as Integer and Float classes inherit from Types , a list of Types will be a list of Integer s and/or Float s...
list<Types> myList;
Integer i = 5;
Float f = 2.1;
myList.add(i);
myList.add(f);
of course, the Types, Integer and Float classes must provide the necessary functions sur as constructors, operator=, etc...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
No, that won't work. You need pointers to Types (or references, but you can't put those in containers) in order to use polymorphism. Use something like:
<br />
list<Type*> theList;<br />
theList.push_back(new Int(5));<br />
theList.push_back(new Float(2.1));<br />
Of course, you need to manage the pointers so that the memory's not leaked (storing boost::shared_ptr<Type> would be my preferred approach)
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|