|
How about drawing a moving object using OpenGL?
|
|
|
|
|
How about embedding an mpeg player control in the dialog and showing two people doing "it".
Actually something more indicative of what the *user* will be doing, show an mpeg of a guy spanking his monkey...
|
|
|
|
|
"show an mpeg of a guy spanking his monkey..."
So you'd like to see a bloke 'tossing his caber' whilst the data is downloading. urrrrrhm.
|
|
|
|
|
I'm trying to integrate my C++ code to MFC, and am stuck
can you tell me what all I have to do "to transfer a stream of data into or out of a rich edit control"
I tried MFC help and am confused.
P.
|
|
|
|
|
> "to transfer a stream of data into or out of a rich edit control"
If you just need "plain text", you can use (CRichEditCtrl: GetWindowText(...) and (CRichEditCtrl: SetWindowText(...).
If you need to ge/putt RTF from the control, look into the CRichEditCtrl::StreamIn(...) and CRichEditCtrl::StreamOut(...) functions or the "EM_STREAMIN" and "EM_STREAMOUT" messages.
-=- James.
|
|
|
|
|
class A multiply inherits from class B and C.
Class B has function B::fn(int arg1).
Also, class C has function C::fn(int arg1, int arg2).
Which is correct way to use fn from A ?
|
|
|
|
|
easy - the function called is decided by the arguments provided. I assume class C's function has no default values ? If it did, you'd need to define where like this
C::fn(int arg1)
Christian
P.S. Chris, why am I not logged in ? ARGH !!!
|
|
|
|
|
Normally, a function hides a function with the same name in a base class. However, in this example where B and C are at the same level in the inheritance tree, any call to A::fn() is ambiguous, even though they have different parameter lists, because there are two fn's in the definition of A. Neither fn() hides the other.
You need to call them thus:
class B {public: void fn(int arg1) {} };
class C {public: void fn(int arg1, int arg2) {} };
class A : public B, public C {};
A objectA;
objectA.B::fn(1);
objectA.C::fn(2,3);
Wacky syntax there.
--Mike--
http://home.inreach.com/mdunn/
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|
|
which is better between the following two ?
(1) int i;
for(i=0; i<8; i++){ }
and
(2) for(int i=0; i<8; i++){ }
|
|
|
|
|
Well, to qoute an etseemed former colleauge, 'it depends'.
for(int i = 0; i < 19; i++) {
++i;
}
++i;
It's a question of scope basically, muddied by the fact that in the C++ standard the scope of i here should end with the '}' - but not all compilers support this yet. Stylistically, I like this form, and it follows the practise of declaring vars when you need them. Of course, form one allows you to reuse i in another loop on a conforming compiler.
|
|
|
|
|
what is diff between the following two c++ statements? Where to use which?
(1) for(int i=0; i<8; i++) and
(2) for(int i=0; i<8; ++i)
|
|
|
|
|
The second might be considered academically more efficient, since there's no need to create a copy of i.
In practise, however, compilers tend to be smart enough to generate the more efficient code in a context like this. I forget author of the CUJ article I read on this - one of the regular QA guys - Becker?.
Had me preferring the second version for a couple of days, but old habits die hard
|
|
|
|
|
We should blame the guy who gave the name C++ to this language but not ++C
Suha
|
|
|
|
|
In the case of the for loops, effectively nothing,
but in the case of :-
char array1[10], array2[10];
char c = 'a';
int i = 0;
int i2 = 0;
while(i < 10)
{
array1[i++] = c;
array2[++i2] = c;
c++;
}
The two arrays are not the same!
Indeed array2[0] is uninitialised, and array2[10] doesn't exist! (well you've overwritten the end of the array
So if you are going to use ++i careful how you use it in
your (especially compound) statements.
Stephen Kellett
|
|
|
|
|
Does anyone has come across procedures in recording and playing back voices on a microphone using MS VC++ 6.0 API ?
|
|
|
|
|
I just posted this with you in mind,
But I'm unsure if its what you are looking for
Any how
Good luck
Regardz
Colin Davies
Sex at Noon Taxes
|
|
|
|
|
Does anyone has come across procedures in recording and playing back voices on a microphone using MS VC++ 6.0 API ?
|
|
|
|
|
C:\msdn cd1\Samples\Msdn\Techart\asfasasfas\print.cpp(578) : error C2440: '=' : cannot convert from 'void *' to 'struct HINSTANCE__ *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
C:\msdn cd1\Samples\Msdn\Techart\asfasasfas\print.cpp(590) : error C2440: 'initializing' : cannot convert from 'void *' to 'struct tagDEVNAMES *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
Can anyone tell me what error is this and how to rectify it?
Thanks a lot
|
|
|
|
|
This is sometimes a symptom of porting C code to C++, since C's parameter type-checking is less strict than C++.
I think you'll get some more info on this if you search this forum for 'cast' or 'explicit'. Always a fun topic!
|
|
|
|
|
My code is below and the error occurs at "hOldBitmap = SelectObject(hMemDC, hBitmap);" show below. I tried adding static_cast< ...> in front of the input hMemDC & hBitmap but got syntax error. So what should be done to the code?
HBITMAP CopyScreenToBitmap(LPRECT lpRect)
{
HDC hScrDC, hMemDC; // screen DC and memory DC
HBITMAP hBitmap, hOldBitmap; //
....
hScrDC = CreateDC("DISPLAY", NULL, NULL, NULL);
hBitmap = CreateCompatibleBitmap(hScrDC, nWidth, nHeight);
hMemDC = CreateCompatibleDC( hScrDC);
.....
hOldBitmap = SelectObject(hMemDC, hBitmap);
}
|
|
|
|
|
try:
hOldBitmap = (HBITMAP)SelectObject(hMemDC, hBitmap);
This is actually a 'C style' cast. You'll see this kind of casting done a lot in typical Windows code.
Also, one often resorts to it in dealing with MFC functions that return a CWnd, when what we really want is a CWnd derivative:
CButton *pButton = (CButton*)GetDlgItem(IDC_MY_DIALOGS_BELLY_BTN);
HTH
|
|
|
|
|
I thank you for your earlier suggestion which helped solve most of my errors but it could not solve one error.
extern HANDLE ghDLLInst; // Handle to the DLL's instance. Set in DllMain.
.....
...
int APIENTRY InstallHook (HWND hWnd, BOOL bCode )
{
....
...if (bCode == bHookInstalled)
return 0;
if (bCode)
{
hHook = (HHOOK)SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)KeyboardHook, (HANDLE)ghDLLInst
, 0);
......
}
....
}
The error lies in the line"hHook = (HHOOK)SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)KeyboardHook, (HANDLE)ghDLLInst
, 0);" the complier says that cannot convert parameter "ghDLLInst" from 'void *' to 'struct HINSTANCE__ *' Conversion from 'void*' to pointer to non-'void' requires an explicit cast.
So how to solve this ? Anyway thanks alot for your earlier help.
|
|
|
|
|
Well...
hHook = (HHOOK)SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)KeyboardHook, (HINSTANCE)ghDLLInst, 0);
might work.
But gee - this is a lot of casting... I guess in windows API (which is written in C btw) you could get away with using a HANDLE for an HINSTANCE.
This is probably what you'll need to do, but try to minimize the casts where you can. It's generally not a good thing to use casts because you are disabling the compilers type checking mechanism.
|
|
|
|
|
Does anyone has know about saving an output say , DIB into a newly created file in VC++ 6.0 for win98 ? This newly created file is also done by the program. Thanks for helping.
|
|
|
|
|
Hi , i want to enquire if anyone knows how to import icon & bmp into .rc file but the problem is if the .rc file has got error it can only be opened as .txt file and so how am i going to carry out doing it ?
|
|
|
|