|
I checked about 6 computers at work between single and dual, it looks to be consistent with your findings. Its good enough for me, I will read the values, if not consistent, I will default to either one of the two.
Thanks again
sft
|
|
|
|
|
Hi;
I have just started to use Dev C++. But I guess I just could not figure out how to use it because I have tried a very simple program, but it did not work. I have just one class
#include <iostream>
using std::cout;
using std::endl;
int main(){
cout<<"endl"<<endl;
return 0;
}
</iostream>
When I try to compile it; it gives the error:
[Linker error] undefined reference to `__cpu_features_init'
ld returned 1 exit status
I know this is gonna sound stupid. But I need some help here. Thank you.
|
|
|
|
|
Hmm, I seem to remember having this error once or twice before. I did solve it, though found the whole suite to be a little dated.
An alternative that I've since switched to that you may enjoy is Code::Blocks.
You can find it here: Code::Blocks download page[^]
(you'll probably want the one with MinGW included, as this simplifies setup)
|
|
|
|
|
im using this example to add a new resource to a PE file
http://www.codeproject.com/KB/cpp/UpdateResource.aspx[^]
well when i use this code or a pre defined file path on the compile the code works perfectly
hFile = CreateFile(L"C:\\Winnt\\System32\\calc.exe", GENERIC_READ, 0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
but if i use a cstring that holds the path of a file (it reads the path from a listview item) the program crashes
CString strFile = m_List.GetItemText(0,3)
hFile = CreateFile(strFile, GENERIC_READ, 0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
how can i fix this?
|
|
|
|
|
Evil_Inside01 wrote: the program crashes
Evil_Inside01 wrote: how can i fix this?
By writing code that handles exceptional conditions and reacts gracefully rather than crashing. You know how to do that correct?
led mike
|
|
|
|
|
no im still a beginner in cpp...
so this isnt a CString error that i have to convert CString to another variable?
modified on Monday, November 24, 2008 3:57 PM
|
|
|
|
|
Evil_Inside01 wrote: no im still a beginner in cpp...
What? And you are trying to add a resource to a PE file? Warning Will Robinson! Does not compute!
Do yourself a favor and stick to beginner stuff until you have a very strong grasp on the basics. Using internet forums to debug your beginner level coding of advanced applications is far Far FAR from productive.
led mike
|
|
|
|
|
Evil_Inside01 wrote: (it reads the path from a listview item)...
Have you verified that it is correct?
Evil_Inside01 wrote: ...the program crashes
Which means what?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
ive fixed the error
thanks for helping
|
|
|
|
|
i is an integer holding an 8 bit value of a joysticks position. How do i get an emulator on my pocket pc to see it as an input/button press?
|
|
|
|
|
Try the Mobile Development forum [^].
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]
|
|
|
|
|
Hello,
I'm writing an MFC application that has headings of anti-aliased text in dialogs that are CStatic pictures (bitmaps). They appear against another flat coloured CStatic that has it's color set to "Gray" - the actual shade of gray varies, based on the windows style - a unique shade for windows classic style, windows XP style, or windows Vista style. I could just make the background of the overlaid, anti-aliased text the same as the colour of the flat "gray", but, as I've said, the exact color varies.
What can I do to achieve the desired effect of having an image of anti-aliased text overlaid over the variable "gray", looking correct in all possible scenarios? GDI+ looks interesting, but I can't find a codeproject project that does what I've described.
Thanks in advance,
Sternocera
|
|
|
|
|
Are the bitmaps composed programatically or with an image editor?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
They are simple bitmap files, composed with an image editor,
Regards,
Sternocera
|
|
|
|
|
If you create the bitmaps with a transparent background and save them
in a format that preserves alpha channel info (e.g. PNG) then you can use
GDI+ to easily render the images on any background.
ULONG dwToken;
Gdiplus::GdiplusStartupInput input;
Gdiplus::GdiplusStartupOutput output;
Gdiplus::Status status = Gdiplus::GdiplusStartup(&dwToken, &input, &output);
if(status == Gdiplus::Ok)
{
Gdiplus::Bitmap *srcBitmap = new Gdiplus::Bitmap(L"c:\\some.png", FALSE);
Gdiplus::Graphics g(hwnd, 0);
g.DrawImage(srcBitmap, 0, 0);
delete srcBitmap;
Gdiplus::GdiplusShutdown(dwToken);
}
You could also use GDI+ to compose a bitmap programatically.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark,
Thanks for that. It would be preferable to have a CStatic inheriting class that encapsulated all of this GDI stuff from me, or perhaps worked in a different way, and allowed me to use resources, because the images's(currently a CStatic) position is currently dictated by a third party class that changes the position of widgets as the application's main window is resized, to keep their relative position - I need to maintain this.
All I want is a CStatic with dithered transparency - Is there a more expedient way to get this effect?
Regards,
Sternocera
|
|
|
|
|
Sternocera wrote: It would be preferable to have a CStatic inheriting class that encapsulated all of this GDI stuff from me
You can do the rendering from anywhere you want.
Instead of GDI+, you could create the bitmaps with a background of a certain color
like RGB(0x00,0xFF,0x00). That color can then be used in the TransparentBlt() API
to render a bitmap or to create a masked imagelist from the bitmap which can be rendered
on the control.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark,
That sounds like a good solution. I'll investigate it. Thank you very much,
Sternocera
|
|
|
|
|
I have a class which has 2 access functions thus:
std::vector<const MyClass *> Function() const;
std::vector<MyClass *> Function();
and I am trying to do an assignment from another non const member function of the class like this:
std::vector<const MyClass *> variable = Function();
By default the compiler always tries to use the non const access function and gives me a type mismatch. Is there any way apart from creating a temporary const pointer to myself to force the compiler to resolve to the correct const version of the function which returns the correct type?
If you vote me down, my score will only get lower
|
|
|
|
|
This is how I attempt to do that for subscript operators...
CSomeObject& operator [](int nSubscript);
const CSomeObject& operator [](int nSubscript) const; // Readonly subscript operator
I'm not sure if this will work in the context you provided but it's worth a shot. Got this out of "Professional C++, by Solter and Kleper" Page 446 (Providing Read-Only Access with operator[])
|
|
|
|
|
Hi,
I' need to perform a conversion from wav file to double array. In particularly I'd like to catch only the chunk relative to data information (I would to filter out any info about bitrate, frequency,etc).
How can I do this?
Thank in advance.
|
|
|
|
|
Parse the WAV[^] file, and for each sample, convert the sample to a
double.
Which part of that are you having trouble with?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
have a look at this[^] for a description of the WAV format.
You will need to read in the different headers to know where and how to read the data "chunk"; then, simply read and
add each "sample" to you array, be carefull of the left and right channels.
AFAIK (and understand it), the sample is not a double value.
|
|
|
|
|
Visual C++ 2003, MFC, Doc/View...
I have a need to ensure the CView::OnPaint method and subsequently the CView::OnDraw gets called in certain situations, even without an invalid region. According to the documentation, RDW_INTERNALPAINT should be used within a RedrawWindow() call to force at least one WM_PAINT regardless of whether an invalid region exists or not.
This seems to work only when RDW_INTERNALPAINT|RDW_UPDATENOW are combined. However, I don't want to force the refresh immediately, it would be better to allow the message to be processed in it's normal fashion so I'd rather not use RDW_UPDATENOW.
If I use RDW_INTERNALPAINT by itself, the CView::OnPaint never gets called. What am I doing wrong?
|
|
|
|
|
I bought 16 channel video card that i want to use to build a surveillance system. The software that the company provides is pretty much overkill for what i want use it for. Also the package weighs in at 2gb and doesn't have any option to install only the components that i need. I'd like to develop my own software to communicate with this card directly. Does anyone know if it would be possible?
Don't be overcome by evil, but overcome evil with good
|
|
|
|