|
I am very much new to MFC..pls ..How to create in MFC Tray Icon..
Dasrimk
|
|
|
|
|
|
dasrimk wrote: I am very much new to MFC..pls ..How to create in MFC Tray Icon..
Here is the wrapper class for the system tray icon
http://www.codeproject.com/shell/CTrayIcon.asp
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
bool MyFunc
{
return (Func1() && Func2());
}
where return type of Func1 and Func2 is bool. What i want to know in which order do they called in the above statement. whether Func1() called first or the Func2()? As I want Func1() should be called first. Is it the way i should write?
Thank you.
KIRAN PINJARLA
|
|
|
|
|
Will get called according to precedence of && operator . i.e. Func1 will be called first.
|
|
|
|
|
Thank you Prasad.
KIRAN PINJARLA
|
|
|
|
|
kiran.pinjarla wrote: where return type of Func1 and Func2 is bool. What i want to know in which order do they called in the above statement. whether Func1() called first or the Func2()? As I want Func1() should be called first. Is it the way i should write?
Func1 called first ... if func1 function returns FALSE then Func2 will not be called.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
I would like to how to get the HWND of mfc DialogBox for .Net?
Please help!
|
|
|
|
|
Can you explain it in detail ?
|
|
|
|
|
I would like to use SetCooperativeLevel function in my mfc dialogbox program. It needs the HWND parameter. How can I get this HWND?
Please help!
|
|
|
|
|
Doesn't m_hWnd member of CDialog (CWnd to be precise) serve your purpose ?
|
|
|
|
|
Before I use it in Visual Studio 6.0 seems to be alright.
But in VS .Net, it seems to be not.
Please help!
|
|
|
|
|
Again, you are not giving complete information.
- Give code, which is failing for you.
- What error its giving ?
It doesn't help you, if not able to make us understand your problem.
|
|
|
|
|
Coding:
if( FAILED( hr = g_pJoystick->SetCooperativeLevel(m_hWnd, DISCL_NONEXCLUSIVE |DISCL_BACKGROUND ) ) )
return hr;
error C2065: 'm_hWnd' : undeclared identifier
Please help!
|
|
|
|
|
Can you show you dialog class declaration ?
Because, if its Cdialog derived class, then this error should not come.
|
|
|
|
|
It is CDialog derived class!
I use m_hwnd before in VS 6.0.
Please help!
|
|
|
|
|
Oh dear.
I'm really not able to understand, why you are getting this problem.
Now, pass first parameter this instead of m_hWnd. To avoid compile error.
|
|
|
|
|
I change the m_hWnd with this.
if( FAILED( hr = g_pJoystick->SetCooperativeLevel(this, DISCL_NONEXCLUSIVE |
DISCL_BACKGROUND ) ) )
return
error C2673: 'InitDirectInput' : global functions do not have 'this' pointers
I got this error!
Please help!
|
|
|
|
|
Dear,dear.
LaHaHa wrote: error C2673: 'InitDirectInput' : global functions do not have 'this' pointers
I was insisting on complete information from start of thread.
Again , this error indicates that, code you have pasted is of a global function. And obviously you could not use this pointer there.
I was assuming this code is used in one of your dialog function.
For using it through global function, you need to have instance of dialog class.
Which you can pass as first parameter of said function.
Otherwise, post code of function body of InitDirectInput .
|
|
|
|
|
In fact that the function code is only like this:
HRESULT InitDirectInput()
{
HRESULT hr;
if( FAILED( hr = DirectInput8Create( GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID**)&g_pDI, NULL ) ) )
return hr;
if( FAILED( hr = g_pDI->EnumDevices( DI8DEVCLASS_GAMECTRL,
EnumJoysticksCallback,
NULL, DIEDFL_ATTACHEDONLY ) ) )
return hr;
if( NULL == g_pJoystick )
{
MessageBox( NULL, TEXT("Joystick not found. The sample will now exit."), TEXT("DirectInput Sample"), MB_ICONERROR | MB_OK );
return 0;
return S_OK;
}
if( FAILED( hr = g_pJoystick->SetDataFormat( &c_dfDIJoystick2 ) ) )
return hr;
if( FAILED( hr = g_pJoystick->SetCooperativeLevel(this, DISCL_NONEXCLUSIVE |
DISCL_BACKGROUND ) ) )
return hr;
So how to solve this problem!
Please help!
|
|
|
|
|
Come on !
Where is dialog class instance ?
If dialog is already invoked then use AfxGetMainWnd , to get its handle.
LaHaHa wrote: if( FAILED( hr = g_pJoystick->SetCooperativeLevel(this, DISCL_NONEXCLUSIVE |
DISCL_BACKGROUND ) ) )
return hr;
g_pJoystick->SetCooperativeLevel(AfxGetMainWnd(), DISCL_NONEXCLUSIVE |
DISCL_BACKGROUND ) ) )
|
|
|
|
|
I got this one now!
error C2664: 'IDirectInputDevice8A::SetCooperativeLevel' : cannot convert parameter 1 from 'CWnd *' to 'HWND'
Please help!
|
|
|
|
|
You can get its handle by type-casting it.
like
SetCooperativeLevel((HWND)(AfxGetMainWnd()),..);
|
|
|
|
|
I will try this, I will tell you the result later!
Many thanks!
|
|
|
|
|
Try
SetCooperativeLevel((HWND)*AfxGetMainWnd(),..);
|
|
|
|