|
The easiest way is not to use the WS_THICKFRAME style when creating the window.
In the dialog resource editor, it's a property of the dialog box (in the styles tab, select the 'Border' dropdown and choose 'Thin'). In code, you can either remove the WS_THICKFRAME style in the call to CreateWindow (but note that WS_THICKFRAME is included in WS_OVERLAPPEDWINDOW) or, in MFC, you can override PreCreateWindow and modify the style there:
cs.style &= ~WS_THICKFRAME;
If you want a non-resizeable window but you want to keep the thick frame, you'll have to do something slightly more complicated involving WM_NCHITTEST.
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
There are a few ways that jump to my mind.
You could override OnGetMinMaxInfo / WM_GETMINMAXINFO to restrict the resizability of your window.
Change the window style (in PreCreateWindow) so you don't have a border to resize.
Override OnNcHitTest / WM_NCHITTEST so it returns HTCAPTION instead on HTTOP etc so you could move your window by dragging on the border rather than resizing it.
A word of warning though. In general, I like being able to resize things, and I'm not alone. Don't break the windows paradigm unless you have a _really_ good reason.
Good luck,
Iain.
|
|
|
|
|
my coworker uses stuff like this all over the code
vector<int> test;
vector<int>::iterator i;
for (i = test.begin() + 10; i < test.end(); ++i)
{
....
}
i = test.begin();
if ( test.begin() + 10 < test.end())
i += 10;
he asked me something bout this.. and i told him that this is not the proper way to do this (i think of having read that you never never never should another comparison than != for the end() function of a vector).. but actually i don't know any other way to skip 10 elements with one command..
is this proper code ?
what would be a safer way ? (if it isn't proper code ?)
thanks in advance,
bernhard
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
U can very easily run an int counter, and check if in th loop ur not exceding the test.size() + or - offset value in order to take the values, and in order to take the element at the integer i, u can do test.at(i)
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Yes, you should use !=, but you can quite happily use the +, so I see no reason why you can't just replace < with != above. < will work for vector, in any case.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
(This is rather academic, but anyway) The expression is not valid, even if you use pointers: pointers are only allowed to point one position past the end of a memory block_
char *p=new char[100];
char *p2=p[100];
char *p3=p2+1; Of course, the line above will work in any compiler that I know of, but the standard does not guarantee it. As for iterators, the situation is the same.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
You're right this is not safe. If you still want to write the stuff in one line, you can use std::distance
i = test.begin();
if ( std::distance(test.begin(),test.end())<10)
i += 10;
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Does anyone know if it is possible to write permission bits to an Access Database and if possible how to go about it. I want to set up a user logon system where they get different permissions and menu options depending on what group they belong to.
|
|
|
|
|
I've written a program in VC++ and when I run it my PC loses time!
Its a 'data recording' type program, reading data in through the serial port once a second, displaying the data on screen and storing the data to harddisk.
I thought maybe the clock would put its self right when I re-booted, but it doesn't. Surely the time is generated from an RTC (Real Time Clock) chip on the motherboard, how can I be affecting that ??????? I'm using 'GetCurrentTime' to read the time.
Any ideas?
Ali
|
|
|
|
|
Hi Alison!
Please explain me what is meant with 'loosing time' (how much?? in which amount of time...???)
It's not normal, my app is using lot's of timer-stuff (CTime objects with GetCurrentTime...)
Olli
cause sometimes the world is as strange as me....
|
|
|
|
|
Thanks for replying, its nice to hear that its not normal!
Olli wrote:
how much?? in which amount of time...???
Sorry, realised after I posted that I hadn't said how much time.
I first noticed it when I left it for 1 week running continuously and it lost 28 minutes.
I've run it again this morning and its lost 22 seconds in 2 hours.
If I don't run my code the PC doesn't loose any time. I don't where to start looking.
Ali
|
|
|
|
|
How do you 'use' the Time ??????
I use my objects mostly local, like this way:
void SomeFunc()
{
....
CTime theTime = CTime::GetCurrentTime();
....
}
In other cases, e.g. to compare time, i remind the old time in a global object...
BTW: If I want to place a clock in my statusbar, i call the OnTimer() each 0.1 secs, then i compare the CTime::GetCurrentTime() to my oldTime and if it changed, the i start updateting my clock...
Maybe you can show us how in detail you do it, then maybe i can help you..
Alison Pentland wrote:
I've run it again this morning and its lost 22 seconds in 2 hours.
22 secs in s hrs is a lot,... sounds very very strange...
Olli
cause sometimes the world is as strange as me....
|
|
|
|
|
I'm using it in lots of place, but here's how I get the time ....
CTime timeNow;
timeNow = CTime::GetCurrentTime();
I guess more detail would be good but I'm using CTime alot and I don't know which place is the problem - I don't know which example to give you.
I'm going to run it on a different PC over the weekend, just in case its related to the hardware. I'll let you know Monday how it goes.
Thanks for the interest
Ali
|
|
|
|
|
either you save the time somwhere in your program (using SetSystemTime for instance), after which the system will sync the time automattically or the code you generate somewhere stops interrupts from being processed ( I was not aware that this was still possible, or are you using a win 9x/ME version?). So also the clock int gets processed too late.
Rutger
|
|
|
|
|
If Win2k flavour try to run your application under user permissions rather than using Administrator account and you'll know that you'll get Access Denied if your program tries to change date/time.
Regards,
Venet.
--------
Black holes are where God divided by zero.(Steven Wright)
|
|
|
|
|
Alison Pentland wrote:
Surely the time is generated from an RTC (Real Time Clock) chip on the motherboard
The RTC is only read on startup - Windows maintains its own system time from then on. If you're running your code in a fairly tight loop, with constant access to the serial ports, console, and hdd, it may be missing a number of clock update cycles. I've read elsewhere that the clock maintenance process isn't a real high priority, and can be easily bumped by user processes.
Try putting the serial I/O in a separate thread, if it isn't already. I haven't worked a great deal with serial I/O in a long time, but in researching an aborted project that would have needed it, I stumbled across a couple of articles that recommend this as a way to prevent blocking other processes.
There are three types of people in the world: Those who make things happen; those who watch things happen; those who wonder what happened.
|
|
|
|
|
I am using VC++ and when I press the compile button a msg box appeared and told me that:
Cannot compile the file '...\myheader.h': no compile tool is associated with the file extension.
Why would this happend?
|
|
|
|
|
Because you cannot compile a header file - you need to build the project.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
You cannot compile a header file. Try compiling the corresponding .cpp file. If there is an error in the header file the compiler will report it.
Best regards,
Alexandru Savescu
|
|
|
|
|
Hi !
My app is using several OCXs and DLLs. I'm wondering what is the best way to automatically register these OCXs and DLLs. Does InstallShield do it ? Do I have to write my own code calling REGSRV32 serveral times ?
Thank you for your help !
Jerome
|
|
|
|
|
Is there a way to make the MFC windows of my App transparent with MSVS 6.0?
Or is there a downloadable MFC upgrade for WinXP? Or an upgrade for VS 6.0 that supports all new features of WinXP, MFC etc? (without to need to upgrade to VS .NET, at least not yet).
Thank you!
|
|
|
|
|
You need W2000 or Win XP and you need to download the platform SDK.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Does this SDK contain MFC update and documentation?
I'm not sure about MFC.
|
|
|
|
|
No it does not. The transparent stuff is done with API calls, which the SDK gives you. How else would your 1995 compiler give you Windows 2000 API calls ?
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
hi,
can u tell how to convert a BSTR to LPSTR.
|
|
|
|