|
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?
|
|
|
|
|
I've never seen anything that will do that, there are two very different formats but in theory you should be able to take a .rc dialog and convert it to a .frm. Although I'm not sure if Microsoft ever documented the VB form file format. Might get better help in the VB forum[^]
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
There is enough information to get the info that is needed, I think I can recreate the dialogs and menu's. But I'm not sure how to convert this text to human readable text. What format would this be in?
Thanks,
Andy
/////////////////////////////////////////////////////////////////////////////
//
// Dialog Info
//
3002 DLGINIT
BEGIN
15000, 0x376, 507, 0
0x0000, 0x0000, 0x0000, 0x0001, 0x0211, 0x0000, 0x0172, 0x0000, 0x0000,
0x0000, 0x0032, 0x0000, 0x0000, 0xa000, 0x0001, 0x0000, 0x0000, 0x1400,
0x8e01, 0x8500, 0xa902, 0x0001, 0x0000, 0x0100, 0x0000, 0x1200, 0x2100,
0x4d00, 0x2e00, 0x2000, 0x0000, 0x0200, 0x0000, 0x4e00, 0x1e00, 0xe900,
0x3200, 0x0400, 0x0000, 0x0300, 0x0000, 0x1200, 0x3a00, 0x4d00, 0x4700,
0x2000, 0x0000, 0x0400, 0x0000, 0x4e00, 0x3700, 0x2000, 0x4b01, 0x0c00,
0x0000, 0x0500, 0x0000, 0x1200, 0x5a00, 0x4d00, 0x6700, 0x2000, 0x0000,
0x0600, 0x0000, 0x4e00, 0x5700, 0x8a00, 0x6b00, 0x0c00, 0x0000, 0x0700,
0x0000, 0x1200, 0x7300, 0x4d00, 0x8000, 0x2000, 0x0000, 0x0800, 0x0000,
0x4e00, 0x6f00, 0x8a00, 0x8300, 0x0c00, 0x0000, 0x0900, 0x0000, 0x1200,
0x8b00, 0x4d00, 0x9800, 0x2000, 0x0000, 0x0a00, 0x0000, 0x4e00, 0x8800,
0x8a00, 0x9c00, 0x0c00, 0x0000, 0x0b00, 0x0000, 0x1200, 0xa300, 0x4d00,
0xb000, 0x2000, 0x0000, 0x0c00, 0x0000, 0x4e00, 0xa000, 0x8a00, 0xb400,
0x0c00, 0x0000, 0x0d00, 0x0000, 0x1200, 0xbc00, 0x4d00, 0xc900, 0x2000,
0x0000, 0x0e00, 0x0000, 0x4e00, 0xb900, 0x8a00, 0xcd00, 0x0c00, 0x0000,
0x0f00, 0x0000, 0x9000, 0x5a00, 0xe000, 0x6700, 0x2000, 0x0000, 0x1000,
0x0000, 0xe400, 0x5700, 0x2000, 0x6b01, 0x0c00, 0x0000, 0x1100, 0x0000,
0x9000, 0x7300, 0xe000, 0x8000, 0x2000, 0x0000, 0x1200, 0x0000, 0xe400,
0x6f00, 0x2000, 0x8301, 0x0c00, 0x0000, 0x1300, 0x0000, 0xf300, 0x2100,
0x2500, 0x2e01, 0x2800, 0x0000, 0x1400, 0x0000, 0x2800, 0x1e01, 0x5d00,
0x0a01, 0x0c01, 0x0000, 0x1500, 0x0000, 0x6500, 0xf100, 0xb000, 0x0800,
0x2001, 0x0000, 0x1600, 0x0000, 0xbf00, 0xf100, 0x0a00, 0x0801, 0x2001,
0x0000, 0x1700, 0x0000, 0x9000, 0xa300, 0xe000, 0xb200, 0x2000, 0x0000,
0x1800, 0x0000, 0xe400, 0xa200, 0x2000, 0xb601, 0x0c00, 0x0000, 0x1900,
0x0000, 0xe400, 0xb700, 0x2000, 0xc401, 0x2800, 0x0000, 0x3800, 0x0000,
0x0000, 0x2680, 0x0001, 0x0000, 0x0100, 0xe900, 0x0000, 0x0000, 0x0200,
0xb8c0, 0x0000, 0x0000, 0x0200, 0x4e80, 0x0000, 0x0000, 0x0400, 0x5140,
0x0000, 0x0000, 0x0500, 0x8dc0, 0x0000, 0x0000, 0x0500, 0xe2c0, 0x0000,
0x0000, "\000"
0
END
|
|
|
|
|
it looks very unicode like double byte charset would be my guess
-= Technomancer =-
|
|
|
|
|
I wish to play a WAV file on a buton press, that's OK, but what I would like to do now is play the WAV file over and over again while the button is being held down.
Currently the WAV file is only played when you release the button.
The PC is running Windows 2000, any suggestions.
grahamfff
|
|
|
|
|
Use the PlaySound() function specifying the SND_LOOP flag.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
That's only half the answer.
The original question also said that the sound was only played when the button was released. How do we detect that the button was pressed, as opposed to when the button is released?
|
|
|
|
|
I have a form with Chris Maunder's MFCGrid and some buttons. My problem is when the user is editing something on the grid he would be using an edit control that destroys itself in it's WM_KILLFOCUS handler
CInPlaceEdit::OnKillFocus(CWnd *pNewWnd)
{
...
SendMessage(WM_CLOSE, 0, 0);
} My problem is that when one of the buttons recieves the input focus it has to know the HWND of the control that lost the focus
COneClickButton::OnSetFocus(CWnd *pOldWnd)
{
CButton::OnSetFocus(pOldWnd);
HWND old = pOldWnd->GetSafeHwnd(); So far all my testing seems to indicate that the GetSafeHwnd() function is returning the correct HWND, but can I be sure that it always will or am I better off changing the SendMessage(WM_CLOSE) to a PostMessage(WM_CLOSE) in the CInPlaceEdit class?
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Using SendMessage() won't cause any problems because closing a window is treated as a focus-changing event, and therefore the window that is to receive the focus will receive a WM_SETFOCUS during the SendMessage() call before the window is destroyed.
At least, that's how I recall it happening...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Unfortunately that does not seem to be the case. I tried it by placing some TRACE statements in the code on either side of the SendMessage(WM_CLOSE) and in the OnSetFocus() handler. It seems that SendMessage(WM_CLOSE) returns before the WM_SETFOCUS message is handled by the button.
I guess for now I will leave the code as I have it, just leaving a note about my suspicions in case I get any complaints about stange behaviour later on
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Hmmmmm... ok. Does the WM_CLOSE handler for the window actually destroy the window, or does it post a WM_DESTROY message or something similar, ie. Has the window been destroyed in the WM_SETFOCUS handler (use IsWindow() to check the HWND).
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
GetSafeHwnd() returns the HWND I am looking for, but IsWindow() returns FALSE. So that tells me the window was destroyed.
What I am now thinking is that the CWnd passed to OnSetFocus is a CTempWnd class, so that would mean that it is just a copy of the CWnd of the CInPlaceEdit class that was destroyed. Being a copy it contains the same m_hWnd value as the original even though the original has already been destroyed and deleted.
It all makes sense to me now. Thanks for the push in the right direction so that I could figure out what was going on
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|