|
If RegSetValueEx() is failing, why are you not calling GetLastError() ?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Can anybody suggest me a method for geting the Ip address of the computer.
Thanks in advance
With Regards
Deepu
|
|
|
|
|
void GetHostIP()
{
char *Ip;
WSADATA wsaData;
struct hostent *pHostEnt;
struct sockaddr_in tmpSockAddr;
WSAStartup(MAKEWORD(2,0),&wsaData);
char hostname[25];
strcpy(hostname,"Test Computer Name")
pHostEnt = gethostbyname(hostname);
if(pHostEnt == NULL)
{
printf("Error occured: %s\n",GetLastError());
return;
}
memcpy(&tmpSockAddr.sin_addr,pHostEnt->h_addr,pHostEnt->h_length);
Ip = NULL;
Ip = new char[17];
strcpy(Ip,inet_ntoa(tmpSockAddr.sin_addr));
printf("Ip Address of the machine %s is %s\n",Ip);
WSACleanup();
delete [] Ip;
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Please tell me the header files to be included.
|
|
|
|
|
Use gethostbyname function...
Regards,
Rane
|
|
|
|
|
Can u tell me the header files to be included.
It is showing as "undeclared identifier".
|
|
|
|
|
Documentation Check here [^]
Regards,
Sandip.
|
|
|
|
|
Hi all
How can make a application which run program as a system service? Plz help me
|
|
|
|
|
Check out this link.[^]
Regards,
Rane
|
|
|
|
|
Services[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
i m using CListCtrl wit LVS_SHOWSELALWAYS and LVS_EX_FULLROWSELECT property.
here multiple items are select with the help of mouse.
i want only one row select at any condition.
please tell me how can i do this.
if possible please explain with example.
i waiting for your valuable suggestion and replies.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
One way would be to handle the click event on the list. Save the index of the selected item in some member variable. Once the user clicks on an item other than the selected one use SetItemState and SetSelectionMark to get this done. You already have the previously selected item index stored and can get the current one easily
Hope this helps
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
"_$h@nky_" wrote: i want only one row select at any condition.
set the LVS_SINGLESEL style.
|
|
|
|
|
thanks.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hello dear friends,
How can I get the all drive name of PC?
|
|
|
|
|
is _getdrive() helpful?
From MSDN:
int main( void )
{
int ch, drive, curdrive;
static char path[_MAX_PATH];
curdrive = _getdrive();
printf( "Available drives are:\n" );
for( drive = 1; drive <= 26; drive++ )
{
if( !_chdrive( drive ) )
{
printf( "%c:", drive + 'A' - 1 );
if( _getdcwd( drive, path, _MAX_PATH ) != NULL )
printf( " (Current directory is %s)", path );
putchar( '\n' );
}
}
_chdrive( curdrive );
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thx's _AnShUmAn_
It's working..
Now i want to add these drive name in edit box then i am geting some problem.When i am adding these drive name in edit box then first and last name is added.Middle one is skip..i am useing this code
GetDlgItemText(IDC_EDIT_DIR_TO_MONITOR,m_strDirectoryToMonitor);
if(m_strDirectoryToMonitor.Trim().IsEmpty())
{
SetDlgItemText(IDC_EDIT_DIR_TO_MONITOR,b);
}
else if(!m_strDirectoryToMonitor.Trim().IsEmpty())
{
SetDlgItemText(IDC_EDIT_DIR_TO_MONITOR2,b);
}
plz help me
|
|
|
|
|
|
JFYI- you can ignore this statement [if(!m_strDirectoryToMonitor.Trim().IsEmpty())]. It doesn't server the purpose, since if the string is empty it would be processed in the if part otherwise the else part...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Use GetLogicalDriveStrings()
|
|
|
|
|
Hello everyone,
For COM STA, there is a owner thread. My questions is, when the thread needs to communicate with components in other apartments, whether the owner thread will be blocked?
My current experiment and study results is, the STA owner thread is not blocked, it is the RPC thread (which is used for underlying communication with other apartment to send method call and retrieve method return result) will be blocked. But I am not 100% sure about this. Any comments or ideas?
thanks in advance,
George
|
|
|
|
|
I think we covered this half a year ago in this forum thread[^].
All calls in COM are blocking, i.e. the thread of the caller will be blocked until the callee returns. All methods in a COM interface returns a HRESULT that tells the caller whether the call succeeded or failed. If the call wasn't blocking the returned value would be completely bogus.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thanks Roger,
I remember what we discussed before. Here is what I found from MSDN, looks like our previous conclusion, the STA owner thread will be blocked is not correct, it should be the RPC thread blocked, and STA owner thread continues to deal with message pump?
http://msdn.microsoft.com/en-us/library/ms809311.aspx[^]
Refer to section "Single-Threaded Apartments (STA)", especially figure 6, 8 and 9. Any comments?
regards,
George
|
|
|
|
|
George_George wrote: STA owner thread continues to deal with message pump
It depends on what you mean by "continues".
The call does not return to the client until the server has serviced the call.
Of course the hidden COM window processes COM related messages in order to received the response from the server and the HRESULT of the call.
Try to experiment with this:
Create a small out-of-process server with "sleep"-functionality.
Create a client that calls the "sleep" function and see what happens. Try move the client window around during the call to the server.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|