|
Try it :
*(Filtered_Average[ik]) = filtered_sum/95;
virtual void BeHappy() = 0;
|
|
|
|
|
I would like to use a shortcut to point to a file in some other directory. In windows C++ how can I get at the target the shortcut is pointing to in order to then open that specific file?
|
|
|
|
|
This[^] article might help.
|
|
|
|
|
I am not sure where to post this , so it is here.
I am a lazy programmer and have a hard time keeping track of #include(s) nesting in my messy program.
I started to use "forward declaration" to mask #include files dependencies.
It works most of the time.
But is it a good practice?
Would it be going too far if I just forward declare all my classes in stdafx.h? Is portability main issue here or what is the issue?
Thanks for reading.
Vaclav
|
|
|
|
|
i don't like forward declarations, but i'm not exactly sure why. i always feel weird when i have to make one.
but, sometimes they're just plain necessary.
|
|
|
|
|
Vaclav_Sal wrote: I started to use "forward declaration" to mask #include files dependencies.
Like you said, if you want to minimise link dependecies it's a great tool. Change one header file and you will not have to recompile a rats tail of other object files, just because the class is used in protected/private methods of other classes. Generally I include only header files absolutely necessary to compile in header files... and put the rest into the individual source files. With bigger projects it can be a time saver.
Vaclav_Sal wrote: Would it be going too far if I just forward declare all my classes in stdafx.h
I would personally use stdafx.h only to what it was intended for, speed up compilation time. For example have library and rarely changing header files in it. However I keep dependencies working without precompiled headers, in case I rip out a file/module and reuse it in another project. That's just my personal design taste, hope it helped.
/M
Webchat in Europe Now with 26% more Twitter
modified on Wednesday, April 7, 2010 1:54 PM
|
|
|
|
|
Quit editing quick answers and not changing anything...who wants to see a question from March brought back up to the top of the list just so you can get some editing points?!?
|
|
|
|
|
William, I was retagging the questions for better findability.
In my opinion such changes should not bring back quick answers to the top of the "last changes" list and also give no editing points (actually they don't). You can report it here[^].
Cheers
|
|
|
|
|
There is nothing wrong with forward declarations. In fact, some very well known and useful C++ idioms depend on that technique: Pimpl (opaque pointer)[^], for instance.
|
|
|
|
|
There was a good word said by Chris: "sometimes",
that is not associated for me with "stdafx.h"...
virtual void BeHappy() = 0;
|
|
|
|
|
i want to convert the interger to a binary string in EVC.so i use the '_itot'.
<br />
UINT16 high16data = dwReadValue;<br />
CString high16string = _itot(high16data, high16string, 2);<br />
the error is:error C2664:'_itow':cannot convert parameter 2 from 'const unsigned short *'
how can i convert the parameter?(i do want to use the CString type not the char[] as showed in MSDN). so how to do it?
thanks for helping.
i 've tried ,then i have no regret
|
|
|
|
|
_itot does not accept a CString as parameter. you have to pass a TCHAR* as the second parameter. Why don't you use CString::Format?
|
|
|
|
|
CString::Format maybe a good choice,i'll try it tomorrow
i 've tried ,then i have no regret
|
|
|
|
|
CHYGO wrote: i'll try it tomorrow
It will be a good day
virtual void BeHappy() = 0;
|
|
|
|
|
it is an good day
i 've tried ,then i have no regret
|
|
|
|
|
LPWSTR URL;
ComboBox_GetText(hComboBox, URL, sizeof URL);
I'm writing this app where the user enters a URL in a ComboBox.
When he presses OK, the text in the ComboBox is retrieved to start processing.
Using Unicode!
Every time I enter a URL the program breaks and starts the debugger.
Running Visual Studio 2010.
Any help appreciated.
modified on Wednesday, April 7, 2010 8:43 AM
|
|
|
|
|
And what is your trouble about?
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]
|
|
|
|
|
Every time I enter a URL the program breaks and starts the debugger.
Running Visual Studio 2010.
|
|
|
|
|
You didn't provide the required buffer (URL doesn't point to a valid memory buffer).
Try
LPTSTR URL;
int len = ComboBox_GetTextLength(hComboBox);
URL = new TCHAR[len+1];
ComboBox_GetText(hComboBox, URL, len+1);
delete [] URL;
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]
|
|
|
|
|
It works, but something weird happened.
The GetText method requested URL to be LPWSTR.
LPTSTR is multibyte, not unicode.
Any pointers what was the trick in fixing it?
|
|
|
|
|
Actually the ComboBox_GetText macro accpts a LPTSTR as you may see in the documentation [^].
Is there something I missed?
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]
|
|
|
|
|
LPTSTR is defined as follow:
#ifdef UNICODE
typedef WCHAR *LPTSTR;
#else
typedef char *LPTSTR;
#endif
so it will be a pointer to a multibyte or unicode string depending on the project settings; if you choose "Use Unicode Character Set" on the General Tab of your project properties, then LPCSTR is a pointer to an unicode string.
|
|
|
|
|
Hello folks!
I got an annoying anomaly with GDI+ i just can't understand. I created a 32 bit bitmap in memory, did some drawing on it and used it to display a layered window. This all works well except for one thing. I use Gdipluss::Graphics::DrawString to render some text onto this bitmap which seems to erase the alpha channel on the bitmap everywhere where letters of the text are drawn. Here's the simplified code i use:
...
Gdiplus::Graphics Gx(MemDC);
Gdiplus::SolidBrush GxTextBrush(Gdiplus::Color(0, 0, 0));
Gdiplus::Font GxFont(MemDC, &LFont);
Gdiplus::RectF TextRect;
Gdiplus::StringFormat GxFormat;
Gx.DrawString(text, textlength, &GxFont, TextRect, &GxFormat, &GxTextBrush);
...
Changing the GxTextBrush 's color by adding an alpha component of 254 "fixes" the problem, but adding 255 produces the holes again, also making the font bold (LFont.lfWeight = FW_BOLD ) seems to fix the problem also... so could someone please tell me what's the logic behind this? For now i set the alpha to 254 and go on with it...
Thanks for any light-sheding attempts in advance.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi,
I want to send a request to execute a http link which is running in another machine.how to do this using?Is there any function in MFC or SDK? anyone please help me?
thanks,
|
|
|
|
|