|
Hi all,
dows anybody knoks how can I show as first window the main window of another process??? I'm able to get the MainWindowHandle with the following code:
Process* MyProcess[] = Process::GetProcessesByName("EXCEL");
MyWnd = MyProcess[0]->MainWindowHandle;
but I didn't find any way to use the handle
please help me.
Thanks in advance.
Maurizio
|
|
|
|
|
Have you tried SetForegroundWindow()
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Antony,
thank you for your answer.
The problem is that SetForegroundWindow() , ShowWindowAsync() and other window managing funcion I found need an HWND window handler.
Unfortunately MyProcess[0]->MainWindowHandle is a IntPtr (an __int32 at the end).
I wasn't able in any way to get an HWND handler to the window from the IntPtr returned. The compiler always stops me
Bye,
Maurizio
|
|
|
|
|
Where did you get the class Process from? What is the code in the GetProcessByName function?
It may be that you can just cast the returned __int32 to a HWND.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
AfxMessageBox(CString("hai")); //works fine
AfxMessageBox(CString("hai").Format("hello")); //gives error, any way to make this work without having a CString variable?.
|
|
|
|
|
|
|
I'm not quite clear on what you want to achieve.
In any case, you cannot use the CString constructor like that in the second case.
I Dream of Absolute Zero
|
|
|
|
|
RChin wrote:
In any case, you cannot use the CString constructor like that in the second case.
I feel its a valid call. But gives an error coz CString::Format() returns void.
suhredayan There is no spoon.
|
|
|
|
|
suhredayan® wrote:
I feel its a valid call. But gives an error coz CString::Format() returns void.
You're absolutely correct. My bad .
The following does indeed compile, though how it could be used in a useful way is still a puzzle. (since it cannot be assigned to anything)
void MyFunction()
{
CString("Hey").Format("There!");
}
I Dream of Absolute Zero
|
|
|
|
|
That compiles *and* runs successfully.
The problem is that CString::Format 's return type is void . So that's the return type of this statement, and there doesn't seem to be any way to convert that to the LPCTSTR that AfxMessageBox expects.
It's going to take some serious obfuscation to make this work. My question is...what's wrong with a local CString variable? Like it or not, the statement itself is creating a local CString that goes out of scope after the statement executes.
Bob Ciora
|
|
|
|
|
Bob Ciora wrote:
It's going to take some serious obfuscation to make this work. My question is...what's wrong with a local CString variable? Like it or not, the statement itself is creating a local CString that goes out of scope after the statement executes.
Its all about trying to show the geekness, wot you feel cing the following.
int fun(tchar* buff,tchar* szFnd,int n)
{
....
....
return CString(buff).Right(n).Find(szFnd);
}
suhredayan There is no spoon.
|
|
|
|
|
Although this is a valid call, isn't it a bit like asking for "unpredictable results" to come your way ?
CString strText( _T("Hey") );
strText += _T(" there !"); Much easier, much simpler, and compiles correctly
-Antti Keskinen
----------------------------------------------
"If we wrote a report stating we saw a jet fighter with a howitzer, who's going to believe us ?"
-- R.A.F. pilot quote on seeing a Me 262 armed with a 50mm Mauser cannon.
|
|
|
|
|
Dear all,
I am doing a project named Distributed Compiler. For that i need the file format that NMAKE utitlity is producing.
Do anyone know links or articles describing the NMAKE file format ? if any, please let me know.
Regards,
Jijo.
________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
float f(12.34);
CString s;
s.Format("%.5f",f);
>>12.34000
but how to format string to be 00012.34000
|
|
|
|
|
float f(12.34);
CString s;
s.Format("%011.5f",f);
>> 00012.34000
Steve
|
|
|
|
|
plz tell me. how i can use ADO with SQL database in MFC Dialge.
thanx
Syed Abdul Qavi
|
|
|
|
|
Check the classes CDatabase and CDaoDatabase.
May be i am wrong but i hope these will give you clue
Regards.
|
|
|
|
|
CDatabase uses ODBC, and CDaoDatabase uses DAO. To use ADO requires importing from the type library (e.g., msado##.dll).
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
|
Hi,
I have a problem in Installshield ,
I am adding shortcuts in Rsources->shellObjects->Desktop->Start Menu->Programs-> Application Folder ->( Shortcut)
But these shortcuts are not appearing after installing the Application .
Can you tell me solution
thanx
Regards.
|
|
|
|
|
I think it will solve ur problem.
Rsources->ShellObjects->Explorer Shell->Desktop->Start Menu->Programs-> Ur Application ->Shortcut
|
|
|
|
|
Can anyone please explain me what is a call back function?
Is that function an API or is it something else?
Thanks
Prem
|
|
|
|
|