|
You are off by a couple of light years.
_lseek() will fail if it has a bad file descriptor or you try to position the file pointer before the beginning of the file. (Note: this means that positioning the file pointer beyond the end of the file is perfectly ok)
fseek() behaves similarly, but there are caveats depending on the open mode.
|
|
|
|
|
Hockey wrote:
Just curious, but when would this occur?
I figure typically it would be caused by a faulty harddrive like a bad sector which hasn't been flagged as such by defrag or scandisk???
... or if somebody pulls out the floppy disk.
Seriously, network drives are not always reliable.
|
|
|
|
|
Hi
I'm new to MFC programming but i also managed to write a small program which i would like to use as a standalone exe.
When i tried to run the program on another computer i got an error that it does not have "MFC71.dll" but i found that it has the "MFC40.dll".
My program was built using Visual Studio 2003 and i ask how can i build the project within to support the older version of MFC?
Thanks a lot
Mamtz
|
|
|
|
|
mamtz wrote:
My program was built using Visual Studio 2003 and i ask how can i build the project within to support the older version of MFC?
It's not a question of "supporting an older version of MFC". An MFC app built with VS 2003 requires the presence of MFC71.dll unless it is statically linked with MFC, in which case the DLL isn't required.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
I bought a harddrive enclosure that has a button on it for one touch backup. The software that came with is sucks, so i wrote my own. How do i detect when the button it pressed. Would this be part of the device driver? Is it in the registery?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
That's not very easy.
You have to find a way to listen for messages coming from the device. A device driver is one possibility, but there may be also one for user-mode.
There are some programs on the internet which are watching the data sent through the USB port, maybe they can help you identifing the backup button message.
Don't try it, just do it!
|
|
|
|
|
Anybody have any idea how to capture and ultimately cancel when a user double clicks on the caption bar of a Frame. The Onsize is too late, OnLDoublClick doesn't get called. I don't want the user to be able to size the window, which I've accomplished by removing the WS_SYSMENU & WS_THICKFRAME from the window style. But by double clicking on the caption bar the window goes to a 'smaller' size. My app still needs the caption bar, so removing that isn't an option. Any Ideas, thanks
Larry
|
|
|
|
|
did you have a look at the "Nonclient-Area Message Handlers" ( OnNcLButtonDblClk in particular ) ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
What about:
WM_SIZING
WM_GETMINMAXINFO
WM_NCHITTEST
WM_WINDOWPOSCHANGING I see the last three in Spy++ so I'd look at them first.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Try handling WM_SYSCOMMAND (specifically the case for SC_MAXIMIZE ).
Note: This will likely prevent the window from being maximized, regardless of how the maximize operation was requested (i.e. by double-clicking the caption bar, via the system menu, or by clicking the maximize icon at the window's top-R corner).
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Hello!
I have an optimization program that repeats simulations in a loop. It is quite time consuming, and therefore I display a dialog that shows the number of simulations that are left. In each iteration I call a member function in the dialog class that decrements the number of simulations left and updates the dialog. This works well as long as the dialog is on top but as soon as another window covers it the updating stops. Bringing it back on top does not restart the updating either. I have tried to put all the obvious calls in the updating function, like: Invalidate(), Redraw(), UpdateWindow(), ShowWindow(), etc. but I can not make it work. How do I do this?
Thank's in advance!
maladuk
|
|
|
|
|
You need to put the code for the "simulations in a loop" in another thread. That way, the GUI's message pump does not get bogged down and become unresponsive. See here for more.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
multi-threading is the most elegant way to handle this. but, there's always the bad-old Message Pump:
void MsgPump()
{
DWORD dwLen = 100;
MSG m_msgCur;
CWinApp *pWinApp = AfxGetApp();
DWORD dInitTime = GetTickCount();
while (::PeekMessage(&m_msgCur, NULL, NULL, NULL, PM_NOREMOVE) &&
(GetTickCount() - dInitTime < dwLen) )
{
pWinApp->PumpMessage();
}
}
call this somewhere in your loop. it's not necessary to call it every iteration, but just a few times each second will be enough to keep the UI alive.
of course, now you need to be able to handle things the user will do things with your buttons, menus, etc., while your loop is running. (i usually just disable all controls and watch out for WM_CLOSE and WM_QUIT).
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
|
I need to implement source control on a Windows project ASAP. I've been fighting VSS on and off again. Well, the other day, I dusted it off and went thundering into adding files, etc.... and I lost my network connection in the middle of this processing. Now, two of my projects are corrupt with:
file names.dat may be corrupt
and
Error reading from file
Using the analyze utility, it reports that there are no problems to fix, yet these errors remain. So, I'm about to just delete these projects and start again. However, my network bounces around considerably. I cannot afford my code repository being corrupted every time a command or operation is interrupted (has MS never heard of rollback?). Am I just being paranoid? Is this product actually stable enough? I'll give you another example - VSS still uses 8.3 names? Give me a break...
Charlie
C. Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
|
|
|
|
|
scrap VSS and use a better SSC, either CVS or SubVersion; I found that both of those products, while not beeing complety integrated in Visual Studio, are way better.
Source Code is the most important things that you ( and/or your company ) own; you should paranoid !!!
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
You won't have an argument from me - the source code and the ability to build products is the crown jewel of any software organization. I know there are other products out there. My situation is a bit more complicated in that I am an independent consultant within an organization that is mainly mechanical products - software is a tolerated evil. It is getting better, but they are still very new to the software world. In any event, I don't have the luxury of just picking anything I want to use (not yet anyway).
So, setting aside that there are better products out there, is VSS really this sensitive?
C. Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
|
|
|
|
|
CharlieG wrote:
is VSS really this sensitive?
Yep[^] (<edit: <a="" href="http://www.highprogrammer.com/alan/windev/sourcesafe.html" rel="nofollow">this[^] is the link i was originally looking for).
Here's a quote I once heard from someone who works at Microsoft:
"Visual SourceSafe? It would be safer to print out all your code,
run it through a shredder, and set it on fire."
I use Perforce which is excellent and free for up to two users. Otherwise, Subversion (which is the next incarnation of CVS and apparently fixes a number of serious issues) sounds good.
The two most common elements in the universe are Hydrogen and stupidity. - Harlan Ellison
Awasu 2.1.2 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
VSS is a terrible thing to use if you might lose your connection.
If you *need* it, then consider adding a remoting plug-in -- SourceOffSite. Uses the SourceSafe database, yet it's remote-safe.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
CharlieG wrote:
I cannot afford my code repository being corrupted every time a command or operation is interrupted
Could you use a local repository, and simply copy the whole thing up to the network once you've done with it? If the network connection fails during the copy, just copy it again. Of course, this is a *really* bad idea if you aren't the only one using the repository.
CharlieG wrote:
Is this product actually stable enough?
Yes, if you have a reliable network. We've used it for 10 years, and had one (minor) corruption. Didn't use the repair facility, just the usual server backups, so I can't comment on the effectiveness of the Analyze utility.
CharlieG wrote:
VSS still uses 8.3 names? Give me a break...
Well:
1) It's an internal, proprietary database. Why do you care how it's stored? 8.3 is good, not bad. It means you can put your VSS database on a file server that doesn't support long filenames (should you have to).
2) Take a look in the SYSTEM32 directory of your XP machine, and list all the Windows system files that are not in 8.3 format. It won't take long...
|
|
|
|
|
Working backwards:
8.3 names - fair enough.
Internal proprietary database - you might be reaching here . As important as source control is,
I would expect something like failsafe recovery and 2-phase commit.
Reliable network - depends on the phase of the moon - seriously, I have received emails announcing a server reboot in 1 minute.
If you are unfortunate enough to walk away from your computer when the email comes in, oh well.... oopsie.
My concern is that it didn't take much for VSS to go south. Maybe I *am* overreacting... but, I just don't have enough
mileage on VSS to make a qualified judgement. MS did it's own FUD on VSS for me.
Local repository - if it was just me, I would do this in a heartbeat, but I have a few others that access the source code.
Reasonable idea though.
regards,
C. Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
|
|
|
|
|
Now maybe I depart from reality or enter the zone of wishful thinking.
I just read about Perforce - appears that I need a server. The less infrastructure the better.
I will admit that I like my repository as a file based system - it's simpler. Perhaps I'm
asking for mutually exclusive features.
Subversion: interesting, but still requires a server.
Am I stuck with having to go as a server? Can I run Perforce as a local application?
C. Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
|
|
|
|
|
hi,
can anyone tell how to display images in the browser with the help of CHttpServer and CHtmlStream classes when i use them in an ISAPI extension dll. i have the name of the image file and i want to display the image in the same browser window.(i.e. when i click the get button)
thanks
aditya
|
|
|
|
|
Hi, I am writing a program where I need to keep a dozen modeless dialogs in a specific z-order (Dlg1 is always behind Dlg2, which is always behind 3, etc..) This concept is similar to layers in powerpoint or photoshop except I want to do it with dialog windows.
First I set up an int array which indexed the order I wanted (so 3,2,4,1 would be Dlg3 behind Dlg2...) Then I set up on all the dialogs:
SetWindowPos(prevWnd, x,y,0,0 SWP_NOSIZE|SWP_NOACTIVATE);
where prevWnd is found by looking up the id in the array.
However, this does not work as when I click on a dialog, it always activates the dialog I clicked on and move its z-order in unexpected ways. (So I don't even know what SWP_NOACTIVATE does exactly.)
I tried using the SWP_NOZORDER style within the Dialog class but then the dialog is always brought to the foreground if I click on it.
How would I write a z-order manager that will always "lock" my dialog windows in a specific z-order?
Also a very simple question, what does the pWndInsertAfter in the SetWindowPos mean exactly? Is the pwia in FRONT or in BACK of the target window? because it always seem to change in my program. Thanks!
|
|
|
|
|
pWndInsertAfter tells windows what z-order position a windows should have. I'm sure you know programs where you can select that the main window should stay in the foreground. That's ment by pWndInsertAfter.
Don't try it, just do it!
|
|
|
|