|
First off, you didn't allow shared write access when opening the original file.
Try using FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE for the share mode on both CreateFile()
calls.
|
|
|
|
|
It works! Thanks man!
Jay Zhu@Shanghai, China
|
|
|
|
|
Hi everyone.
Here is how I use CStatusBarCtrl in my dialog:
In OnInitDialog()
m_StatusBarCtrl.Create(WS_CHILD|WS_VISIBLE|CCS_BOTTOM|SBARS_SIZEGRIP,<br />
CRect(0,0,0,0), this, IDC_STATUS_BAR);<br />
<br />
int widths[1] = {-1};<br />
<br />
m_StatusBarCtrl.SetParts(1, widths);<br />
In OnSize()
<br />
m_StatusBarCtrl.SendMessage( WM_SIZE, 0, 0 );<br />
And when I need to update status, I invoke:
<br />
void CMyDlg::UpdateStatusBar(const std::string& in_rsNewStatus)<br />
{<br />
m_StatusBarCtrl.SetText(in_rsNewStatus.c_str(), 0, 0);<br />
<br />
}
But if the string is long enough, it is cut even when current StatusBar's size is able to encapsulate it! What is strange, is that it is cut differently: I mean, that number of letters, that are shown and the length of shown string in pixels are not equal for different strings.
Has anybody come across the same?
|
|
|
|
|
Are you sure you need to forward WM_SIZE messages to a CStatusBar control?
Have you tried NOT sending WM_SIZE to the control?
Mark
|
|
|
|
|
According to the documentation for SB_SETTEXT on msdn, "The text for each part is limited to 127 characters."
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
I am working with an equipment that only can be configuration through local Network! It use SNMP protocol (with UDP for parsing data). Anyone knows how to work with it?
Note: I did try the ServerSocket_Demo in this site, but it not the same. Because it only try to send information in TCP (or UDP) ... but not in SNMP. The result is: The equipment rejected both ways
Thanks to any help
|
|
|
|
|
|
I have learned about it, but the problem for me now is: Even I understand smome thing about it:
. Packet Info: (ie: packet length ...)
. Ethernet - II (ie: IPv4)
. IP (ie: version, source, destination, protocol ... checksum)
. UDP (ie: source, destination, protocol ... checksum)
. Extra data (...)
. FCS (...)
I still does not know how to imply in my VC++ program in order to link correctly with the equipment (Send/Receive SNMP packets)
Can you help?
|
|
|
|
|
I have never used the protocol but since it works over tcp/ip I would imagine you can send/recv
SNMP packets using sockets.
Do you need to know how to use sockets from C++?
Mark
|
|
|
|
|
In VC++ ... yes, if it can send SNMP packets as I described
Thanks
|
|
|
|
|
It looks like you have some studying to do...
Windows Sockets 2[^]
Maybe look around MSDN or Google and see if there's higher-level APIs or libraries for working
with SNMP. EVerything you need to know is documented somewhere
|
|
|
|
|
Hi Mark,
Thanks for the usefull links. I will work on it immediately
|
|
|
|
|
Ive been using Sleep() alot, but now i need something with smaller units, like microseconds or something. Ive used while loops that count a couble hundred, but there must be some more cpu friendly way to sleep a few microseconds?
any ideas?
maybe i could use timer? does it go down to that unit? if so how would i use that?
thanks
/Johannes
/Johannes
|
|
|
|
|
Johpoke wrote: Ive been using Sleep() alot...
Why? What is it about your application that requires the (over)use of this function?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Look up "Multimedia timers" in MSDN for more high-resolution timers. But I agree with DC's post... It might be worth looking into why you are using Sleep(...) so much. Excessive use of Sleep(...) is often (although not always) a sign of a larger problem.
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! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
My program draws fireworks, no sleep and they whiiiz by abit fast,
Ille look into the multimedia timers!
thanks
/Johannes
|
|
|
|
|
Work out how much time has passed since your last frame, then you can scale up your animation to update accordingly
|
|
|
|
|
Um?
it uses SetPixel for everything..
/Johannes
|
|
|
|
|
You need to correctly use loops, timers and counters.
It sounds like you are doing all of your drawing directly to the screen, and you have an uncontrolled loop, you should instead be trying draw to an offscreen bitmap. Set a timer, on each timer event bitblt the bitmap to the screen.
|
|
|
|
|
WalderMort wrote: ...you should instead be trying draw to an offscreen bitmap.
Hey, wait a sec. Didn't you state not too long ago that double buffering "is for little girls" or
something like that?
Cheers!
|
|
|
|
|
oh.. err... mm...
NO, that was Voldemort, my evil twin
|
|
|
|
|
Mark Salsbery wrote: double buffering "is for little girls"
|
|
|
|
|
well the loop is kinda controlled, but i came up with a way to fix it, i do the sleep(1); less often, every fourth time..
but now i have another problem, i created a second thread, and both main and the second thread generate exactly the same random numbers using rand()%1000, how can i get a more random random??
lol :P
/Johannes
|
|
|
|
|
You have to seed the random number generator with a random number. Use GetTickCounts or something like that. Otherwise, they always start out the same, so that you can actually 'test' the generator.
|
|
|
|
|
hu??? how?? wht? GetTickCounts?
:/
/Johannes
|
|
|
|