|
Well it is a bunch of strange and unused stuff and then the classical C++ greeting to the world. 
|
|
|
|
|
Okay, and?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
this is what i understand of
does it look right / match what the site gives ?
if error's : where / what else
i have NO experiance whit a QC
how to use my c++ stuf whit a example from the ibm site ?
|
|
|
|
|
Message Closed
modified 7-Nov-17 6:30am.
|
|
|
|
|
I have:
unsigned foo = ~0;
and the debugger shows:
foo = 0xffffffff
So, in answer to your question, "no, I haven't".
|
|
|
|
|
You beat me on that. 
|
|
|
|
|
Looks like MM posted that while drunk.
|
|
|
|
|
(in order to reproduce his test)
|
|
|
|
|
I try to find out what the best strategy is to create a MFC based application that is dpi-aware. Windows is based on 96 dpi for years. Today there are pc's like the Microsoft Surface that have lot more dots per inch.
In windows you can set the screen scaling factor to 100%, 125%, 150%, etc.
If you build the application with a manifest that set DPI Awareness with High DPI Aware, then the resource templates like dialogs scale automatically. Only the custom drawings must be scaled with extra code
like:
int DpiScale(int val)
{
const HDC hDC = ::GetDC(NULL);
const UINT dpix = ::GetDeviceCaps(hDC, LOGPIXELSX);
::ReleaseDC(NULL, hDC);
return ::MulDiv(val, dpix, 96);
}
int DpiPerc()
{
return DpiScale(100);
}
DpiScale you can for coordinates or font points. DpiPerc you can use to select the a icon or picturewith the right resolution from resource.
My question is, must I develop the application for 1024 x 768?
|
|
|
|
|
Theo Buys wrote: must I develop the application for 1024 x 768? No, your application should work on any screen if it allows Window to scale it correctly. If the screen size is important then you can get the current values from GetSystemMetrics function (Windows)[^].
|
|
|
|
|
Yes I can use GetSytemMetrics for the custom drawings. But not the dialogs templates in resource which are sized by the system.
|
|
|
|
|
Dialogs are scaled by Windows to match the screen size.
|
|
|
|
|
Not true... When I created a dialog template that is at 96 dpi full screen. With a system dpi scaling of 150% ( 144 dpi) the bottom and right are not visible with the same screen size.
|
|
|
|
|
If you increase the scaling to 150%, then everything in the display will be that much larger.
|
|
|
|
|
Because the Microsoft Surface is default at 150% system scaling,
I must do dialog development in 1024 x 768 pixels at 96 dpi to match the full screen for a dpi-aware application. Right?
|
|
|
|
|
Theo Buys wrote: I must do dialog development in 1024 x 768 pixels at 96 dpi Dialogs have their own measurement system (dialog units) which is supposed to make them look the same on any screen. But, as I said above, if you magnify to 150% you need to make sure it will still fit in the space you have.
|
|
|
|
|
|
Thanks! This is the info where I was looking for!
|
|
|
|
|
We define accelerators in the resource file like this :
IMB_MYAPP ACCELERATORS
BEGIN
"0", IDM_MY_ACTION, VIRTKEY, CONTROL, NOINVERT
END
This will let me use the ctrl-0 key to do "IDM_MY_ACTION".
This only works for the left-control key; the right control-key does not work.
Is there a way to define an accelerator for the right-control key in the resource or do I have to handle that in the code ?
Thanks
I'd rather be phishing!
|
|
|
|
|
I have just tried this and it works with both left and right CTRL keys. It must be something to do with your system.
[edit]
If you look at the structure of an accelerator table (ACCEL structure (Windows)[^]) you can see that there is only a single value to represent either control key,
[/edit]
modified 5-Nov-17 9:12am.
|
|
|
|
|
Yeah, at first it did not work, but for some reason it works as expected.
I'd rather be phishing!
|
|
|
|
|
Greetings, i have a problem finding a solution for this algorithm: i have to find the maximun range in an unordered array (i cant order the array). An example will be:
+--------------------------+
| 100 | -10 | -10 | -10 | 100 | --> this sould return the range 0-4
+--------------------------+
+-----------------+
| -7 | 5 | -1 | 9 | -6 | --> this sould return the range 1-3
+-----------------+
+-----------------+
| -7 | 5 | -6 | 9 | -6 | --> this sould return the range 3-3
+-----------------+
I dont have problems doing the algorithm in O(n^2) but i need to do this algoithm in O(n), can anyone help me?
Cuadratic algorithm:
void maximunSegment(vector<int> &V, int &start, int &end){
int i = 0, j = 0, r = 0, aux = 0;
start = 0; end = 0;
while(i < V.size()){
j = i;
while(j < V.size() - 1){
aux += V[j];
if(aux >= r){
r = aux;
start = i + 1; end = j + 1;
}
++j;
}
aux = 0;
++i;
}
}
IMPORTANTE NOTE: the positions of the array are important, i mean that the content of V[i] is linked to that i (if v[3] = 89, that 89 always have to refered to v[3] even if you change the array you need to remember that this 89 was on position 3), so if you reorder the array you need to keep that reference.
Thank you so much.
|
|
|
|
|
Member 13501021 wrote: ...i have to find the maximun range When I hear the phrase "maximum range" I think of things like: 1) what's the farthest that ball can be hit, 2) what's the longest distance that bullet will travel in 50% humidity, 3) what's the farthest that car can go on a full tank. What is your definition of maximum range?
Member 13501021 wrote: +--------------------------+
| 100 | -10 | -10 | -10 | 100 | --> this sould return the range 0-4
+--------------------------+
+-----------------+
| -7 | 5 | -1 | 9 | -6 | --> this sould return the range 1-3
+-----------------+
+-----------------+
| -7 | 5 | -6 | 9 | -6 | --> this sould return the range 3-3
What's the pattern?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Pretty sure that the "maximum range" should be the segment of the array where the sum of its values is the highest of all possible segments.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
This surely is your homework, so I won't rob you of the opportunity to find the solution yourself.
But I'll try to nudge you onto the right track:
- Take a pen and paper, write down some random value sequences as input arrays and solve them manually. Try to do this in an algorithmic way. Use some longer sequences than you showed here.
- You can't have nested loops over n for O(n), obviously. So you will have to make do with one pass over the array. But you're free to use more or other variables.
- The solution is surprisingly easy and succinct - don't think too complicated.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|