|
Manmohan29 wrote: _itoa_s(field0, a, 4, 10);
ips += a;
You could change this to:
ips = a; and eliminate the "reset" at the bottom of the loop.
Manmohan29 wrote: LCDevices.SetItemText(c, 1, _T("Testing"));
This should probably be:
LCDevices.SetItemText(t, 1, _T("Testing"));
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
I did what you told but
values after inserting a breakpoint after
c++;
ips "192.168.0.9"
t 9
c 10
ips "192.168.0.10"
t 2
c 11
the problem is still there.
Future Lies in Present.
Manmohan Bishnoi
|
|
|
|
|
I'm not sure what you are asking or showing. When you call InsertItem() , it will return the index of the item that was added. This index is used in subsequent calls to SetItemText() . If you have anything other than that, your code will not work correctly.
Feel free to show the updated code.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
void CaDlg::OnBnClickedBrefreshdevices()
{
m_ctlStatus.SetString(_T("Not Functional"));
UpdateData(FALSE);
unsigned int field0 = 0, field1 = 0, field2 = 0, field3 = 0;
CString ips = _T("");
char a[4] = "";
int t=0,c=0;
for(field0 = 192; field0 <= 192; field0++)
{
for(field1 = 168; field1 <= 168; field1++)
{
for(field2 = 0; field2 <= 255; field2++)
{
for(field3 = 0; field3 <= 255; field3++)
{
_itoa_s(field0, a, 4, 10);
ips = a;
ips += '.';
_itoa_s(field1, a, 4, 10);
ips += a;
ips += '.';
_itoa_s(field2, a, 4, 10);
ips += a;
ips += '.';
_itoa_s(field3, a, 4, 10);
ips += a;
t = LCDevices.InsertItem(c, ips);
c++;
LCDevices.SetItemText(t, 1, _T("Testing"));
}
}
}
}
}
I am using index in subsequent calls to SetItemText().
but still when t = 10 then it becomes t = 2 (binary 10).
one more thing the counting is like this:-
ips "192.168.0.0" t = 0
.
.
.
ips "192.168.0.9" t = 9
ips "192.168.0.10" t = 2
.
.
.
ips "192.168.0.20" t = 13
.
.
.
ips "192.168.0.99" t = 99
ips "192.168.0.100" t = 3
ips "192.168.0.101" t = 4
ips "192.168.0.102" t = 5
Future Lies in Present.
Manmohan Bishnoi
|
|
|
|
|
While not related to your problem (at least I don't think so), you could shorten it down a bit to:
int c = 0;
for (unsigned int field2 = 0; field2 <= 255; field2++)
{
for (unsigned int field3 = 0; field3 <= 255; field3++)
{
CString ips;
ips.Format(_T("192.168.%u.%u"), field2, field3);
int nIndex = LCDevices.InsertItem(c, ips);
LCDevices.SetItemText(nIndex, 1, _T("Testing"));
c++;
}
}
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Hi. Well... I have a trouble with scrollbars. In my (developer) computer it all looks great! BUT in any other computer it looks incorrectly. The first time, when i create the window scrollbars are painted on the border of the dialog instead of the inside of the window. And when i resize it, it repaints the window correctly with the scrollbars inside.
This i wrote in OnCreate
this->EnableScrollBar(SB_VERT);
this->EnableScrollBar(SB_HORZ);
And this is at OnInit
this->SetScrollRange(SB_HORZ,0,2*STARTPIXELX+MAPSQUARE*FIELDSIZE);
this->SetScrollRange(SB_VERT,0,2*STARTPIXELY+MAPSQUARE*FIELDSIZE);
SCROLLINFO info;
info.cbSize = sizeof(info);
info.fMask = SIF_ALL | SIF_DISABLENOSCROLL;
info.nMin = 0;
info.nMax = 2*STARTPIXELY+MAPSQUARE*FIELDSIZE;
CRect rr;
this->GetClientRect(&rr);
info.nPage = rr.bottom-rr.top;
info.nPos = 0;
info.nTrackPos = 0;
SetScrollInfo(SB_VERT,&info);
info.nPage = rr.right-rr.left;
info.nMax = 2*STARTPIXELX+MAPSQUARE*FIELDSIZE;
SetScrollInfo(SB_HORZ,&info);
this->ShowScrollBar(SB_VERT);
this->ShowScrollBar(SB_HORZ);
My dialog has application window, Overlapped, resizing border styles. Pls help!
|
|
|
|
|
Well.. A found a solution.. I don't like it, but it works.
void MainDial::OnTimer(UINT_PTR nIDEvent)
{
if (theApp.First)
{
CRect rr;
this->GetWindowRect(&rr);
rr.right-=1;
rr.bottom-=1;
MainDial::MoveWindow(rr);
theApp.First=false;
}
}
modified on Friday, October 23, 2009 6:53 PM
|
|
|
|
|
You could put this in OnSize and check.
|
|
|
|
|
The problem is that after OnSize it shows all correct, that's why i use MoveWindow in my timer. But my problem is how to make that right after OnInit it draws correctly? I resolved it only with timer... And by the way.. WHY it's all working on MY computer and on any other not?!?! (I have VS2008 SP1 and Windows XP SP3)
|
|
|
|
|
You can try another method.
Create a custom message and map it to a handler using ON_MESSAGE[^].
In the OnInitDialog function to a PostMessage[^] for your custom message.
In the message handler you could put the code that is in the timer.
|
|
|
|
|
Solution found.
LRESULT MainDial::OnMyMsg(WPARAM, LPARAM)
{
CRect rr;
this->GetWindowRect(&rr);
rr.bottom-=1;
rr.right-=1;
MainDial::MoveWindow(rr);
return NULL;
}
with ON_MESSAGE use.
Big thnx.
modified on Friday, October 23, 2009 8:30 PM
|
|
|
|
|
|
I'm looking for a MEE that can handle number expressed with factions.
Example: A user may use 3.5 * 4 7/8 or 3 1/2 * 4.875
I see a lot of MEE but do not want to go through each one.
Any help, pointers would be helpful
Thanks
Tony Teveris
Gerber Scientific Products
Senior Software Engineer
Phone: 860 648 8151
Fax: 860 648 8214
83 Gerber Road West
South Windsor, CT 06074
|
|
|
|
|
Are you looking for a seriously advanced one (see this thread), or just one to handle 4-5 basic operators? The latter cab be done via a basic RPN calculator.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
How terrible is it to find out what application has a particular file open?
Clues?
-peter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
Via code?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Absolutely!
I'd love to display status information in my app about why I am having trouble backing up a file.
"File in use by Microsoft Word"
I could of course "guess using the file associations", but it would be cooler to know the actual application using the file.
-peter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
Peter Weyzen wrote: Absolutely!
Several utilities made by SysInternals do this, but they work in conjunction with a file-system driver. Many years ago, there used to be a "How does it work?" blurb on their Web site. I think it was removed even before Microsoft bought them.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Hi,
Saw a lot of posts related to this but still not totally clear -
It appears that even if you override OnOK for all property pages only the first page(1) OnOK override is called. The others are never called even if the user hits OK when page 2-n is active.
Does this means it is difficult to perform additional OnOK processing of the data on pages 2-n when the user dismisses the sheet?
Thanks
modified on Friday, October 23, 2009 2:34 PM
|
|
|
|
|
|
al2500 wrote: The others are never called even if the user hits OK when page 2-n is active.
With a very basic app created, I found this to not be true. Each page's OnOK() method was indeed called.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
But normally you would need any modified page's OnOK called since the user may modify more than one or close from a different page.
Regardless, I think the best method (for me) is as follows (found it in a post here):
Add afx_msg void OnOK(); to the property sheet definition
Add ON_COMMAND(IDOK, OnOK) and
void CMyPropSheet::OnOK()
{
AfxMessageBox("Hello World");
CPropertySheet::EndDialog(IDOK);
}
to the implementation. Then you have access to data memebers of all pages.
|
|
|
|
|
al2500 wrote: But normally you would need any modified page's OnOK called...
Which is exactly what happens, plus the pages that were not selected (i.e., no modifications).
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
David,
Thanks for your help - I see now that it calls OnOK (using afx_msg void OnOK()) for any pages that were viewed and I initially expected all pages to call OnOk regardless so I did not "view" them when testing...
However, I have verified that it only calls OnOK for pages that were viewed. This is OK with me but it might be good to understand why your behavior is different.
My code is -
For each page definition-
afx_msg void OnOK();
For each implementation -
ON_COMMAND(IDOK, OnOK)
void CPageN::OnOK()
{
AfxMessageBox("PageN");
CPropertyPage::OnOK();
}
Again, thanks for the help. It's actually much cleaner to perform any data validation/storage in the page implementation vs. the sheet implementation.
|
|
|
|
|
Messing around trying to learn something and I'm having trouble seeing the time benefits in my openMP example.
Each array (pArray1 and pArray2) hold about 10meg of RGB bitmap data, bufferSize2 is the bmp file size. OpenMP is enabled in VS.
So I can run the following with or without #pragma and get the same 20Msec's or there about.
<br />
<br />
#pragma omp parallel for //<-no impact on time<br />
for(long loop=0;loop<bufferSize2;loop++)<br />
pArrayResult[loop]= ~(pArray1[loop] - pArray2[loop]);<br />
<br />
I can try the common openMP example:
<br />
#pragma omp parallel<br />
{<br />
printf("hello world");<br />
}<br />
and never get something that looks like the example warning
helhelloo w world orld
I always get
hello world hello world
I can try
<br />
#pragma omp parallel<br />
{ <br />
int ID=omp_get_thread_num();<br />
printf("Hello(%d)",ID);<br />
printf("world(%d)",ID);<br />
}<br />
and the result is always sequential
hello(0)world(0) hello(1) world(1)
Anyone have an idea as to why everything seems sequential? What am I doing wrong?
Thanks,
Andre
|
|
|
|