|
Hi All,
I have a legacy project with makefile.
Is there any way that i can convert the project to visual studio 2005 solution ?
Thanks in advance...
Appu..
"Never explain yourself to anyone.
Because the person who likes you does n't need it.
And the person who dislikes you won't believe it."
|
|
|
|
|
how to use the code available in net in your project
e.g suppose i want to have style button in my gui...i down load the .h and .cpp from net..then add the files to my project ..but still there is some problem so that that style button was coming in my o/p..so can any body tell me the exact way so that i can use the code availble in net in my project..
thaking all of u..
|
|
|
|
|
You're still not quite getting it, are you?
What bloody code?
Your question sounds a little like this:
"I was driving down the road, and my car stopped. WHY?"
If you provide virtually no information, you're virtually guaranteed to get no answer.
Can somebody tell me where CodeProject claims to be a forum full of psychics or mind-readers?
|
|
|
|
|
More more explain is helpful! ![Big Grin | :-D](https://www.codeproject.com/script/Forums/Images/smiley_biggrin.gif)
|
|
|
|
|
see i am a beginner so if there is some problem with question then am sorry but i am also a new user too.so instade of critising me u should cope up..as all r not talented by birth.
|
|
|
|
|
You have cpp/h files and you imported these files to your project but it seems they dont work on your project.did you declare your variables of this class(I dont know its name) instead CButton class? (also more explain is helpful). ![Wink | ;)](https://www.codeproject.com/script/Forums/Images/smiley_wink.gif)
|
|
|
|
|
Hi,
I am facing problem in SHGetFileInfo API. Code is below:
CoInitialize(NULL);
SHFILEINFO fi;
BOOL bReturn = FALSE;
HIMAGELIST himl = NULL;
ZeroMemory (&fi, sizeof (fi));
himl = (HIMAGELIST)SHGetFileInfo (NULL, 0, &fi, sizeof (fi), SHGFI_ATTRIBUTES | SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
In my project I am writing this code in OnInitDialog() but "himl" is coming NULL but if a write the same code in a fresh project I is retuning non zero.
What is the problem plz suggest me?
|
|
|
|
|
I got the problem, my project in set to Unicode.
But why this API is not working in Unicode defind project?
|
|
|
|
|
MPTP wrote: What is the problem plz suggest me?
Have you called CoInitialize() or OleInitialize() ?
"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
|
|
|
|
|
I am trying to render multiple texts in different fonts and sizes using OpenGL.
but the use of wglusefontbitmaps seems to cause some memory leakage? How can I avoid this. I am attaching the code for rendering below
void M4DScreenData::RenderOverlayData( HWND hWnd_i )
{
GLint nDisplayList = glGenLists( 128 );
HDC hDC = ::GetDC( hWnd_i );
HFONT hOldFont;
HFONT hNewFont;
glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);
TextData TextDataobj;
POSITION nPos = m_DataMap.GetStartPosition();
int nID = 0;
glColor3ub( 255, 255, 255 ); // Overlay data color
while( nPos )
{
if( 0 != m_Font.GetSafeHandle())
{
m_Font.DeleteObject();
}
m_DataMap.GetNextAssoc( nPos, nID, TextDataobj ); //Cmap that contains the data,font and size
CString csOverLayData = TextDataobj.GetText();
int nLength = csOverLayData.GetLength();
CPoint Location = TextDataobj.GetPos();
m_Font.CreatePointFont(( TextDataobj.GetFontSize()) * 10, TextDataobj.GetFontName(), NULL );
hNewFont = ( HFONT )m_Font.GetSafeHandle();
hOldFont = ( HFONT )SelectObject( hDC, hNewFont );
wglUseFontBitmaps( hDC, 0, 128, nDisplayList );
glListBase( nDisplayList );
// Position the text in the window, at location (Xcoord, Ycoord)
glRasterPos2d( Location.x, Location.y );
glCallLists( nLength, GL_SHORT, csOverLayData ); // Display overlay data
SelectObject( hDC, hOldFont );
}
if( 0 != nDisplayList )
{
glDeleteLists( nDisplayList, 128 );
}
}
|
|
|
|
|
I have happily and successfully programmed graphics processing for many years using VB, but I want to port the project over to VC++. As a trial a week ago I looked at C# and found no problems. However, C++ proved to be hell . I started with a form (Form1), dressed it up OK and loaded images, scroll bars worked. It all worked OK. I then added a second form (CAMERAFrm) and could not open it from the first one. I tried all sorts of variants of ShowDialog() found on MSDN, in forums and books, to no avail. The error messages summarised say that CAMERAFrm is unknown, even when I include each .h form in the code of the other and spell its name out fully. The project name is cppPOSTERclr and the two forms are said to be - public - and - ref class - but whether I try to use CAMERAFrm as a class-
CAMERAFrm ^ DSLR =gcnew CAMERAFrm
DSLR->ShowDialog(this)
or as an object-
CAMERAFrm->ShowDialog(this)
the project claims CAMERAFrm is undefined.
Intelisense and edit panel titles gives me cppPOSTER::Form1 and cppPOSTER::CAMERAFrm as valid names with global scope. However, even when I try to use cppPOSTER::CAMERAFrm I get messages such as-
error C2039 'CAMERAFrm': is not a member of 'cppPOSTERclr'
error C2039 'CAMERAFrm': is not a member of 'cppPOSTERclr::Form1'
I can open a third new window:-
Form ^ DSLR= gcnew Form()
DSLR->ShowDialog(this)
Can anyone tell me what is happening? I did nothing fancy: just opened two forms and tried to open the second from a button in the first.
Surely VC++ isn't a savant - good for intricate detail but hard to get on with in everday life!
|
|
|
|
|
u need to add the .h file for your CAMERAFrm in Form1.h file and then create a member of CAMERAfrm in Form1.h
Then on button click call DoModal()
This will work for you.
|
|
|
|
|
Hi, all:
There are some good oppotunity in Freeborders, we are search some Sr.C++ Engineer to join us, if you are interested in this position, please move your mouse to send me your CV to pandapam@126.com, maybe i can help you to get a good job!
Thank you for your attention, wish you a good luck.
|
|
|
|
|
Support! ![Wink | ;)](https://www.codeproject.com/script/Forums/Images/smiley_wink.gif)
|
|
|
|
|
This is not the right forum.
|
|
|
|
|
Hello,
I am new to the C++ language. How can I make a variable hold its value when enters the function the next time, I don't want to declare it as static, I was wondering how its handled in MFC. Here is the concept of what I want to do:
How can I hold the value of variable m_Val when it exits the function, doesn't reset to zero when it comes back in? (note, can't use static)
Thanks
Class A{
void DoFunction(....)
double m_Val;
...etc
};
void A::DoFunction(....)
{
....
m_Val = x^2/1000 ;
if(flag)
m_Val -= K;
....
}
int main()
{
....
For Loop timer every 15 msecs{
DoFunction(...)
}
}
sft
|
|
|
|
|
Not quite sure if I understand you sft.
Would you like the value of m_Val to be the same after a call to A::DoFunction(....) as it was before?
Or do you simply want m_Val to hold whatever is put into it until it is explicitly changed again?
If the answer is (a) the first one, use some code like this:
void A::DoFunction(....)
{
double m_Temp_Val = m_Val;
....
m_Val = x^2/1000 ;
if(flag)
m_Val -= K;
....
m_Val = m_Temp_Val;
}
If however, the answer is (b), you already have posted code that will allow the value of m_Val to persist, or remain until the next time you choose to change it. Since m_Val is a class member, it's value will remain until either (a) you re-assign a value to it by using the A::DoFunction member(assuming no other member functions modify the value held by m_Val), or (b) the class object is destroyed, either by going out of scope, or explicitly via a call to the delete function.
S.
|
|
|
|
|
Thanks for your explanation, my question was (b), and you are right, I had it working as posted.
I do have a seperate question, I would like to use a flag in MFC that will tell me if the computer/(OS) is using a 10 ms or 15 ms time slices... Is there a way I can find out what time slice does a computer have, or any other method to obtain this? I can use GetTickCount() to calculate the thread updates and find the time slice may be, but it doesn't sound too smart.
Thanks
sft
|
|
|
|
|
From the articles I'm reading, it seems that this should be reasonably easy to determine.
Quoting from Description of Performance Options in Windows[^],
The term "quantum" is a unitless measure of time for each time slice that a thread will run until a "context switch" occurs and another thread (either within the same program or from within another program) is selected to run. This prevents a CPU-bound process from monopolizing the processor. Currently in Windows, 3 quantums are equal to either 10 milliseconds (single processor) or 15 milliseconds (multiple-processor Pentium). This depends on the hardware abstraction layer (HAL) selected for your computer. Original Equipment Manufacturer (OEM) HALs may have a different value. Time slices that are fixed at 36 quantums are currently used when background services are selected (as you might choose in a typical server installation).
The situation become more complex when you enable the Foreground Applications option. This introduces the "variable quantum" concept. In this case, background tasks receive a different quantum than the quantums received by the foreground tasks. Also, both sets of quantums are shorter than a thread would receive on a computer set for background services. Currently, a background process receives a quantum of 3 and a foreground process receives a quantum of 9. Therefore, you can calculate the length of time the thread will run before its timer expires.
Soooo, it seems that all you have to do is determine if the running system contains a single processor, or multiple processors.
If you open up regedit, and take a look at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion , there is a key called CurrentType
On my Celeron D 2.66 Ghz, this has the value "Uniprocessor Free".
On my Pentium D 3.4 Ghz, this same key has the value "Multiprocessor Free"
Perhaps it really is as simple as that??! (hope so )
Simon.
|
|
|
|
|
Thanks again, but if I read that particular key from the registry, it will only work if all the strings are consistent on all computers, otherwise reading the 2 particular strings won't be good enough, correct?
sft
|
|
|
|
|
That's okay. Yup, got it in one. If these strings vary, then this method I propose would suck the big-one.
The only thing I can think of is to try it on a number of different machines, or see if anyone else around the net has anything to say about this (yeah, I know - sorry it's a disingenuous suggestion, but I can't think of any other ways to attack the problem right now)
Here's a page that mentions the key -
http://www.volny.cz/rootshell/hackistry.htm[^]
Hope it helps get you there.
S.
|
|
|
|
|
enhzflep wrote: On my Pentium D 3.4 Ghz, this same key has the value "Multiprocessor Free"
I have an Intel Core Duo that reports the same.
"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
|
|
|
|
|
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)
|
|
|
|
|