|
Capture one of the following messages for the window...
WM_RBUTTONDBLCLK
WM_RBUTTONDOWN
WM_RBUTTONUP
Jeremy Falcon
Imputek
<nobr>"C# is the answer to a question nobody asked." - Chris Losinger
|
|
|
|
|
Static controls have to have the SS_NOTIFY style set if you want it to recieve mouse messages.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
i get the hwnd of a window of a process containing two buttons on it how will i get their hwnd and perform any action like thay clicked with out key bord and mouse event i mean programatically?
r00d0034@yahoo.com
|
|
|
|
|
look up FindWindowEx... getting the handle to the child window with a given window text
- Roman -
|
|
|
|
|
If you have the HWND of a window, you can get the child windows by (at least) a couple of methods...
GetDlgItem if you know the ID# of the child windows.
e.g.
HWND hWndChildOne = ::GetDlgItem (hWndParent, IDOK);
HWND hWndChildTwo = ::GetDlgItem (hWndParent, IDCANCEL);
////
CWnd *pChildOne = pParent->GetDlgItem (IDOK);
CWnd *pChildTwo = pParent->GetDlgItem (IDCANCEL);
or GetWindow if you know the order.
hWndChildOne = ::GetWindow (hWndParent, GW_CHILD); // Get first child
hWndChildTwo = ::GetWindow (hWndChildOne, GW_HWNDNEXT);// Get sibling
To "pretend" they were pressed, you can do something like the following:
PostMessage (hWndParent, WM_COMMAND, MAKEWPARAM(IDOK, BN_CLICKED), (LPARAM) hWndChildOne);
PostMessage (hWndParent, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID (hWndChildOne), BN_CLICKED), (LPARAM) hWndChildOne);
I hope that helped.
Iain.
|
|
|
|
|
Hi,
Has any one ever had any issues with controls being repainted (controls becoming invisible at times, but data is still there) when having list controls and an OCX on the same dialog? For instance, the program's list controls that had focus when minimized would disappear when the program was restored. When I fixed the probelm by invalidating the dialog on moving the controls, the OCX control on the dialog will disappear at times. Any suggestions?
Thank you so much,
G
|
|
|
|
|
There has got to be something goofy I'm doing!
I tried SQL Insert Into like so:
OR
OR
OR
//crash
Trouble with AddNew as well:
m_pRecordset->MoveLast();
m_pRecordset->AddNew();
m_pRecordset->Fields->GetItem("Shape")->PutValue((_bstr_t)("Test text"));
m_pRecordset->Update();
AfxMessageBox((_bstr_t) m_pRecordset->Fields->GetItem("Shape")->Value);
MsgBox says I have the text put in right> record count goes up. Not visible in the Access db, and doesnt persist when the app terminates...
Thanks,
ns
|
|
|
|
|
Ever heard of "indentation"?
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
My apologies. I havent developed this good trait yet - improving though. Its just that I cut and pasted so very many code attempts at figuring out AddNew(), but thats no excuse.
ns
|
|
|
|
|
Hello,
I've created a number of CEdit controls without using the Dialog or Class Wizard. How do I get notified of messages for events like EN_KILLFOCUS, and others, for these custom edit controls?
Thanks!
JennyP
|
|
|
|
|
Add ON_CONTROL entry to CYourDlg message map.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
Hi
When I'm drawing an image with the GDI+ function Graphics::DrawImage(Image* image, int x, int y), the drawn image appears to be about 150% of the actual size of the image. The documentation clearly states that this version of DrawImage should render an image at the specified location and with the original size, but it's not. Anyone knows why? I'm using VC++ 6.0 on WinXP.
Thanks,
bf
|
|
|
|
|
is that 150% in pixels or physical measurement (inches, cm) ?
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
That would be in pixels.
When using DrawImage(Image* image, int x, int y, int width, int height) and specifying the actual width and height of the image (in pixels), all renders ok, so I guess the correct unit is used.
/bf
|
|
|
|
|
Hey Gang,
I am on the verge of panic today because I need to quickly develop a solution for a distributed analysis program. Thanks for taking the time to respond if you get a chance.
I have an exe that uses an XML DOM to represent the status of a system. The DOM is wrapped in an ATL interface that provides some convenience routines for manipulating the data in the DOM. For discussion I am going to refer to the ATL interface as the CurrentStateInterface.
I would like to share access across computers to an instance of the CurrentStateInterface. Ideally remote systems would be able to connect to the server application through an ATL interface and request the CurrentStateInterface. Once the interface is marshalled to the remote system, the remote system could make calls to the CurrentStateInterface which would manipulate the data in the DOM on the server.
I have read a few articles from the MSDN. One article suggested several possible solutions: Singleton objects, File monikers, CoMarshlInterface/CoUnMarshalInteface, Custom class objects, Custom monikers. I know some of these would work better than others. From what I have read, the file monikers look like an appropriate solution but I would look to someone with more experience for guidance.
I am hoping that someone has done something similar and can share his/her knowledge and experience. Any good suggested reading would be appreciated also.
Thanks very much for your time!
Hawk
|
|
|
|
|
Hi,
I did post a similar help before ... but I did not mention that I failed to open it within my Visual C++ 6.0 programming!
1) I open a MS Access97 table with 1 row & 2 filed numbers
2) In Visual C++ using Classwizard to add new class using CDaoRecordset (for that .mdb)
3) Run program to open that mdb to use ---> OK!
4) Now use MS Access97 open with Exclusive & add security password ("password") on it --> Save
5) Then even I tried programming to use codes in article TN054 ... or open with:
CDaoDatabase CDao;
CDao.Open("c:\\password97.mdb",true,false,"pwd= password");
---> I failed to open it!!!
Can someone help me with some codes (at RunTime) to open that mdb file? I appreciate very much for any suggestion & advice!
Thanks,
Anh Truong
|
|
|
|
|
where's the user id? uid?
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Does anybody know how to use the shell style animations such as those used for copying files etc. Can we borrow these from the shell for use in our own apps and if so how?
Thanks - Joel
|
|
|
|
|
There's the option of using SHFileOperation to move files (this function can show the dialog box that the shell shows), or there's also the option of creating your own dialog box. I'm not sure how mad Microsoft would get if you used their AVIs from the shell, but it's definately possible. If you use MFC, to try it out, put an animate control on one of your dialog boxes, map a member variable to it (CAnimateCtrl), and put this code in OnInitDialog (make sure you add a handler for OnInitDialog first):
<br />
HINSTANCE a_hRestore = AfxGetInstanceHandle();<br />
HINSTANCE a_hInstance = LoadLibrary( _T("Shell32.dll") );<br />
AfxSetResourceHandle( a_hInstance );<br />
c_oAnimate.Open( 160 );<br />
AfxSetResourceHandle( a_hRestore );<br />
FreeLibrary( a_hInstance );<br />
Here's a list of what the available AVI resources in Shell32.dll are, and what they show:
150 = File search flashlight.
151 = Find files magnifying glass (Small).
152 = Find computer (Small).
160 = Moving files.
161 = Moving files (different).
162 = Moving files to recycle bin.
163 = Emptying recycle bin.
164 = Deleting files.
165 = Some funky conversion?
166 = Find on the internet ?
Chris Richardson
|
|
|
|
|
Excellent, my last final windows programming question answered!
Thanks - Joel
|
|
|
|
|
Sorry if this is a simple question, but I can I get the handle to a window given the IDD resource value.
Here is what I want to do
CMainFrame (dlg1, dlg2, dlg3 created)
CMainFrame::ShowDialog(int nID) // Will display the dialog for IDD value
dlg1
OnOK() calls ShowDialog(IDD_DLG2) like this
((CMainFrame*)m_parent)->ShowDialog(IDD_DLG2)
I want something like:
CMainFrame::ShowDialog(int nID)
{
CWnd *pWnd;
pWnd = (CWnd *) GetDlgItem(nID); // Or 'GetWindowHandle(nID)'
if (pWnd->IsWindowVisible() )
pWnd->SetFocus();
else
pWnd->ShowWindow(SW_SHOW);
}
Is there a member function that can return a window handle give an IDD resource value?
Thank you.
Johnny
|
|
|
|
|
john john mackey wrote:
Is there a member function that can return a window handle give an IDD resource value?
No, this is not possible. A dialog resource (which is represented by an resource ID) is just a template for a dialog layout. It does not represent an actual dialog instance, which is represented by a hWnd.
Think of a dialog template as of a class in OOP. You can create an arbitrary number of dialog instances of the same dialog template. Therefore an one-to-one mapping between IDD and a hWnd could not even exist.
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
|
|