|
"... can use thread local storage to keep track of an object's internal data" from a cp article.
//now my doubt is
CMyObj ob; //my obj is stored inside stack.
CMyObj* pOb = new CMyObj(); //my obj is stored inside heap.
---------------- //now how to store in threads local storage ?
pls throw some light
|
|
|
|
|
|
look for TLS (thread local storage) in MSDN. Also the functions TlsAlloc , TlsFree , TlsGetValue , TlsSetValue might be helpful.
|
|
|
|
|
Hi, I have created a precompiled header in my Win32 App and when I compile I recieve an error:
pchafx.cpp(1) : error C2850: 'PCH header file' : only allowed at file scope; may not be in a nested construct
It points to #include "pchafx.h" in pchafx.cpp file (my precompiled header file)
Can someone please advise?
Thankyou
|
|
|
|
|
http://69.50.187.114/~area51/crash.jpg
I been working on this bug for few days and cant find way.
it is time reminder program.
I do know some validation things and they are not working
The int numbers have to be load from the .ini
|
|
|
|
|
That screenshot doesn't really help.
Paste the code for that field and anything to do with that field.
|
|
|
|
|
CMyDigClockDlg::CMyDigClockDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMyDigClockDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMyDigClockDlg)
m_name = _T("");
m_hour9 = _T("");
m_hour8 = _T("");
m_hour7 = _T("");
m_name2 = _T("");
m_name3 = _T("");
m_name4 = _T("");
m_name6 = _T("");
m_name5 = _T("");
m_hour = 0;
m_minutes = 0;
m_hour2 = 0;
m_hour3 = 0;
m_hour4 = 0;
m_hour5 = 0;
m_hour6 = 0;
m_minutes2 = 0;
m_minutes3 = 0;
m_minutes4 = 0;
m_minutes5 = 0;
m_minutes6 = 0;
m_ampm = _T("");
m_ampm2 = _T("");
m_ampm3 = _T("");
m_ampm4 = _T("");
m_ampm6 = _T("");
m_ampm5 = _T("");
m_notepad = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CMyDigClockDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyDigClockDlg)
DDX_Control(pDX, IDC_CLOCK, m_clock);
DDX_Text(pDX, IDC_NAME, m_name);
DDX_Text(pDX, IDC_NAME2, m_name2);
DDX_Text(pDX, IDC_NAME3, m_name3);
DDX_Text(pDX, IDC_NAME4, m_name4);
DDX_Text(pDX, IDC_NAME6, m_name6);
DDX_Text(pDX, IDC_NAME5, m_name5);
DDX_Text(pDX, IDC_HOUR, m_hour);
DDX_Text(pDX, IDC_HOUR2, m_hour2);
DDX_Text(pDX, IDC_HOUR3, m_hour3);
DDX_Text(pDX, IDC_HOUR4, m_hour4);
DDX_Text(pDX, IDC_HOUR5, m_hour5);
DDX_Text(pDX, IDC_HOUR6, m_hour6);
DDX_Text(pDX, IDC_MINUTES, m_minutes);
DDX_Text(pDX, IDC_MINUTES2, m_minutes2);
DDX_Text(pDX, IDC_MINUTES3, m_minutes3);
DDX_Text(pDX, IDC_MINUTES4, m_minutes4);
DDX_Text(pDX, IDC_MINUTES5, m_minutes5);
DDX_Text(pDX, IDC_MINUTES6, m_minutes6);
DDX_CBString(pDX, IDC_AMPM, m_ampm);
DDV_MaxChars(pDX, m_ampm, 2);
DDX_CBString(pDX, IDC_AMPM2, m_ampm2);
DDV_MaxChars(pDX, m_ampm2, 2);
DDX_CBString(pDX, IDC_AMPM3, m_ampm3);
DDV_MaxChars(pDX, m_ampm3, 2);
DDX_CBString(pDX, IDC_AMPM4, m_ampm4);
DDV_MaxChars(pDX, m_ampm4, 2);
DDX_CBString(pDX, IDC_AMPM6, m_ampm6);
DDV_MaxChars(pDX, m_ampm6, 2);
DDX_CBString(pDX, IDC_AMPM5, m_ampm5);
DDV_MaxChars(pDX, m_ampm5, 2);
DDX_Text(pDX, IDC_NOTEPAD, m_notepad);
//}}AFX_DATA_MAP
}
I have those variables in OnTimer.
This is in my OnTimer function.
if ((CurTime.wHour == m_hour) && (CurTime.wMinute == m_minutes) && (CurTime.wSecond == 00) && (setampm == m_ampm))
{
CString msg;
msg.Format("%s %d:%d %s",m_name, m_hour, m_minutes, m_ampm);
addiconballoon(1,m_name,msg,m_name,10);
startanimateicon();
}
if ((CurTime.wHour == m_hour2) && (CurTime.wMinute == m_minutes2) && (CurTime.wSecond == 00) && (setampm == m_ampm2))
{
CString msg;
msg.Format("%s %d:%d %s",m_name2, m_hour2, m_minutes2, m_ampm2);
addiconballoon(1,m_name,msg,m_name,10);
startanimateicon();
}
|
|
|
|
|
Send me your project. I can't see anything wrong with that. djneried@homemail.com.au
But I have a vauge idea of what is happening
Ashman
I'm normally not a praying man, but if you're up there, please save me Superman.
|
|
|
|
|
So have you looked at line 3102 of wincore.cpp? That should tell you exactly what is wrong.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
So I'm doing a project for a C++ class. I've written all the code, just gotta check for errors
Long story short, it's a energy bill calculator. I'm not sure if I need to provide more information than that.
The only errors I'm getting are 'illegal case' errors, and they're all coming from the same place. (where the bill is calcuated)
Since there are 3 possible inputs (in this case, Residential, Commercial, or Industrial) I decided to use a switch statement. Here's the code:
// calculate the bill
switch(type); {
case 'r':
case 'R': bill = PRICE_R + (amount * KWH_R); break;
case 'c':
case 'C': bill = PRICE_C + ((amount - 1000) * KWH_R); break;
default: cout << "Unknown use code!";
}
switch(offpeak) {
case 'peak':
case 'PEAK': peak = PRICE_PEAK + ((amount - 1000) * KWH_PEAK); break;
case 'off':
case 'OFF': off = PRICE_OFF + ((offpeak - 1000) * KWH_OFF); break;
default: cout << "Unknown use code!";
Now, there are no errors for the Industrial park (the section with Peak or Off-peak cases), but there are for the Residential and Commerical parts in the first case. My question is, do I need to declare the R and C to make them valid cases?
Any help is greatly appreciated!
|
|
|
|
|
Every case value in a switch statement must be a literal scalar (i.e an int , char , bool or enum ).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
You don't say what type offpeak is, but it looks like a string. You can't use string constants in case statements, do:
if ( 0 == strcmpi(offpeak, "peak") )
peak = ...;
else if ( 0 == strcmpi(offpeak, "off") )
off = ...; and so on.
--Mike--
LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
skawttieboy sayz:
case 'peak':
case 'PEAK': peak = PRICE_PEAK + ((amount - 1000) * KWH_PEAK); break;
case 'off':
case 'OFF': off = PRICE_OFF + ((offpeak - 1000) * KWH_OFF); break
how can u write that???
the peak or PEAK that u have written ois not one character it is supposed to be enclosed by double quotes
case "peak":
case "PEAK":
happy Programmin.....
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
In addition to the problem already pointed out, you have an invalid semicolon in the first case statement
<br />
switch(type); {
A good reason for copying & pasting, rather than re-typing your code!
|
|
|
|
|
skawttieboy wrote:
case 'peak':
The type of case constant-expression must be integral (or a class type for which there is an unambiguous conversion to integral type).
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
"Peak" is a string, but 'peak' is an integral. Ask a Mac programmer if you dont believe me
|
|
|
|
|
Call it what you like, but neither will work.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello,
I want to print the picture in a picture control. I created a Cstatic m_picture to load a picture. m_picture has the function "print", it is "m_picture.Print(CDC *pDC, DWORD dwFlags)". Can I use the function print the picture and how to define the parameter pDC?
Thanks in advance
Dada
|
|
|
|
|
i am little Confuse ->do you want to print picture from Picture Box to printer or you want to show picture in the picture box.
if you want to show picture in Picture Box ->these is simple api call CStatic::SetBitmap(...);
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi!
I am new in DirectX programming and have some difficulties with getting mouse position and active sprite on Device screen. Maybe I don`t understand completely principles of IDirectInputDevice8. I am creating some LPD3DXSPRITE and LPDIRECT3DTEXTURE9 on screen and using LPDIRECTINPUTDEVICE8 to capture mouse. But I can`t completely get texture or sprite under mouse. Is there some simple principles to get elements above mouse cursor? Maybe sample or something?
|
|
|
|
|
Even though you're trying to capture a 2D sprite, you're using Direct3D, right? So in reality, you're trying to click on a section of a plane in 3D space. This presents additional computation, since you have to convert the mouse position on the screen into a Ray in 3D space. It's not as simple as the 2D case, I'm afraid
It takes a bit of explanation, and I'm in the process of compiling an article on the subject, but there really isn't room to describe the process here.
You may want to poke around the internet for some keywords like "3D hit testing" "ray picking" and the like.
Bob Ciora
|
|
|
|
|
Hi
we created a MDI application currently running in Windows NT 4.0 (it will be ported to Windows XP by the end of the year) where a child is notebook with max. 76 pages. The number of handles being used by a child are 200 but may be up to 2400. Therefore we need to be careful about how many children we open. What we would like to do is query the number of window handles available in the system in order to determine if the system gets a little bit tight and we pop up a message like "before opening another child, please close another one".
I could not find a function in the Windows SDK to return any information about the available window handles in the system. Can anyone help?
Thanks
Thomas
|
|
|
|
|
You can use the perfmon API to get this information.
-- Rocky Dean Pulley
|
|
|
|
|
|
Is there a way that I can extract C++ recource dialogs,string table, ect.. into a vb file?
|
|
|
|
|