|
GetWindowRect or GetWindowRgn
|
|
|
|
|
thanks......
|
|
|
|
|
Define window position...
If it's the window position relative to the screen top-left corner, use GetWindowRect
If it's the window position relative to its parent window's top-left corner, use GetClientRect
If it's for storing the window position so you can open it at the same place next time it's run, use GetWindowPlacement
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
Hello experts,
Developers sometimes provide ways for other programmers to interact with their application using API they've created.
Those API somehow "talk" with the original application they belong to.
So if application A was written by someone, application B (which was written by someone else) can do this "talking" with A using A's APIs.
I see no problem in developing a DLL which exposes functions.
But how do I go about making my DLL able to talk with my app when used by another external application?
Thanks in advance,
Shy.
|
|
|
|
|
Shy Agam wrote: But how do I go about making my DLL able to talk with my app when used by another external application?
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]
|
|
|
|
|
Add interfaces direcly to your application, and expose them as COM objects. Registering the COM server will thereafter ensure that other applications can instantiate and talk to your application.
|
|
|
|
|
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?
|
|
|
|
|