|
I defined two variables like:
CStringW str1(L"Hello");
wchar_t* str2={L"Hello"};
Why str1.GetLength() is 6 while sizeof(str2)/sizeof(wchar_t) is 12?
|
|
|
|
|
There is no way that sizeof(str2)/sizeof(wchar_t) can be 12. str2 is of type wchar_t*, which is a pointer, which will be of size 4 or 8 bytes. wchar_t is of size 2 or 4 bytes, depending on what system you're using. Thus, sizeof(str2)/sizeof(wchar_t) will range between 1 and 4. I've seen values of 1 (gcc 4.0.1 on OS X leopard) and 2 (VC++2008 on Windows 7 32-bit).
Also, the length of str1 is 5 (yes, I've built and run that code fragment), not 6.
So...where did you get your numbers from?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Member 4756574 wrote: Why str1.GetLength() is 6 while sizeof(str2)/sizeof(wchar_t) is 12?
And why rand() is giving me 41 ?
There must be a conspiracy, somewhere...
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]
|
|
|
|
|
CPallini wrote: And why rand() is giving me 41?
Because its not orginal you use of a copy of rand.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Wait, pal, now is giving me another number!
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]
|
|
|
|
|
Really so its a virus please destroy your computer!
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Done (I'm writing this reply from the internet cafe...).
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]
|
|
|
|
|
i have written a vc++(2005) program for brightness of LCD monitor.
giving an option for the user to choose a level (out of 3).
the program works smooth on my notebook and desktop.
but on 2 other notebooks it says " video card not supported "
i am using nvidia.
and the other 2 noteboks have intel extreme and nvidia.
can some1 please guide me.
should i attach the code here?
and i have used these functions :
IOCTL_VIDEO_QUERY_DISPLAY_BRIGHTNESS
IOCTL_VIDEO_QUERY_SUPPORTED_BRIGHTNESS
IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS
here is the link to these function : http://msdn.microsoft.com/en-us/library/aa373156(VS.85).aspx[^]
|
|
|
|
|
In the documentation for these calls, I see that these functions are not supported on Windows Server 2008 and on Vista. The two notebook computers that your program did not work on, what operating system were they running?
Bob
|
|
|
|
|
I ran the program on windows xp only.
All the notebooks and desktop have xp.
Now i tried on one more desktop.and it worked there. It has ATI in it.
I am just not understanding what is happening!
|
|
|
|
|
The availability of ioctls depends on the capabilities of your hardware and its associated driver software. Some ioctls may always be available, but others may well not be. I think you've found some that are sometimes available, sometimes not.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Ok.Sir can you tell me what should i do to overcome this problem?
|
|
|
|
|
Accept that controlling the monitor brightness from the PC isn't universally possible?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
people please give me some solution.
is there any other way of reducing brightness?
|
|
|
|
|
I am currently writing an application using C++ and MFC. I would like the output of this program to include both 2D and 3D plots. I prefer not to write these plotting routines by hand. I am hoping that there is free software out there to do this. I looked at the WPF-powered 3D graphing library found on this server. It is written in C#. I am thinking that is going to be an issue for me. I also tried building it, and ran into some problems. I am thinking that there should be a similar library for C++ and MFC. However, I have been unable to find it. I am hoping somebody here can point me in the right direction.
Thanks
Bob
|
|
|
|
|
Have look at the chart controls on (drumroll) codeproject.
For example, Cedric, who frequents this forum, has written: High-speed Charting Control[^].
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Iain,
Thanks for the response. I down loaded both the library and the demo. Both built fine. However,
when I run the demo program it does not draw lines. In addition, by selecting certain options (such as changing the background) the demo program crashed. I am thinking that this library is not stable enough or well documented enough for my use.
Maybe I should consider a low cost commerical library. Any other suggestions?
Thanks
Bob
|
|
|
|
|
Well I suppose it is stable: Cedric is a smart guy and he updated the library many times. Why don't you report your troubles to him, posting in the article's message board?
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]
|
|
|
|
|
I'd agree that the demo is not perfect - it doesn't redraw the chart when you make a change with any of the the lower buttons - but that's just a case of adding an Invalidate here and there. I couldn't get it to crash though.
Also a shame he doesn't put a compiled demo app on the article page, so you could then check the behaviour of that against your application.
Anyways, that's just one of the articles. If you look in that area of the site, there are others. I just know Cedric's because he gives good answers here, so I trust his programming prowess.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
My application is a modeless dialog which sits on top of the application's main window.
Within the dialog is one edit control.
My pointers are correct i.e., Window->Dialog->EditCtrl
In XP, the Alt+Tab function of the Desktop works just fine.
In Vista, the edit control does not regain focus.
I am fine with sending Focus to the edit control however I am having problems
with intercepting a WM_Message from the desktop when it brings my application to the
foreground.
Is it the Z-order, EV_WM_Message response, using GetForegroundWindow or something else?
I can utilise the EvGetFocus and EvKillFocus functions but cannot distinguish between
control from within the application and that which comes from the desktop.
This is my first time here. Assistance would make me a regular responder to questions.
|
|
|
|
|
I'm not sure what you need, does WM_ACTIVATEAPP[^] help?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Tried both WM_ACTIVATE and WM_ACTIVATEAPP.
I've set up a status bar at the base of the application requesting both
functions to talk (acknowledge the message) to me.
No response.
Thanks for your response.
|
|
|
|
|
I might instantiate these functions into the dialog and
try letting it call the parent window with NotifyParent
to refresh itself.
Always good to talk to someone.
Thank You
Ric
|
|
|
|
|
Ric Ashton wrote: I've set up a status bar at the base of the application requesting both
functions to talk (acknowledge the message) to me.
How do you mean that?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Within C++ Object Windows
TStatusBar* StatusBar;
char xxx[255];
sprintf(xxx, "Keystroke C Timer = %d", RicsMasterTimer);
if (::StatusBar) {::StatusBar->SetText(xxx);}
The status bar is part of the application window.
|
|
|
|