|
A much slower solution (in terms of CPU cycles), it should be noted.
--
Pictures[^] from my Japan trip.
|
|
|
|
|
yep, that's the "natural" solution, but much to expensive. Thanks anyway
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|
|
Sorry, I must have missed where you indicated it must have a very low cost in cpu cycles.
I was just giving a generic solution without loops like I believed you were looking for.
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
See this thread.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
[EDIT]
Whoops, never mind.
Reread your question and realized you want to find where FkGrainUp2(S, G) == G.
[/EDIT]
FkGrain*N() - round S up/down to nearest multiple of G
FkGrain*2() - round S up/down to nearest multiple of G, where G must be a power of 2
Will work for all unsigned int types, not just unsigned long long.
ullong FkGrainDnN( ullong S, ullong G )
{
S = S - (S % G);
return(S);
}
ullong FkGrainUpN( ullong S, ullong G )
{
ullong r = S % G;
if( r ) S = S + G - r;
return(S);
}
ullong FkGrainDn2( ullong S, ullong G )
{
S = S & ~(G-1);
return(S);
}
ullong FkGrainUp2( ullong S, ullong G )
{
G -= 1;
S = (S+G) & ~G;
return(S);
}
...cmk
Save the whales - collect the whole set
-- modified at 18:49 Saturday 18th March, 2006
|
|
|
|
|
Hi everybody :- ). Long time no postin'. I worked in other areas lately but now I'm back in C++ at a problem left unsolved some time ago. The problem is quite severe as in I am lacking some very important information (which apparently I can't find in MSDN). You see... I want to create a window which has a control box, minimize and close buttons and a thick frame, but NO RESIZE. So far, I used this:
hwndThis = CreateWindowEx //Creating the window.
(
NULL, //ExStyles.
sClassName, //Class name. Created somewhere above.
Title, //Window name.
WS_OVERLAPPEDWINDOW &~ WS_THICKFRAME &~ WS_MAXIMIZEBOX, //Styles.
X, //X.
Y, //Y.
W, //Width.
H, //Height.
NULL, //Parent.
NULL, //Menu.
hHost, //Parent.
NULL //CreateStruct.
);
As you can probably already guess, this does the job, but creates a window with a very thin border and I don't like that. If I remove WS_THICKFRAME, of course, it works but then I can resize it again. Soooooooooo? Any ideas anybody? :- ). Thank you in advance!
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
You can handle the WM_SIZING message and simply modify the rect to the app size.
onwards and upwards...
|
|
|
|
|
Not good because I will still see that annoying arrow-resize icon. There has to be another way. A style or something. Something I missed in the MSDN documentation.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
Axonn Echysttas wrote: I will still see that annoying arrow-resize icon
WM_NCHITEST, check if the mouse if over a resizing border, if it is return HT_BORDER.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Handle the WM_GETMINMAXINFO message. Set the minimum and maximum sizes the same and the window will not be resizable.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Hi,
I have a DLL which has a class containing static members. In the
implementation file of the class I have done proper initialization of
the static data. These static data are public thus I want to modify
these public static data from another application using this DLL.
Somehow the static initialization is not happening if it is done in the
implementation file and while accessing the storage for static data my
VC7 compiler complains that I am trying to write to an illegal memory.
But if I do the static initialization in the header file itself then I
get no run time error. As far as I know static data initialization
should not be done in header file. So really my question is why is this
happening in the first place and what I need to do to fix it?
DLL CODE:
///////////////////////////////Header
file//////////////////////////////////////////
typedef void (*fptr)(void);
class DllMethods
{
public:
__declspec(dllexport) static int data;
__declspec(dllexport) static fptr function;
};
/////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////Implementation
file//////////////////////////////
#include "DllMethods.h"
//IF THIS INITIALIZATION IS DONE IN THE HEADER FILE FOR THE DLL
//THEN I GET NO ERROR WHEN DEBUGGING WITH VC7 COMPILER
fptr DllMethods::function = 0;
int DllMethods::data = 46;
///////////////////////////////////////////////////////////////////////////////////////
APPLICATION CODE:
#include "DllMethods.h"
#include <iostream>
using namespace std;
static void anotherFunction(void)
{
cout << "Inside anotherFunction" << endl;
}
int main(int argc, char ** argv)
{
//I GET RUNTIME ERROR WHEN THE FOLLOWING LINE
//EXECUTES AND WHEN THE STATIC INITIALIZATION IS
//DONE IN THE IMPLEMENTATION FILE
//BUT IF THE INITIALIZATION IS DONE IN THE HEADER ITSELF
//THEN I GET NO ERROR
//ASSIGN THE FUNCTION PTR OF THE DLL TO THE FUNCTION
//IN THE APPLICAITON
DllMethods::function = anotherFunction;
DllMethods::function();
return 0;
}
Thanks,
Divick
|
|
|
|
|
The current MSDN documentation suggests that CFile::Remove [^]can delete a file where the file spec indicates a network path. However my very old local MSDN library is pretty specific that the file spec can not reference a network file. I'm still using VC++ version 6 and my testing confirms that I can't get the code delete a network file. The exception I catch has the following error message, "A sharing violation occurred while accessing an unnamed file.". This likely means that I need to look into upgrading from version 6 in order to get a more up to date MFC, but I'm wondering if there isn't some other alternative I could try.
Chris Meech
I am Canadian. [heard in a local bar]
When I want privacy, I'll close the bathroom door. [Stan Shannon]
BAD DAY FOR: Friendly competition, as Ford Motor Co. declared the employee parking lot at its truck plant in Dearborn, Mich., off limits to vehicles built by rival companies. Workers have to drive a Ford to work, or park across the street. [CNNMoney.com]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
Of course, it would have helped if during my tests, I'd made sure I'd closed the file before trying to delete it. sheesh.
I now return you to normal questions again.
Chris Meech
I am Canadian. [heard in a local bar]
When I want privacy, I'll close the bathroom door. [Stan Shannon]
BAD DAY FOR: Friendly competition, as Ford Motor Co. declared the employee parking lot at its truck plant in Dearborn, Mich., off limits to vehicles built by rival companies. Workers have to drive a Ford to work, or park across the street. [CNNMoney.com]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
There are a lot going on since Apple decided to put an intel processor and I'm a little confused..
Here are some questions! :
1. I know that on an intel based mac, Windows XP and Vista can be installed. Can the inverse be possible? If I get a macintosh cd will it run on my pentium? (I guess not..)
2. Windows can run on a mac. A windows program runs on intel based macintosh without loading windows or some simulation?
3. If [2] is true, can I load the M.V.Studio and all the mfc classes to code on a mac? Will the program run on both Windows and Mac?
3. If [2] is false, how compatible are the two O.S.?
(Questions are only for intel based macs)
|
|
|
|
|
|
2. no, not now, maybe a new rosetta ( rosetta @ Apple [^] ) emulator could do that eventually; that technology now translate the PPC instruction set to Intel instruction set.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Vertical_Horizon wrote: I know that on an intel based mac, Windows XP and Vista can be installed.
How do you know that?
There are some people working hard to make that possible, but this is against Apples will and so far only a technical play of some sort.
If you do not know the answer to your questions, this is certainly nothing you would gain any benefit from.
Sorry!
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Take a look here:
http://onmac.net/
|
|
|
|
|
Oh?!?
They've already awarded the money!
I did not know that
Here[^]
is a download with a installation manual.
Thats certainly not for the faint of heart!
You need to burn a special XP-CD, will loose yu MAC-OS installation and Hardware-support is less than optimal.
So, with the level of knowledge I deduced from your initial questions, you can view thsi as nonexistant.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
does anybody know how to create chevron button (something similar to the notification area button in XP) in win32
Thanks
__________________________________________________
Achievement is not a destiny but a endless journey
-- modified at 9:15 Friday 17th March, 2006
|
|
|
|
|
|
something like that.. But i need exact look as the notification button (which has ">" + round background)
Achievement is not a destiny but a endless journey
|
|
|
|
|
sorry, i really don't see what button you're talking about when saying "notification button".
|
|
|
|
|
have u seen the a button in between notification area and the task bar buttin.. which hides or shows (un)used icons on clicking.. i need a button which exactly resembles that one
Achievement is not a destiny but a endless journey
|
|
|
|
|
this area is not called "notification area" but "system tray"...
well, to answer your question, i don't know myself, but at least, i understood you then...
|
|
|
|