|
Your problem has nothing to do with MFC! MFC is just a wrapper for plain Win32 API
|
|
|
|
|
You know the size of the picture control from the resource file. Or you can use GetWindowRect or GetClientRect to capture it at run time. You can then use StretchBlt[^] to display the bitmap at the appropriate size. Alternatively, depending on what else is in your view, you could resize the picture control.
|
|
|
|
|
thanks.
will skip MFC and do it the good old way.
I'd rather be phishing!
|
|
|
|
|
You can still do some of that in MFC.
|
|
|
|
|
Airport is divided to many Runways. Each runway has a mixed fixed delay amount of
time to keep a plane on runway. If airplane delay time > runway delay time than airplane
needs to take out from a runway, then it is considered as missed and starts from again
from a runway. You need to find out the minimum total delay for particular input. First
input line is number of runways. Second input line is delay of each runway.
Third input line is capacity of each runway to accommodate planes. Forth input line is
total number of planes. Fifth input line is maximum delay an airplane can afford. If it
exceed the runway delay time it is miss and it needs to start from again from a runway.
You need to show how you managed the runways as output as well.
Examples:(All are from user input)
5
2 2 3 5 7
2 2 2 2 2
8
1 1 1 1 2 2 3 3
Answer= 3
calculetion:(For another Example)
2 2 3 5 7 (runways delay times)
____________
1 1 1 5 3 (Air planes Delay times are less or equal
1 2 2 0 0 than runways delay)
__________
1sec -0 0 0 4 2
1sec -0 1 1 3 1
1sec -0 0 0 2 0
1sec -0 0 0 1 0
1sec -0 0 0 0 0
________________
Dealay Time=(1+1+1+1+1)sec
=5 second
Answer=5
|
|
|
|
|
When you posted this yesterday in QA: How to solve this problem[^]
You posted it together with two very different code fragments "you wrote" but couldn't get working, and were encouraged to use the debugger to fix them.
Now, you're posting the question again with no code and asking for an algorithm "to solve it".
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.
So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
And please, don't tell us you "wrote the code" because it's pretty clear from yesterday's post that you found something on the internet and hoped it would magically meet all your homework criteria...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
There's a pun somewhere in all of this, solve it!
|
|
|
|
|
- where are the planes at the start: somewhere at the airport, at a runway, or in the air?
- what are the times when planes are scheduled to arrive or take off? If not times, what is the order? If not order, is there any other restriction about the sequence?
- what does delay(?) time mean for a plane? Is it the maximum time it can wait at the airport, or remain in the air? If so, when does the time start counting? Or does that time only start ticking when on a runway?
- what does delay(?) time mean for a runway? What is it's effect? When does it start?
- what do you mean by runway capacity? Typically I'd say the capacity of any runway is exactly 1, as there can't be two planes on the same runway at the same time! But clearly you mean something else. Explain!
- the goal is to optimize a time for the airport - which time is that?
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
Do you work for Boeing?
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
|
|
|
|
|
Hello,
I need to multiply integer value with a factor and want to do an overflow check with INT_MAX, INT_MIN for this.
Integer contains 4 bytes on my machine an this is the max variable-size.
I need to do this check for signed integer and unsigned integer. Only integer math/variables allowed.
The factor always comes as fraction with a nominator and denominator. The denominator always is 10
Factor might be greater 1 or less than 1
So for example fraction is 25/10, varible a is signed integer
a = (a * 25)/10 -> may cause overflow, because (a * 25) can be > INT_MAX ( or < INT_MIN )
Overflow checks:
if (a > (INT_MAX * 10)/25 -> not possible because of overflow, INT_MAX is the maximum number the compiler can store.
if (a > INT_MAX * (10/25) -> not possible because 10/25 is 0.4 which will be 0 in integer math.
So any idea how to solve my problem?
Thanks for any hint!
|
|
|
|
|
One way would be to perform the multiplication as a double-precision operation, and then examine the high word. For unsigned values (in pseudocode):
// HI_HALF - returns the upper N/2 bits of an N-bit integer
// LO_HALF - returns the lower N/2 bits of an N-bit integer
// MAKE_DIGIT - combines two N/2-bit values to make an N-bit integer
// multiply a DIGIT a by a DIGIT b, returning a two-DIGIT result
// a, b must be unsigned
DIGIT alow = LO_HALF(a)
DIGIT ahigh = HI_HALF(a)
DIGIT blow = LO_HALF(b)
DIGIT bhigh = HI_HALF(b)
DIGIT carry
DIGIT accumulator
DIGIT result[4]
accumulator = alow * blow
carry = HI_HALF(accumulator)
result[0] = LO_HALF(accumulator)
accumulator = alow * bhigh + carry
result[1] = LO_HALF(accumulator)
result[2] = HI_HALF(accumulator)
accumulator = ahigh * blow + result[1]
result[1] = LO_HALF(accumulator)
carry = HI_HALF(accumulator)
accumulator = ahigh * bhigh + result[2] + carry
result[2] = LO_HALF(accumulator)
result[3] = HI_HALF(accumulator)
// combine result[3] and result[2] into 1 DIGIT
// combine result[1] and result[0] into 1 DIGIT
return MAKE_DIGIT(result[3], result[2]), MAKE_DIGIT(result[1], result[0])
Note that many optimizations may be performed on the above code; it is laid out like this for easy comprehension.
For the operation a * b, if the high digit is non-zero, the result has overflowed
For the operation a * b / c, if the high DIGIT of (a * b) >= c, then the entire operation will overflow.
Signed values are left as an exercise for the student.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
All that matters is if a * factor overflows, so the /10 can be ignored. I believe you just need to check if (a <= (INTMAX / factor)).
|
|
|
|
|
It will take more effort and cpu cycles to pick off the overflow than simply move it to next size up integer, do the mult on a that type and look at the result for overflow
So for 16 bit int and 32bit long as an example
long b = a;
b *=25
b /=10
if (b & 0x7FFF0000 != 0)
{
}
a = (int) b;
If you want to do it proper anal uses standard ints
#include <stdint.h>
int16_t a = ????;
int32_t b = a;
b *=25
b /=10
if (b & 0x7FFF0000 != 0)
{
}
a = (int16_t) b;
In vino veritas
modified 10-Jul-19 9:41am.
|
|
|
|
|
Nice.
|
|
|
|
|
hi I m getting this error any suggestion:
AccessibilityObject = 'object.AccessibilityObject' threw an exception of type 'System::Runtime::InteropServices::COMException^'
|
|
|
|
|
You don't have privilege to run it. Log in or run the program as administrator.
In vino veritas
|
|
|
|
|
Update
I linked only part of the /lib folder , my mistake.
Still like to know if my original question - linking to network resource is feasible.
This is basically result of my inability to ".configure" for non - native architecture.
The "configure" kept asking for dependency after dependency.
So I ended up running .configure on required architecture.
After a detour I am back to tying to implement / crosscompile C++ code.
I can option a prefix for desired architecture , but still having an issue linking to specific desired architecture libraries.
I was unable to use ".configure " to create correct foreign architecture library on "local" architecture.
I did a hack by copying an entire "foreign" folder to local device and was partially successful linking to it.
Still missing some library and could do same hack.
Is there a more "elegant" way to accomplish that?
Here is what is still failing to link correctly.
Sorry for the mess.
gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9)
COMPILER_PATH=/usr/lib/gcc-cross/arm-linux-gnueabihf/5/:/usr/lib/gcc-cross/arm-linux-gnueabihf/5/:/usr/lib/gcc-cross/arm-linux-gnueabihf/:/usr/lib/gcc-cross/arm-linux-gnueabihf/5/:/usr/lib/gcc-cross/arm-linux-gnueabihf/:/usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/bin/
LIBRARY_PATH=/usr/lib/gcc-cross/arm-linux-gnueabihf/5/:/usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/lib/../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/lib/:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-L/media/z/KINGSTON/BULEZ_LIB_RPI' '-L/usr/arm-linux-gnueabihf/lib' '-L/media/z/DEV/BLUEZ/BLUEZ_LIB' '-v' '-o' 'VNAR_1971_JULY' '-shared-libgcc' '-march=armv7-a' '-mfloat-abi=hard' '-mfpu=vfpv3-d16' '-mthumb' '-mtls-dialect=gnu'
/usr/lib/gcc-cross/arm-linux-gnueabihf/5/collect2 -plugin /usr/lib/gcc-cross/arm-linux-gnueabihf/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc-cross/arm-linux-gnueabihf/5/lto-wrapper -plugin-opt=-fresolution=/tmp/ccUbRWT4.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -dynamic-linker /lib/ld-linux-armhf.so.3 -X --hash-style=gnu --as-needed -m armelf_linux_eabi -z relro -o VNAR_1971_JULY /usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/lib/../lib/crt1.o /usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/lib/../lib/crti.o /usr/lib/gcc-cross/arm-linux-gnueabihf/5/crtbegin.o -L/media/z/KINGSTON/BULEZ_LIB_RPI -L/usr/arm-linux-gnueabihf/lib -L/media/z/DEV/BLUEZ/BLUEZ_LIB -L/usr/lib/gcc-cross/arm-linux-gnueabihf/5 -L/usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/lib/../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/lib ./src/MODULES/SOURCE_CODE/src/ESA_BASE_BAD.o ./src/MODULES/M_WIRE/CLASSWIRE.o ./src/MODULES/M_VNAR/CAD8302Detector.o ./src/MODULES/M_VNAR/C_DirectionalCoupler.o ./src/MODULES/M_VNA/CVNA.o ./src/MODULES/M_UTILITY/CUtility.o ./src/MODULES/M_TFT/CTEMPLATECLASS.o ./src/MODULES/M_TEMPLATE/CParameter.o ./src/MODULES/M_TEMPLATE/CParameter_test.o ./src/MODULES/M_TCP_IP/CTCPIPSERVER.o ./src/MODULES/M_TCP_IP/CTCPITCLIENT.o ./src/MODULES/M_SPI_TEST/CLASSSPITEST.o ./src/MODULES/M_SPI_LCM1602/C_TEMP_SPI.o ./src/MODULES/M_SPI_LCM1602/SAMPLE_CODE.o ./src/MODULES/M_SPI/CLASSFBDRIVER.o ./src/MODULES/M_SPI/CLASS_SPI.o ./src/MODULES/M_SPI/CLASS_SPI_BAD.o ./src/MODULES/M_SPI/C_FB.o ./src/MODULES/M_SPI/C_SPI.o ./src/MODULES/M_SPI/C_TFT.o ./src/MODULES/M_SPI/_touch.o ./src/MODULES/M_PCF8574/CLASSPCF8574.o ./src/MODULES/M_LCM1602_I2C/CLASSLCM1602.o ./src/MODULES/M_IOCTL/CIOCTL.o ./src/MODULES/M_IOCTL/CIOCTLGPIO.o ./src/MODULES/M_IOCTL/CIOCTLSPI.o ./src/MODULES/M_IOCTL/CLASSI2C.o ./src/MODULES/M_ILI9340_SPI_TFT/ili9340spi_rpi-master/demo.o ./src/MODULES/M_ILI9340_SPI_TFT/ili9340spi_rpi-master/fontx.o ./src/MODULES/M_ILI9340_SPI_TFT/ili9340spi_rpi-master/ili9340.o ./src/MODULES/M_ILI9340_SPI_TFT/ili9340spi_rpi-master/touch.o ./src/MODULES/M_ILI9340_SPI_TFT/ili9340spi_rpi-master/xpt.o ./src/MODULES/M_ILI9340_SPI_TFT/ili9340spi_rpi-master/xpt2046.o ./src/MODULES/M_ILI9340_SPI_TFT/CILI9340SPITFT.o ./src/MODULES/M_I2CIO/CLASSI2CIO.o ./src/MODULES/M_DDS_60/CDDS60.o ./src/MODULES/M_BLUETOOTH/CBT.o ./src/MODULES/M_BLUETOOTH/CBTTOOLS.o ./src/MODULES/M_BLUETOOTH/CDBUS.o ./src/MODULES/M_BLUETOOTH/CHCI.o ./src/MODULES/M_BCM2835_SPI_TFT/CBCM2835SPITFT.o ./src/MODULES/M_BCM2835_SPI_TFT/CBCMGPIO.o ./src/MODULES/M_BCM/CBCM.o ./src/MODULES/M_BASE_TEST/CBASE.o ./src/MODULES/M_BASE_TEST/CDEVICE.o ./src/MODULES/M_BASE_TEST/CINHER.o ./src/MODULES/M_ADS1115/CADS1115.o ./src/MODULES/M_ADA_ILI9341/ADAPORTILI9341.o ./src/MODULES/M_ADA/CADAILI9341.o ./src/MODULES/M_1602_HPP/M_1602_HPP.o ./src/MODULES/MODULE_SPI_DRIVER/CSPIDRIVER.o ./src/MODULES/MODULE_SPI/CSPI.o ./src/MODULES/MODULE_MAP_GPIO/CMAPGPIO.o ./src/MODULES/MODULE_INHERITED_GPIO_MAP/INHERITANCEBASE.o ./src/MODULES/MODULE_INHERITED_GPIO_MAP/INHERITANCEDERIVED.o ./src/MODULES/MODULE_INHERITED_GPIO_MAP/MODULEINHERITEDGPIOMAP.o ./src/MODULES/MODULE_I2C/CI2C.o ./src/MODULES/MODULE_GPIO/CGPIO.o ./src/MODULES/MODULE_BASE_GPIO_MAP/MODULEBASEGPIOMAP.o ./src/MODULES/MODULE_1602/C_1602.o ./src/MODULES/MODULE_1602/C_LCD2_CPP.o ./src/MODULES/MODULE_1602/C_SPI.o ./src/MODULES/MODULE_1602/C_SPI_LCD.o ./src/MODULES/MODULE_1602/C_SSP.o ./src/MODULES/MODULE_1602/C_gpio.o ./src/VNA_1022_BASE.o -lbluetooth -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc-cross/arm-linux-gnueabihf/5/crtend.o /usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/lib/../lib/crtn.o
/usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/bin/ld: cannot find /lib/arm-linux-gnueabihf/libc.so.6
/usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/bin/ld: cannot find /usr/lib/arm-linux-gnueabihf/libc_nonshared.a
/usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/bin/ld: cannot find /lib/arm-linux-gnueabihf/ld-linux-armhf.so.3
collect2: error: ld returned 1 exit status
Ideally to be able to option crosscomplier to use "foreign" links.
Would something like adding another prefix to the "_L" option work ?
modified 5-Jul-19 12:37pm.
|
|
|
|
|
Look at the error messages; there appear to be some files missing from the default location. You need to find out where they are stored and add that path to the linker options.
|
|
|
|
|
Do your standard apt-get update and install on libc somethings missing.
In vino veritas
|
|
|
|
|
System.Windows.Markup.XamlParseException: ''The invocation of the constructor on type 'CommonXFS.Interface.Utility.MainWindow' that matches the specified binding constraints threw an exception.' Line number '5' and line position '9'.'
InnerException:
FileNotFoundException: Could not load file or assembly 'Interop.NXCameraXLib.1.0, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
-----------------------------------------------------------------------------------------------------
Note I have tried both (x86) and (x64)
My DLl is not able to load as "Interop.NXCameraXLib.1.0 "(file from OCX adeed as reference) is not loading properly.
My Query !: Do we have any way to create an managed code(C++/CLI dll which don't need any dependency from any 3rd party if yes please share an example.
2) is there any way to sesolve siscussed error.
|
|
|
|
|
Hi
IS there a way to return from DoModal without having a PUSH BUTTON with the value of IDOK ,IDCACEL or IDABORT I would like to have 3 radio buttons specifying 3 choice and return the value of one of those to DoModal
thanks
|
|
|
|
|
ForNow wrote: IS there a way to return from DoModal without having a PUSH BUTTON with the value of IDOK ,IDCACEL or IDABORT
Yes. Just press the Enter button.
|
|
|
|
|
Hi,
ForNow wrote: Hi
Is there a way to return from DoModal without having a PUSH BUTTON with the value of IDOK?
Yes.
You would need to call the EndDialog function with the second argument set to the ID of your radio button. If you are not using Windows API and are using MFC instead... you would call CDialog::EndDialog
Best Wishes,
-David Delaune
|
|
|
|
|
I thought enddialog takes the value returned from DoModal
How can I pass return value to DoModal without one the predefined ways/values Microsoft is forcing me
I for instance would like to return the ID of a radio button which tell me which one of the options the user selected
|
|
|
|
|
ForNow wrote: I thought enddialog takes the value returned from DoModal
You have that backwards... DoModal() receives the return value from EndDialog()
ForNow wrote: How can I pass return value to DoModal without one the predefined ways/values Microsoft is forcing me
EndDialog(YourWindowHandle,YOUR_RADIO_ID); EndDialog(YOUR_RADIO_ID);
Best Wishes,
-David Delaune
|
|
|
|