|
How are you using NetServerEnum() to "check whether my system is connected to lan or not?"
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
void CNetWorkTryDlg::CheckNetworkStatus()
{
while (true)
{
LPSERVER_INFO_101 pBuf = NULL;
LPSERVER_INFO_101 pTmpBuf;
DWORD dwLevel = 101;
DWORD dwPrefMaxLen = MAX_PREFERRED_LENGTH;
DWORD dwEntriesRead = 0;
DWORD dwTotalEntries = 0;
DWORD dwTotalCount = 0;
DWORD dwServerType = SV_TYPE_SERVER; // all servers
DWORD dwResumeHandle = 0;
NET_API_STATUS nStatus;
LPCWSTR pszServerName = NULL;
DWORD i;
// Call the NetServerEnum function to retrieve information
// for all servers, specifying information level 101.
//
nStatus = NetServerEnum(pszServerName,
dwLevel,
(LPBYTE *) &pBuf,
dwPrefMaxLen,
&dwEntriesRead,
&dwTotalEntries,
dwServerType,
NULL,
&dwResumeHandle);
//
// If the call succeeds,
//
if ((nStatus == NERR_Success) || (nStatus == ERROR_MORE_DATA))
{
if ((pTmpBuf = pBuf) != NULL)
{
m_Status.SetWindowText("Network connected");
}
else
{
m_Status.SetWindowText("Network disconnected");
}
}
else
{
m_Status.SetWindowText("Network disconnected");
}
//
// Free the allocated buffer.
//
if (pBuf != NULL)
NetApiBufferFree(pBuf);
Sleep(2000);
}
}
|
|
|
|
|
If I work on a non-XP environment, I can make a group box disable. Can anyone help me out to do the same thing in XP?
BabuZaleela
|
|
|
|
|
AFAIK, you can't do this with XP styles, the disabled group box looks just like the enabled one.
- Dy
|
|
|
|
|
Hi,
I have created a dialog based application in MFC, I have a button and I would move it togheter with the border when i resize the window, how can i do?
Leti
|
|
|
|
|
Use MoveWindow(...) or SetWindowPos(..) on OnSize method of the window.
|
|
|
|
|
Easiest way is to use ResizableDialog[^]
You just need to define which buttons should snap to which edges of your window, and it handles the rest for you
--
Help me! I'm turning into a grapefruit!
Buzzwords!
|
|
|
|
|
See the Extras section of this article.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
I have created a menu in win32 api.In that menu i have inserted "Word","excel" like menus.In that when i clicked word it opens word document,in word i enter a some text and when i am going to save the document it should save only in particular folder only .How it can be possible.Give me some idea to do me.
|
|
|
|
|
Put the address of the folder in which you want to save your documents into the registry (at the time of opening the document).These changes will be made to the registry entry of Word.Now when you ask word to save a file it would automatically read the same path always.
You will have to search where word stores these registry values
Give it a Try at this and if you have some problem get back to me.
Wishes.
Anshuman Dandekar
Dare to Dream,
Care to Achieve.............
-- modified at 7:24 Wednesday 8th February, 2006
|
|
|
|
|
That ok sir using win32 api is any function to control the operation.If i use that in my application it will affect the actual word operation or not.
|
|
|
|
|
Search MSDN for
GetOpenFileName / GetSaveFileName function .
Wishes.
Anshuman Dandekar
Dare to Dream,
Care to Achieve.............
|
|
|
|
|
Hi all
During debugging i am not able to see the full string in a CString variable . It always shows the first letter of the string .
For ex
CString var = "hello";
the debugger variables windows shows "h" and pchData. IS there anyway to make it show full value ?
redindian
|
|
|
|
|
|
hi
the result is same ..
redindian
|
|
|
|
|
Are you sure you have not loaded an Unicode string in your CString while compiling in non Unicode mode ?
~RaGE();
|
|
|
|
|
You options need to be set to show Unicode strings... In VC6.0:
Tools menu
Options...
Debug Tab
Display Unicode Strings
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
You may post this to the original threader, next time
~RaGE();
|
|
|
|
|
CString var;
var.Format(_T("hello"));
|
|
|
|
|
Use this instead in the Watch window:
var.m_pchData,su
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
I have 10 set of x and y values..i have to draw graph for this 10 values..
anybody can give sample code for drawing graph in MFC...i need a sample code..
Pls help me..
|
|
|
|
|
Just giving a simple process
This is the drawing method
<code>
INT nY1 = LPtoDP(AXIS_Y, dblDataY.GetAt(0));
INT nX1 = LPtoDP(AXIS_X, dblDataX.GetAt(0));
pDC->MoveTo(nX1, nY1);
for (int i=0; i < dblDataX.GetCount();i++)
{
INT nY2 = LPtoDP(AXIS_Y, dblDataY.GetAt(i));
INT nX2 = LPtoDP(AXIS_X, dblDataX.GetAt(i));
pDC->LineTo(nX2, nY2);
}
</code>
besides this you need two additional funtion for converting form actual data to sceen coordinate and vise versa
<code>
LPtoDP( AXIS_TYPE AxisType, DOUBLE dblData)
{
switch(AxisType)
{
case AXIS_X:
nPos = (INT)(m_dblOrgX + ( dblData * m_dblScaleFactorX ));
break;
case AXIS_Y:
nPos = (INT)(m_dblOrgY + ( dblData * dblScaleFactorY ));
break;
default:
return 0;
}
return nPos;
}
</code>
DPtoLP( AXIS_TYPE AxisType, DOUBLE dblData )
{
switch(AxisType)
{
case AXIS_X:
wdPos = (WORD)( (dblData - m_dblOrgX) / m_dblScaleFactorX);
break;
case AXIS_Y:
wdPos = (WORD)((m_dblOrgY - dblData) / m_dblScaleFactorY);
break;
default:
return 0;
}
return wdPos;
}
And also find minmum and maximum of all the data and use this to calculate the scale factor
CalcScaleFactor( CRect rctDrawArea )
{
DOUBLE dblScaleRangeX = m_dblScaleMaxX - m_dblScaleMinX;
DOUBLE dblScaleRangeY = m_dblScaleMaxY - m_dblScaleMinY;
m_dblScaleFactorX = ( dblScaleRangeX == 0 ) ?
0 : (DOUBLE)rctDrawArea.Width() / dblScaleRangeX;
m_dblScaleFactorY = ( dblScaleRangeY == 0.0 ) ?
0 : (DOUBLE)rctDrawArea.Height() / dblScaleRangeY;
m_dblOrgX = rctDrawArea.left - ( m_dblScaleMinX * dblScaleFactorX );
m_dblOrgY = rctDrawArea.bottom + ( m_dblScaleMinY * dblScaleFactorY );
}
}
There are some member variables in the code you can understand by close look at the code. Just simple of drawing graph is convert your points to screen coordiante and then simple line draw between points.
|
|
|
|
|
|
Hi. To obtain an horizontal scrolling text, I created a transparent window on which I move a text. After I set the windows as TOPMOST, so my application can show messages like a TV. The problem is that sometimes, other applications create a TOPMOST window too. So, using a timer, I look if my window is on top; if not I call:
if ((WindowOverMine = GetWindow(myWindow, GW_HWNDFIRST)) != myWindow)
SetWindowPos(myWindow, WindowOverMine, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
In this way everything works fine... only a problem... I can't click another window or menu of my application... I think because the transparent window is ALWAYS over the others. It doesnt'happen with other application windows . Have you a suggestion ??
Thank you !
|
|
|
|
|
Why don't you set a region for your transparent window to have the holes in places where your menu should be clickable?
OlZeBest
|
|
|
|