|
Hi everyone,
Can anyone tell me how to convert a vector (of doubles) to a variant?
I am receiving the following error message from vc++ 2008:
error C2664: 'CiPlotChannelX::AddXYArrays' : cannot convert parameter 1 from 'std::vector<_Ty>' to 'const VARIANT &'
I have close to 1 million values so I'm trying to avoid any "for" loops.
Thanks!
|
|
|
|
|
Never needed to do this but i read somewhere that you can use CComSafeArray[^] to get a variant, or something that you can use with variant from an array. I think you need to wrap your array into this CComSafeArray thing (it is a template i believe) and then use Detach or maybe it's LPSAFEARRAY operator to get a SAFEARRAY wich can be used with VARIANT.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers don't kill programs, users kill programs <
> "It doesn't work, fix it" does not qualify as a bug report. <
|
|
|
|
|
ok, thanks. I'll look into this.
|
|
|
|
|
I have created a custom class to draw radio button and I am able to create it using the class object, but I want to imiplement group property on the radio button.
Can anybody please help me in this regards.
Thanks....
|
|
|
|
|
You should be a tiny bit more specific than that...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers don't kill programs, users kill programs <
> "It doesn't work, fix it" does not qualify as a bug report. <
|
|
|
|
|
I have a class CCustomRadioCtrl which is derived from cbutton with radio button style. using the object of my custom class I can create radio button, I am not able to set the group property of the radio button if I hv more then one radio control, So that one can be selected at a time.
|
|
|
|
|
What do you mean by "not able to set it"? You use something like ::SetWindowLong(hRadioBtn, GWL_STYLE, ::GetWindowLong(hRadioBtn, GWL_STYLE) | WS_GROUP) but it gives you an error code? You can't set the group style in the resource editor? You can set it but it just does not work? If it is the later one, what happens? Is your radio owner-drawn (has the BS_OWNERDRAW) style? If no, then i guess BS_AUTORADIOBUTTON should make it work. If yes, then, since according to the documentation[^] BS_OWNERDRAW can't be combined with anything else, you will have to provide this functionality manually. You can try using CheckRadioButton[^], i don't know if it works for owner-drawn buttons or not. Other than that what you can do i guess is use GetNextWindow[^] to walk the controls around the radio that has been clicked and find the other radios inside the same group and check/uncheck them.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers don't kill programs, users kill programs <
> "It doesn't work, fix it" does not qualify as a bug report. <
|
|
|
|
|
Can you send me some sample code, please ?
|
|
|
|
|
Of what?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers don't kill programs, users kill programs <
> "It doesn't work, fix it" does not qualify as a bug report. <
|
|
|
|
|
Hi!
I got the following compiler error.
error C2491: 'CEGUI::IrrlichtRenderer::d_rendererID' : definition of dllimport static data member not allowed
I've not imported any dlls. I've declared the variable "d_rendererID" in the header file as static with a
protected access specifier.
static String d_rendererID;
and I'm defining it in the source file like this:
String IrrlichtRenderer::d_rendererID("CEGUI::IrrlichtRenderer "
"- Official Irrlicht based 2nd generation renderer module.");
What is the thing that prevents the definition of this variable? How do I resolve?
|
|
|
|
|
All error codes can be found on MSDN with a better description -> C2491[^]
What is String? A class or a #define?
#define String __declspec(dllimport) std::string
could result in such error.
|
|
|
|
|
hi i want to open and play a video file in pocket pc 2003 using vc++.
please any idea any sample code which will help me.
|
|
|
|
|
|
Hi!
I got this error when I compile m y project.
error C2664: 'irr::video::ITexture *irr::video::IVideoDriver::addTexture(const irr::core::dimension2d<T> &,const irr::io::path &,irr::video::ECOLOR_FORMAT)' : cannot convert parameter 1 from 'irr::core::dimension2d<T>' to 'const irr::core::dimension2d<T> &'
1> with
1> [
1> T=irr::u32
1> ]
1> and
1> [
1> T=irr::s32
1> ]
1> and
1> [
1> T=irr::u32
1> ]
1> Reason: cannot convert from 'irr::core::dimension2d<T>' to 'const irr::core::dimension2d<T>'
1> with
1> [
1> T=irr::s32
1> ]
1> and
1> [
1> T=irr::u32
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
How do I resolve this error?
|
|
|
|
|
Please don't post the error message as code, it becomes unreadable.
Could you also post some part of the code where the error occured?
By looking at the error, it seems you are trying to pass a dimension2d<u32> to a function accepting a dimension2d<s32>. With template objects, there's no automatic conversion even if a u32 can be converted to a s32 automatically. These templates are two different objects which cannot be interchanged.
You have to work with a dimension2d<s32> instead of a dimension<u32>.
EDIT: fixed the HTML tags
|
|
|
|
|
Here is the line that causes the error.
d_texture = d_driver.addRenderTargetTexture(
irr_sz, IrrlichtTexture::getUniqueName().c_str());
irr_sz is the argument of type
irr::core::dimension2d<irr::s32>
Compiler says can't convert the above type to const irr::core::dimension2d<T>
What to do?
|
|
|
|
|
Sorry, the < and > symbols were removed in my previous reply. This is fixed, and I explained what you have to do.
|
|
|
|
|
I have been asked this question in my recent interview...
"How can we make sure that only one thread access global variable?"
What's the appropriate answer.
Thanks all
|
|
|
|
|
Using "Synchronization".
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
That does not limit the number of threads accessing a variable, it merely sequences the accesses, making sure they don't overlap.
|
|
|
|
|
Of course.
It wasn't clear to me what the interviewer really asked to the OP.
BTW you may use a synchronization object to prevent other threads accessing the resource, if hanging the other threads is an option...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Thursday, June 17, 2010 8:40 AM
|
|
|
|
|
We both read the same sentence, which is pretty clear IMO. I took it as is, you chose to read something that wasn't really there... Hanging is not an option, this ain't 19th century Texas.
|
|
|
|
|
Yes, indeed it was pretty clear and I really chose to read it that way (I've updated my previous reply).
Hanging threads is an everyday option for many 'senior developers' around...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|