|
Hi
I wrote the code for minimising the application that are active while I launch my application.
But one error is coming "cannot convert from 'HWND' to 'CWnd *'"
CString szTitle;
CWnd *pTopWnd;
UINT cmd=GW_HWNDFIRST;
while (pTopWnd=GetWindow(NULL,cmd))
{
pTopWnd->GetWindowText(szTitle);
if(szTitle.Find("MyApp.EXE")>=0)
pTopWnd->ShowWindow(SW_HIDE);
cmd=GW_HWNDNEXT;
}
Plz tell the solution
|
|
|
|
|
Your GetWindow() is returning an HWND and you are trying to assign that directly to a CWnd*. Do the following instead:
HWND hWnd = GetWindow(NULL,cmd);
CWnd *pTopWnd = CWnd::FromHandle(hWnd);
"What's on your mind, if you will allow the overstatement?"
|
|
|
|
|
I modified the code as :
CString szTitle;
HWND hWnd = GetWindow(NULL,GW_HWNDFIRST);
CWnd *pTopWnd = CWnd::FromHandle(hWnd);
while (pTopWnd!=NULL)
{
pTopWnd->GetWindowText(szTitle);
if(szTitle.Find(_T("MyApp.EXE"))>=0)
pTopWnd->ShowWindow(SW_HIDE);
hWnd = GetWindow(NULL,GW_HWNDNEXT);
pTopWnd = CWnd::FromHandle(hWnd);
}
But pTopWnd is coming NULL.Why?
|
|
|
|
|
You are passing NULL as the first parameter to GetWindow, you have to provide a valid window handle to GetWindow then only it gets the next window or any window thats related to the window that you provide.
Use GetForegroundWindow function to get the handle to the current active window, then you can use GetWindow to get the next windows. Remember you always have to pass a valid HWND to GetWindow.
"What's on your mind, if you will allow the overstatement?"
|
|
|
|
|
pther wrote: But pTopWnd is coming NULL.Why?
Did you bother to check the return value of GetWindow() , or are you assuming it succeeded and calling FromHandle() anyway?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi!
what does the non-maskable interrupt do?
does it disable other interrupts? whitch interrupts?
Zo.Naderi-Iran
|
|
|
|
|
|
Wish I still gave a <blank> about that level.
Doe’s it still disable other interrupts – no!
Look this is Windows and like most other modern Operating Systems you will need to dig deeper.
Sorry – I am tiered and could be wrong – keep looking -
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
IIRC, and it has been a while since I was messing around with the pins on a CPU, the NMI is an interrupt that cannot be turned off (masked). What it does depends on the CPU that you are using.
For example, a NMI on a 6502 causes the process or to jump to whatever address is stored at FFFA /FFFB . On a Z-80, I believe it jumps to 0066 . On a Z-80, an NMI cannot be interrupted by another normal interrupt, but can be interrupted by another NMI, etc.
The end result is - the answer depends on the processor (or processor family) that you are using and what you are trying to accomplish.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
hi!
How do i enable a non-maskable interrupt?
is my program corrupt? if i ebable this interrupt in my program, and then disable it, soon.
Zo.Naderi-Iran
|
|
|
|
|
You can't disable the NMI (that's why it's called "non-maskable), so it's always enabled.
|
|
|
|
|
i m using following function in my project but gtng an exception error:
CString CMyProj::OnTextList()
{
int index;
CString _case;
index = m_caselist.GetCurSel();
m_caselist.GetText(index,_case);
return _case;
}
can any body tell me why i m getting error in this code?????????
NT
|
|
|
|
|
may check if the index is >= 0
If no item is selected the index has a value of -1.
Check LastError code using GetLastError()
Otherwise please post the error message / exception.
|
|
|
|
|
exception error i m geeting is "Debug Assertion Error".
NT
|
|
|
|
|
GetText is checking its input data.
What are you inputting to it?
Use the debugger to set a breakpoint and check the value.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
I dont want return value of GetText() function
i want return value of _case variable
NT
|
|
|
|
|
Sure. But you are calling GetText() with index and _case .
And GetText is checking its paramteres...
Did you ever check the value of index ?
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
But i think the function of GetText() is that watever text is at index(watevr value) will be stored in _case.
just tell the way i m returning the value of _case is correct or not????
NT
|
|
|
|
|
tyagineha wrote: But i think the function of GetText() is that watever text is at index(watevr value) will be stored in _case.
You could have read MSDN about GetText(). The index is zerobased.
Hence my repeated question (which you seem to refuse to answer): What are you calling GetText() with?
Are you calling it with invalid indices (like, perchance, -1)?
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
ok i m sorry 4 that....
i m inputting a ListBox value..........
NT
|
|
|
|
|
And your Listbox does have 5 entries?
Or does it have 4, and the last one is selected?
Then you have falling in the ole off-by-one trap.
Indices are counting from 0: the last element of the Listbox has the index (SizeOfListbox -1)
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
rite now listbox has only one entry.
this function i m defining in one class and calling in another class...
the problem which u r saying..
that problem i m nt gntng when i m in same class
but when calling this function fron another class then error is cuming.
tell me watshld i do now??
Nt
|
|
|
|
|
tyagineha wrote: tell me watshld i do now??
Write proper English. I am not a native speaker and may get your abbreviations wrong. Also, this stuff is complicated enough.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Tell me what should i do now????
NT
|
|
|
|
|
Set a breakpoint on return _case; and see if it looks OK in the debugger.
If it does, single step into your other class and look if it is still OK.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|