|
Hello
I am trying to keep a window within a certain bounding rect. So far I am capturing the WM_ENTERSIZEMOVE message within the window procedure and doing this:
boundry is the program defined rect that the user should stay within.
pt is the mouse POINT.
rect is the window RECt.
<br />
test.left = boundry.left + ( pt.x - rect.left );<br />
test.right = boundry.right - ( rect.right - pt.x );<br />
<br />
test.top = boundry.top + ( pt.y - rect.top );<br />
test.bottom = boundry.bottom - ( rect.bottom - pt.y );<br />
<br />
ClipCursor( &test );
There are a few problems that arise, one of them is that depending on where i grab the window, the resulting boundry rect is sometimes off by as much as a few pixels.
Whats the dilly?
|
|
|
|
|
You're doing it the hard way. Just trap the WM_MINMAXINFO message
|
|
|
|
|
Thanks,
does this work for moving and resizing?
|
|
|
|
|
Are there any systemic issues around power management? sleep?
I am using a 3rd party library, and it seems that following wake, I can get their library to crash.
They are unsure what the problem might be, so to help, I thought I'd do some research?
What kinds of issues crop up?
Are there issues with some system services on wake?
COM issues?
Thanks
-peter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
Hi!
I've got a SDI-Application and want to implement a counter which displays for how long my application is running since I compiled it.
I use timeGetTime() but it seems as if timeGetTime() is very imprecisely. Afer 60 seconds my counter counted to 62 seconds.
Here's a part of my program:
<br />
if ((::GetTickCount() - dwTime) > 1000)<br />
{<br />
dwTime = ::GetTickCount();<br />
<br />
if (view->GetSeconds() < 59)<br />
view->SetSeconds(view->GetSeconds() + 1);<br />
else if (view->GetSeconds() >= 59)<br />
{<br />
.<br />
.<br />
.<br />
}<br />
strTime.Format(_T("%02d:%02d:%02d"), view->GetHours(), <br />
view->GetMinutes(), view->GetSeconds());<br />
view->m_Timer.SetWindowTextW(strTime); <br />
<br />
}<br />
I would really appreciate if someone could help me.
Please excuse my bad English
enne
|
|
|
|
|
why dont u just use the WM_TIMER message with 1000ms interval?
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Why dont u just use WM_TIMER msg with 1000ms interval?
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
enne87 wrote: which displays for how long my application is running since I compiled it.
A - how long it's been since you compiled it + how long it's been running ?
or
B - only how long it's been running ?
It's confusing.
for A, you can get the time the executable file was created + the time the application is running (B).
for B, when the application starts, keep the current time ( with time ) and at each WM_TIMER trigger, get the current time, and compare with the one you kept earlier; do some simple time math and set the text to the window
|
|
|
|
|
I see, thanks for the great help guys
|
|
|
|
|
See here for a detailed discussion on time in Windows.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Ok, thanks much guys
|
|
|
|
|
Hello,
I'd like to create a simple exe file with evc++, that when run, will Delete a certain folder / file in the ppc root directory. Can someone help me with this?
Would also like for it to work on both 2330 and WM5 devices.
Thank you in advance!
ZapMe1
|
|
|
|
|
use DeleteFile() API or SHFileOperation Function, both are supported under windows ce.
Good Luck,
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Thank you for the fast reply, Mohammad. I actually would like to delete a subfolder that will contain 1-3 files.
I'm sorry, I'm very new at this. Can you please give me an example?
Thank you!
ZapMe1
|
|
|
|
|
lets assume that ur subfolder is named '\\MyFolder':
WIN32_FIND_DATA fd;<br />
CString MyFolder =_T("\\MyFolder\\");<br />
HANDLE hFile = FindFirstFile(MyFolder +_T("*.*")), &fd);<br />
while(hFile != INVALID_HANDLE_VALUE)<br />
{<br />
if(!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{<br />
DeleteFile(MyFolder + fd.cFileName);<br />
}<br />
<br />
hFile = FindNextFile(hFile, &fd);<br />
<br />
}<br />
<br />
FindClose(hFile);
I did not test the code, but it gives the idea..
Good Luck,
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Thank you for that Mohammad, but not having luck getting to compile.
ZapMe1
|
|
|
|
|
Ok I know that there are a couple of ways to convert a unicode string to ascii, however I need to read from UNICODE file necessary info then convert it to ASCII and write it to a normal .log file.
I believe that when i do the following:
while(!file_in.eof()) <br />
{<br />
file_in.getline(str,2000);<br />
file_out << "\n" << str;<br />
}<br />
file_out << endl;
I know i need to do my conversion from UNICODE to ASCII within the while loop... but i believe that will cause an issue since getline() will try to do it's own conversion when reading from UNICODE file...
I believe i need to do is read in UNICODE from UNICODE file and store it within UNICODE variable. Then convert it to ASCII and then write it normally...
|
|
|
|
|
You must load the UNICODE text file into UNICODE strings:
<br />
wchar_t str[2000];
Then you need to load the UNICODE text from the file. I am not sure if the STL libraries handle this correctly...? I know they don't handle unicode filenames, but that's another topic.
After you load it, then you need to convert this to ANSI
<br />
USES_CONVERSION;<br />
file_out << "\n" << W2CA(str);<br />
Unfortunately, you'll run into a snag. The STL libraries are lame at handling unicode text in files. I take it you don't control these files -- I'd write them as UTF-8 format if I could. So much nicer...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
I wouldn't attempt doing this line by line, those conversion functions can be a real system hog sometimes. In your situation I would read the entire file into a buffer first, the convert it all in one swoop.
|
|
|
|
|
I wrote an article[^] that talks about this kind of thing.
As another poster said, the best thing would probably be to read it as binary data into a buffer and convert it from there.
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.
Awasu 2.2.3 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
|
In every file in my large project, when I attempt to create a Release Version, I get the following error:
fatal error C1853: 'Release/ios.pch' is not a precompiled header file created with this compiler.
Clicking on this error goes back and points to the StdAfx.h (the first header file in every .CPP)
I searched your database but did not find this particular problem. Can anyone tell me what's going on, or tell me where to look to figure this out. BTW, the Debug version has no errors and no warnings (warnings set to level 4).
Thanks for your time.
John P.
|
|
|
|
|
Does your project have any .c files? Have you tried removing the .pch file and doing a Rebuild All?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
No, I don't have any 'C' files. I did a rebuild all and now it's complaining that it can't find include files that it could find in Debug mode? That makes a lot of Microsoft sense!
Thanks for the assistance, David. I'm going to'import' these files into the project just to make sure.
John P.
|
|
|
|