|
Hi,
Can anubody tell me how to retreive the ip address of all pcs connected to LAN with my pc using vc++/mfc.
Thanks
Abinash
|
|
|
|
|
NetServerEnum, just have a look [^]
Величие не Бога может быть недооценена.
|
|
|
|
|
Hi All
I am using
Excel::_ApplicationPtr pApplication; Excel::_WorkbookPtr pBook; for open excel and do some work.For open a excel file i am using this code
pBook = pApplication->Workbooks->Open( (_bstr_t)FileName, varOption, varOption, varOption, varOption, varOption, varOption, varOption, varOption, varOption, varOption, varOption, varOption );
FileName="C:\\test.xlsx"
when file is open then task Manager show excel.exe.Now my problem is when some other file is open manually then two
manual="C:\\test1.xlsx"
excel file is open first one is
FileName then
manual excel .
Can i prevent to open FileName that time or any alternative solution for this problem.
Plz help me
|
|
|
|
|
hi,
i have made a derived class from CDialog to customize it with my bitmaps in which some pixels need to be transparent. I am using TransparentBlt() for the same in OnEraseBkgnd() in derived class after calling CDialog::OnEraseBkgnd(). the thing is happening is those pixels are either coming grey so white sometime. not becoming transparent. Can anyone suggest where i am doing wrong !!!
thanx
|
|
|
|
|
_T("No name") wrote: I am using TransparentBlt() for the same in OnEraseBkgnd()
without seeing the code hard to say...
hope you calls the CDialog::OnEraseBkgnd() before doing the TransparentBlt().
|
|
|
|
|
i am calling it before the TransparentBlt() only..
CDialog::OnEraseBkgnd(pDC);
CRect rcClient;
GetClientRect(rcClient);
CDC memDC;
memDC.CreateCompatibleDC(pDC);
/* TODO : Draw according to state */
/* Title left */
memDC.SelectObject(&m_bmpTitleLeft);
pDC->TransparentBlt(rcClient.left,rcClient.top,10,31,&memDC,0,0,10,31,CLR_TRANSPARENT);
/* Title Middle */
int i = 0;
memDC.SelectObject(&m_bmpTitleMiddle);
pDC->StretchBlt(rcClient.left+10,rcClient.top,rcClient.right-10,31,&memDC,0,0,1,31,SRCCOPY);
/*Title Right*/
memDC.SelectObject(&m_bmpTitleRight);
pDC->TransparentBlt(rcClient.right-10,rcClient.top,10,31,&memDC,0,0,10,31,CLR_TRANSPARENT);
/* set Title text */
pDC->SetBkMode(TRANSPARENT);
CSize szTitle = pDC->GetTextExtent(m_strTitle);
CRect rcTitle(rcClient.left+14,rcClient.top+15-(szTitle.cy/2),rcClient.left+14+szTitle.cx,rcClient.top+15+(szTitle.cy)/2);
pDC->DrawText(m_strTitle,-1,&rcTitle,DT_CENTER || DT_SINGLELINE);
/* set title box rectangle */
CRect rcTitleBox(rcClient.left,rcClient.top,rcClient.right,rcClient.top+31);
m_rcTitleBox = rcTitleBox;
/* set main view rectangle */
CRect rcViewDlg(rcClient.left,rcTitle.bottom,rcClient.right,rcClient.bottom);
m_rcViewDlg = rcViewDlg;
/* Middle right and left area */
memDC.SelectObject(&m_bmpMiddleLeft);
pDC->StretchBlt(rcClient.left,rcClient.top+31,10,rcClient.bottom-10,&memDC,0,0,10,1,SRCCOPY);
memDC.SelectObject(&m_bmpMiddleRight);
pDC->StretchBlt(rcClient.right-10,rcClient.top+31,10,rcClient.bottom-10,&memDC,0,0,10,1,SRCCOPY);
/* Middle ares is done by fill rectangle as drawing bitmap in loops makes it slow */
/* Middle area */
CRect rcMiddle(rcClient.left+10,rcClient.top+31+1,rcClient.right-10,rcClient.bottom-10);
CBrush brushMiddle(RGB(219,230,244));
pDC->FillRect(&rcMiddle,&brushMiddle);
/* Bottom left area */
memDC.SelectObject(&m_bmpBottomLeft);
pDC->BitBlt(rcClient.left,rcClient.bottom-50,10,50,&memDC,0,0,SRCCOPY);
/* Bottom middle area */
memDC.SelectObject(&m_bmpBottomMiddle);
pDC->StretchBlt(rcClient.left+10,rcClient.bottom-50,rcClient.right-10,50,&memDC,0,0,1,50,SRCCOPY);
/* Bottom right area */
memDC.SelectObject(&m_bmpBottomRight);
pDC->BitBlt(rcClient.right-10,rcClient.bottom-50,10,50,&memDC,0,0,SRCCOPY);
memDC.DeleteDC();
return TRUE;
|
|
|
|
|
_T("No name") wrote:
CDialog::OnEraseBkgnd(pDC);
When you call the OnEraseBkgnd base method MFC calls the DefWndProc which will fill the dialog with its associated background brush, so remove this line.
Also, make sure to set the transparent style of the dialog to TRUE
|
|
|
|
|
HI all
DWORD pos = GetMessagePos();
CPoint point;
GetCursorPos(&point);
int nIndex = m_List.GetNextItem(-1, LVNI_SELECTED);
CString strItem = m_List.GetItemText(nIndex, 0);
select_no = m_List.GetSelectionMark();
HMENU hMenu = ::CreatePopupMenu();
if (NULL != hMenu)
{
::AppendMenu(hMenu, MF_STRING, 1, "Update");
::AppendMenu(hMenu, MF_SEPARATOR,2, "");
::AppendMenu(hMenu, MF_STRING, 3, "Delete");
if(strItem.Trim().IsEmpty())
{
::EnableMenuItem(hMenu,1,MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
::EnableMenuItem(hMenu,3,MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
}
int sel = ::TrackPopupMenuEx(hMenu,TPM_LEFTALIGN|TPM_RETURNCMD,point.x,point.y,m_hWnd,NULL);
switch(sel)
{
case 1:
{
}
break;
case 3:
{
}
break;
}
}
thanks
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
What problem do you face?
|
|
|
|
|
Hi, all there:
I was doing some stuff on windows update download&install using wuapi, and this done already.
Now I wanna implement a schedule reboot prompts, just like windows os do after auto windows update, which you can select "reboot after XX minites" or "reboot now".
Does anyone know how to implement this? Can WUAPI do this? Or some other way?
Any replay is appreciated!!
above.
|
|
|
|
|
|
Thanks very much for your help!!
I'll check your url
|
|
|
|
|
as far as I know, the only difference between CMutex and CCriticalSection is that CMutex works at the kernel level and so can be used across process boundaries
So why can you specify the timeout with CMutex::Lock method, but not in CCriticalSection::Lock?
CMutex mutex;
mutex.Lock( 1000 );
CCriticalSection critsec;
critsec.Lock( 1000 );
|
|
|
|
|
At the API level, you can use any of the Wait functions like WaitForSingleObject to wait on a mutex but not on a critical section. That is why the MFC wrappers work in a similar fashion.
For a mutex there is an associated handle.
But for a critical section there is not handle.
|
|
|
|
|
midiway wrote: So why can you specify the timeout with CMutex::Lock method, but not in CCriticalSection::Lock?
Because EnterCriticalSection() API does not accepts a timeout parameter
|
|
|
|
|
A critical section is a higher level construct than a mutex. The current critical section wraps a semeaphore it uses for locking when it has to wait. Before it waits it will spin in user mode to avoid the costly transition to kernel mode and thread context switch.
You have two options to use a timeout with a critical section:
1. (Not recommended) Write a function that uses the internal LockSemaphore. You have to duplicate the functionality for EnterCriticalSection() but allow a timeout to be passed to the wait on the semaphore.
2. Spin on TryEnterCriticalSection. Use GetTickCount to check when you time out. Make sure you do this right. Read up on YieldProcessor, SwitchToThread and Sleep/SleepEx. This is only usefull if you _have to_ use a ctirical section and you _have to_ be able to timeout.
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Hi,
as a result of some calculations in my program, a text file of about 15Gb is created. It contains a very, very long list of numbers like this:
32.2216
32.2425
211.372
34.3651
53.2281
118.987
26.7481
198.789
54.2434
110.048
110.031
222.574
109.283
29.8529
When the program reads it afterwards (to make further calculations based on these data), it halts giving this error message:
terminate called after throwing an instance of 'std::ios_base::failure'
what(): basic_ios::clear
Aborted
I'm using Linux. Can anyone tell me why this happens and if there's a solution? Thanks.
|
|
|
|
|
A simple (?!) work around would be splitting the file.
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]
|
|
|
|
|
15 GB text file?
Which file system you are using?
Величие не Бога может быть недооценена.
modified on Monday, November 2, 2009 3:34 AM
|
|
|
|
|
Hi, I'm using ReiserFS. Wikipedia says that the maximum file size is 8Tb. I guess splitting the file in chunks may be a good option. But anyway, what's the nature of the error?
|
|
|
|
|
Hi, the problem is solved. It was not an issue of how large the file was, but of an index in an array out of script. Thanks for your help!
|
|
|
|
|
Hi,
I tried to read in the some numbers in a file. I did following:
wifstream is(pFileName);
int int1 = 0, int2 = 0;
is >> int1 ;
is >> int2 ;
The "int1" and "int2" are always "0".
What is wrong?
Thanks
modified on Sunday, November 1, 2009 4:41 PM
|
|
|
|
|
What do you see when you open the file manually?
|
|
|
|
|
Hi
I can read in wide string. But I can not read numbers. I can get string by using "read" function. But I can not get anything back using operator ">>".
Thanks,
|
|
|
|
|
I suspect the numbers as you mention are stored as strings in your file.
If it is stored as numbers, it should not make any sense when you open the file manually.
|
|
|
|
|