|
Hadi Dayvary wrote: So how to get process HANDLE from a HWND?
How about GetWindowThreadProcessId() ?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Use the following code
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)<br />
{<br />
EnumInfo info;<br />
DWORD pid;<br />
EnumWin * enumWin =<br />
reinterpret_cast(lParam);<br />
GetWindowThreadProcessId(hWnd, &pid);<br />
<br />
if (pid == enumWin->m_pid)<br />
{<br />
if(GetParent( hWnd ) == 0)<br />
{<br />
enumWin->m_found = TRUE;<br />
enumWin->m_hwnd = hWnd;<br />
AfxMessageBox("handle found!");<br />
return FALSE; <br />
}<br />
}<br />
return TRUE;
}
you can use WaitForInputIdle(...) for the process to finish initializing before you try to find its HWND. this will not work with apps that start with a process and switch to another while excuting (e.g. mozilla fire fox).
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
I have an issue that requires either the rotation of the application (MFC Doc/View architecture - yes i know but it's a legacy application) or the screen (ATI Radeon). I've tried using the ChangeDisplaySettings API call (it does this already to set the required resolution, and yes I know this is a bad thing generally but this project requires the switching of two legacy applications both of which are EPoS and the operator is trained and paid to put up with it) and setting the rotation flag to DM_180 but I always get a DISP_CHANGE_BADMODE.
So I have a display on a hinge, and one application (the doc/view one) ends up being upside down. The ATI card has a tray application which lets the display be flipped, but I can't how to do it using API calls, or even calling into an ATI dll. (The ATI card isn't guaranteed to be used throughout the life of the project, it could well be replaced by another make/model). Unless some clever person out there can tell me how to rotate the display programically, the only other way is to add some code so that the output of the doc/view application is inverted.
Does anyone have any ideas?
Andy
|
|
|
|
|
No idea if that works, but you can try SetWorldTransform in the OnPaint event of your view, maybe in the frames.
|
|
|
|
|
Thanks, I gave that a go just now on one of the dialogs and managed to rotate the background but none of the controls on the dialog. I suspect I would have to override the onpaint events for absolutely everything, which for a new application could be a fun flag for the registry but for a crusty old legacy app it's not happening.
Andy
|
|
|
|
|
Hi,
I want to change the icon of my application,so, i changed it in resource file and the exe created with new Icon itself.But my problem,after running the EXE, the system taskbar which shows the icon and application name...IN THAT THE ICON IS OLDER ONE.IT DOES NOT SHOW THE NEW ICON.
I dont know wat to do.The res file and ICON in the Workspace,all shows the new Icon only.Even my EXE in Debug file also shows new Icon.But in system taskbar shows the older one.
-- modified at 7:53 Wednesday 31st May, 2006
|
|
|
|
|
Do you use SetIcon
whitesky
|
|
|
|
|
Till now i wont use SetIcon but the taskbar shows right icon,then now why it does not shows the new one.where the application takes the old icon.because i checked in all files there is no older icon.then how its possible?Pls clear my doubts.
|
|
|
|
|
Please see Michael Dunn answer and my guess 16x16 icon
whitesky
|
|
|
|
|
change both be 32x32 and 16x16 icon.
in task bar 16x16 icon is displayed.
see your application exe in windows explorer both in Large icon setting and Small icon setting
Regards
Anil
|
|
|
|
|
|
have u changed both icons
i.e 16x16 and 32x32
it seems that u have changed only 32x32 icon
pls check it.
but u can see if u r viewing the file list as icons (not details view)
SaRath
"D on't blindly follow rules you read somewhere without verifying that it makes sense for your situation!"
|
|
|
|
|
Yes i changed 16x16 icon.now its working.Thanks a lot.
|
|
|
|
|
1.Copy the Icon,which u want to assign to res folder of u r application.Follow these steps
2.if u r using VC6 ,In the project click on File->Open,then change the Open As option to Text and open the .rc file of u r application.
if u r using Vc7 , right click on .rc file and open as Text file
3.Replace the
IDR_MAINFRAME ICON DISCARDABLE "res\\OldIcon.ico"
with
IDR_MAINFRAME ICON DISCARDABLE "res\\NewIcon.ico"
I have tested this.
Here it is working fine.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
Have you changed the function's parameter ,for example ,if you want show the new icon which ID is IDR_NEW on the dialog, you can modify the LoadIcon function .
CTestIconDlg::CTestIconDlg(CWnd* pParent /*=NULL*/)
: CDialog(CTestIconDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CTestIconDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
// modify this sentense m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_hIcon = AfxGetApp()->LoadIcon(IDR_NEW);
}
echozeng ----> nose nose i love you
|
|
|
|
|
Hi all
I have a VS2005 MSC project, consisting of many classes, but when I compile I get many warnings(in different .cpp files) of type :
warning C4996: wcscpy was declared depreciated c:\....cpp
How to disable this warning, for whole project ?
thank you.
-- modified at 7:52 Wednesday 31st May, 2006
|
|
|
|
|
|
In your stdafx.h file, add the following line:
#pragma warning( disable : 4996 )
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
|
By using its replacement...?
Peace!
-=- James 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! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
it is so easy question,i am very glad to answer it
add "#pragma warning(disabled:4996)" in the head of header file and then the warning informaion will disappear.
echozeng ----->rose rose i love you
|
|
|
|
|
i'm not going to blame you because (and only because) you're new to this forum. BTW, you should avoid posting an answer if it has already been answered (especially if you don't provide much useful infos)... the #pragma solution was even quoted more than twice already, so read the other answers before replying
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Can someone please tell me if it is possible to get the ip of a spoofed message. We are using a lan, but someone keeps on spoofing.
KOM UIT DAAAAA!!!
|
|
|
|
|
Grimes wrote: Can someone please tell me if it is possible to get the ip of a spoofed message.
What message? A broadcast message over your network, or an e-mail message?
Grimes wrote: We are using a lan, but someone keeps on spoofing.
Why would you think that a LAN would prohibit spoofing?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
they use the 'net send' of windows. Does these messages also contain the ip of the computer they were sent from?
|
|
|
|