|
HI,
Is there any restriction that Dll should be in the same folder with Client exe or system folder ?
Can i place DLL any where and can Call ?
waiting for your precious advice.
Thanks,
Rayalu
|
|
|
|
|
See "Dynamic-Link Library Search Order" at MSDN .
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]
|
|
|
|
|
Your dll has to be found by your application, which means that it should either be in the system folder or in the same folder of your application. However, if you explicitely load your dll (by using LoadLibrary), you can place it anywhere you want and specify the path of the dll in the call to LoadLibrary.
|
|
|
|
|
Cedric Moonen wrote: However, if you explicitely load your dll (by using LoadLibrary), you can place it anywhere you want and specify the path of the dll in the call to LoadLibrary.
I think you may do the same thing with implicit loaded DLLs if you specify the path of the dynamic libraries in the application mainifest (anyway I never made a test...).
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]
|
|
|
|
|
It also works implicit if you specify the path.
I used it to reference to the debug or release version of some dll I wrote, depending on some project setting.
Greetings
Covean
|
|
|
|
|
|
Thanks Cédric Moonen
I did same.
|
|
|
|
|
Hi all,
I have loaded a image to a bitmap object using LoadImage function. After i used the bitmap object to a button,whether can i use the same object to add image to other buttons. Will the object have the image handle? Can i use more than once that bitmap object. I tried to add that bitmap object to other buttons, its not woring.
Thanks,
|
|
|
|
|
I guess the pronlem is in your code, but I can't see it...
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]
|
|
|
|
|
What I'm doing wrong , because LPHOSTENT lpHostEnt is null :
SOCKET m_hSocket;
LPHOSTENT lpHostEnt;
CString sServer = "smtp.gmail.com";
lpHostEnt = gethostbyname(sServer);
if(lpHostEnt == NULL)AfxMessageBox("lpHostEnt is NULL");
|
|
|
|
|
There seems to be a problem with this address. Try accessing it via your browser to check if it is correct.
It's time for a new signature.
|
|
|
|
|
We don't know, but the runtime knows! use WSAGetLastError and check the error code.
|
|
|
|
|
A NULL return value usually means that you are looking up a non existent hostname. What does WSAGetLastError() return?
if(lpHostEnt == NULL)
{
CString sOutput;
sOutput.Format("Non existing hostname, error %d", ::WSAGetLastError());
AfxMessageBox(sOutput);
}
Chat in Europe Now with 24% more Twitter
modified on Thursday, May 6, 2010 3:47 AM
|
|
|
|
|
I will try this things , later , ( now I'm at job ) and surely reply ! Thank you !
|
|
|
|
|
As I promise , I'm back , here is error :
Non existing hostname, error 10093
And if I type smtp.gmail.com in address bar of my browser ( IE8 ) , I get no page ...
What should I do ?
|
|
|
|
|
According to MSDN 10093 means: Either the application has not called WSAStartup, or WSAStartup failed.
You need to call WSAStartup()[^] once in your application, see Winsock FAQ[^] for example code.
Hope this helps
|
|
|
|
|
Here is my entire code :
SOCKET CSmtp::ConnectRemoteServer(CString sServer, UINT nPort)
{
short nProtocolPort;
LPHOSTENT lpHostEnt;
LPSERVENT lpServEnt;
SOCKADDR_IN sockAddr;
SOCKET hServerSocket = INVALID_SOCKET;
struct in_addr addr;
if(atoi(sServer.Left(1)) == 0)lpHostEnt = gethostbyname(sServer);
else
{
addr.s_addr = inet_addr(sServer);
if(addr.s_addr == INADDR_NONE)
{
m_nError = CSMTP_BAD_IPV4_ADDR;
return INVALID_SOCKET;
}
else lpHostEnt = gethostbyaddr((char *)&addr,4,AF_INET);
}
if(lpHostEnt != NULL)
{
if((hServerSocket = socket(PF_INET,SOCK_STREAM,0)) != INVALID_SOCKET)
{
if(nPort)nProtocolPort = htons(nPort);
else
{
lpServEnt = getservbyname("mail",0);
if(lpServEnt == NULL)nProtocolPort = htons(25);
else nProtocolPort = lpServEnt->s_port;
}
sockAddr.sin_family = AF_INET;
sockAddr.sin_port = nProtocolPort;
sockAddr.sin_addr = *((LPIN_ADDR)*lpHostEnt->h_addr_list);
if(connect(hServerSocket,(PSOCKADDR)&sockAddr,sizeof(sockAddr)) == SOCKET_ERROR)
{
m_nError = CSMTP_WSA_CONNECT;
hServerSocket = INVALID_SOCKET;
}
}
else
{
m_nError = CSMTP_WSA_INVALID_SOCKET;
return INVALID_SOCKET;
}
}
else
{
m_nError = CSMTP_WSA_GETHOSTBY_NAME_ADDR;
return INVALID_SOCKET;
}
return hServerSocket;
}
and here I try :
CString sServer = "smtp.gmail.com";
if((m_hSocket = ConnectRemoteServer(sServer,25)) == INVALID_SOCKET)
{
m_nError = CSMTP_WSA_INVALID_SOCKET;
return FALSE;
}
modified on Thursday, May 6, 2010 12:13 PM
|
|
|
|
|
Is it safe to load dll compiled in Visual studio 2005 into application compiled in the Visual studio 6?
|
|
|
|
|
|
That depends on the interface of the DLL. If COM-dll or C-dll that static link to the CRT then no problem.
If exporting C++ interfaces that makes use of the STL or uses shared heap, then the DLL must be compiled using the same version of Visual Studio.
|
|
|
|
|
how to call srand(time(NULL));
When compile, I got:
: error C2064: term does not evaluate to a function
at the line:
srand(time(NULL));
Please help to identify what I missing?
|
|
|
|
|
try this:
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int main( void )
{
int i;
srand( (unsigned)time( NULL ) );
for( i = 0; i < 10;i++ )
printf( " %6d\n", rand() );
printf("\n");
{
int RANGE_MIN = 0;
int RANGE_MAX = 100;
for (i = 0; i < 10; i++ )
{
int rand100 = (((double) rand() /
(double) RAND_MAX) * RANGE_MAX + RANGE_MIN);
printf( " %6d\n", rand100);
}
}
}
|
|
|
|
|
Xing Chen wrote:
int rand100 = (((double) rand() /
(double) RAND_MAX) * RANGE_MAX + RANGE_MIN);
ftfy:
int rand100 = (((double) rand() /
(double) RAND_MAX) * (RANGE_MAX - RANGE_MIN) + RANGE_MIN);
Software rusts. Simon Stephenson, ca 1994.
modified on Thursday, May 6, 2010 3:17 AM
|
|
|
|
|
What exactly does casting the return value of time() to unsigned do to address the C2064 error?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I put you suggested. I got the same problem in my program.
I tested in a small program, it OK. Someconflict with my program.
Thanks
|
|
|
|