|
You could take a look at SendInput or mouse_event in the MSDN (though SendInput won't work on 95).
Chris Richardson
You can stash and you can seize
In dreams begin, responsibilities U2 - Acrobat[^]
Stop being PC and accounting for everyone and his momma's timeframe. Just enjoy your - Rohit Sinha in the content-challenged thread
|
|
|
|
|
Scratch my last reply. Here's a function I wrote that will simulate a double click on a point in the tray. I'm sure it can be adapted to simulate a single click. Note that I only ran this on XP, the identifiers I pass to GetDlgItem might be different on other systems.
[edit]Oops, I forgot the pre tags[/edit]
void DoubleClickTheTray( int p_iX, int p_iY )
{
HWND a_hTray = FindWindow( _T("Shell_TrayWnd"), NULL );
if( a_hTray )
{
HWND a_hNotifyWnd = GetDlgItem( a_hTray, 0x12F );
if( a_hNotifyWnd )
{
HWND a_hPager = GetDlgItem( a_hNotifyWnd, 0x00 );
if( a_hPager )
{
HWND a_hNotificationArea = GetWindow( a_hPager, GW_CHILD );
if( a_hNotificationArea )
{
LONG a_lPoint = MAKELONG( p_iX, p_iY );
PostMessage( a_hNotificationArea, WM_LBUTTONDOWN, 0, a_lPoint );
PostMessage( a_hNotificationArea, WM_LBUTTONUP, 0, a_lPoint );
PostMessage( a_hNotificationArea, WM_LBUTTONDOWN, 0, a_lPoint );
PostMessage( a_hNotificationArea, WM_LBUTTONDBLCLK, 0, a_lPoint );
PostMessage( a_hNotificationArea, WM_LBUTTONUP, 0, a_lPoint );
}
}
}
}
}
Chris Richardson
You can stash and you can seize
In dreams begin, responsibilities U2 - Acrobat[^]
Stop being PC and accounting for everyone and his momma's timeframe. Just enjoy your - Rohit Sinha in the content-challenged thread
|
|
|
|
|
Is the above method any better/different than the following (apart from error checking, obviously):
starthandle = FindWindowEx(0, 0, "Shell_TrayWnd", NULL);
starthandle = FindWindowEx(starthandle, 0, "TrayNotifyWnd", NULL);
starthandle = FindWindowEx(starthandle, 0, "SysPager", NULL);
starthandle = FindWindowEx(starthandle, 0, "ToolbarWindow32", NULL);
Ok, i've found that clicking the tray's icon does nothing, what i want to do is click on the tooltip that the icon brings up. Is there any (easyish) way to do this?
Cheers,
Dave
|
|
|
|
|
That code looks like it would work the same.
CommoDave wrote:
Ok, i've found that clicking the tray's icon does nothing, what i want to do is click on the tooltip that the icon brings up. Is there any (easyish) way to do this?
I'm really not sure how you would go about doing that. A windows hook could probably be used to monitor when the tooltip is displayed, then the click could be simulated (now that we would have the tooltip window). Maybe there's an easier way to get the end result you are trying to get though. What are you trying to do with this? Are you trying to just hide the tooltip or are you trying to do something more complex?
Chris Richardson
You can stash and you can seize
In dreams begin, responsibilities U2 - Acrobat[^]
Stop being PC and accounting for everyone and his momma's timeframe. Just enjoy your - Rohit Sinha in the content-challenged thread
|
|
|
|
|
I'm trying to work around a conflict for an automated driver installation program. Windows installs the windows certified device driver for the hardware id of the device, but comes up with a window asking for driver files. It will not allow us to use the better device driver. The window must be cancelled, then the driver windows installed is updated to the newer driver.
I can cancel the window that comes up, but the window will not come up for about 30 secs if the tooltips are not clicked on....
Cheers,
Dave
Cheers,
Dave
|
|
|
|
|
I am trying to develope an application that runs on Windows 95, 98, ME, NT, 2000 and XP. I develope on a nice new/fast PC running Windows XP. After getting most problems worked out on the desktop I started testing on other version of Windows. Boy was I surprized how the same executable would run differently on different version of Windows.
Here are some examples: I have a dialog box that has a property sheet with 3 property pages. On the pages there are buttons that call up a CColorDialog. It works fine on XP, but hangs the machine on ME. For this case I re-designed the dialog to be stand alone property sheet with the same 3 property pages. This approach works on XP and ME, still need to try on others.
Another example is the CRectTracker. On XP the code uses a CRectTracker and the handles and cursor change when the tracker is displayed. On ME the cursor disapears when the CRectTracker::Track function is called.
I am quickly comming to the conclusion that to have an application that runs on 32 bit windows, it cannot be any more complicated that a list box and a few buttons. Does anybody from Microsoft read these pages?
So my question is how do you develope an app for all these version of windows? Do you develope on 95 (the worst one) and once you have it working there, there is a good chance it will work on the others? Do I need to build the exe on a PC running each of the different versions? Is building the exe on XP and delivering it to a customer running 95 an approach that will work?I don't even have access to some of these versions. Does anybody have any ideas?
Thanks for any ideas
Craig Smith
|
|
|
|
|
I will probably get flamed for posting my comments on this one but here is my two cents:
1) Windows 95? Are people using an OS that is 8 YEARS OLD?
2) Millenium users...I feel sorry for them, that is the worst Windows probably released.
Windows 98/2000/XP need to be targeted in my opinion although I am by no means an expert.
P.S. Windows XP cleans up a lot better than it's predecessors so that is something you want to watch out for when targeting older platforms.
|
|
|
|
|
It really depends on your target market. If you are writing apps that target your average home user, then chances are that a fair number of them are still using Win95/98.
In my market (healthcare), we still find a lot of standalone developers using our tools on Win98, but most of the runtime environments are WinNT 4.0 SP6a - they are reluctant to upgrade in a hurry even though W2K SP3 is probably far more stable.
Haven't run into anyone using our tools with ME though - probably just as well
Dave
|
|
|
|
|
Take a look at purify plus for windows (IBM) it's a program that helps you to track memory leaks and so on... it also have a function that check the compatibilities of other OSes in your code...
You can download a trial version...
|
|
|
|
|
Hi,
I have a Tree Ctrl in a view. How can I programatically set the background of the tree to be transparent?
Thanks
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
Hi, all experienced Win32 guys will get a laugh here, I'm sure, but I'm stumped.
In our forms code, a checkbox is created using CreateWindow. Unfortunately, suddenly all our checkbox text has a white background (it should be windows grey).
Any idea why this might have suddenly stopped working, or even better how to fix it?
Any help appreciated - but no I can't not use CreateWindow.
Cheers,
Phaedrus
|
|
|
|
|
You could create a class for your checkboxes and use DrawItem to declare a background that you wish to use.
void YourClass::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) {
LPCTSTR lpszText = (LPCTSTR) lpDrawItemStruct->itemData;
ASSERT(lpszText != NULL);
CDC pDc;
pDc.Attach(lpDrawItemStruct->hDC);
COLORREF crTextBk = RGB(0,0,0);
pDc.SetBkColor(crTextBk);
pDc.DrawText(
lpszText,
strlen(lpszText),
&lpDrawItemStruct->rcItem,
DT_CENTER|DT_SINGLELINE|DT_VCENTER);
pDc.Detach();
}
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
After creating the control, you need to set its font. You can get this font with GetStockObject(SYSTEM_FONT)
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Which comes first, the bug or the stress?" -- Chris Maunder
|
|
|
|
|
Does setting the font actually change the background colour then? I thought the bacground colour was a function of the Brushes?
Jamie
|
|
|
|
|
I need some MFC class for managing accelerators. I have found
CAcceleratorManager class but I have some problems with it.
Is there any other solution for user defined accelerators?
|
|
|
|
|
Hello,
I created a view filled with images. I registered the DI_GETDRAGIMAGE and able to receive the message in the window after I called InitializeFromWindow.
To handle the message, I do the following:
---
LPSHDRAGIMAGE psi = (LPSHDRAGIMAGE)lParam;
psi->hbmpDragImage = (HBITMAP)OleDuplicateData(m_hBmpImage, CF_BITMAP, NULL);
psi->sizeDragImage.cx = m_nBmpWidth;
psi->sizeDragImage.cy = m_nBmpHeight;
psi->crColorKey = RGB(0, 0, 0);
return 0;
---
I tried different combination and also tried InitializeFromBitmap but the drag image still not appear. Do you have any idea?
Thanks,
Ngai
|
|
|
|
|
How can I translate de following VB function ?
Function DateToNumber(dOrig as Date) as Long
Dim HDate as date
HDate = DateSerial(1900,1,1) + TimeSerial(0,0,0)
DateToNumber = Abs(DateDiff("d",HDate,dOrig))
End Function
Regards,
Marcelo Duarte
|
|
|
|
|
It's a pretty simple function. Try looking up date time functions in the MSDN, and you shouldn't have too much trouble with it. The only question is what 'DateToNumber' returns.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
I have a string "ABC" and I want discover in the COMBO
There are strings: "XYZ", "XYZABC123", "123"... in COMBO
Help me to detect "XYXABC123" in COMBO >> which content "ABC"
thank a lot
I use Visual C++ 6.0 with non-MFC
|
|
|
|
|
for ( int i = 0 ; i < m_cmb.GetCount() ; ++i )
{
CString sText;
m_cmb.GetText( i, sText );
int nIndex = sText.Find( _T("ABC") );
if ( nIndex >= 0 )
{
// Found it - do something
break;
}
}
Dave
|
|
|
|
|
Hello,
I have just been writing an application in VC++.Net Standard on Windows XP Professional, and have decided to use the latest version of HtmlHelp for the help facility. I have just installed HtmlHelp, and according to the instructions I have put htmlhelp.lib under
"C:\Program Files\Microsoft Visual Studio .NET\Vc7\lib" directory, and htmlhelp.h under the similarly named include directory.
I have written the following API code to invoke the Help system:
void CMainFrame::OnCallHlp()
{
::HtmlHelp((HWND)GetDesktopWindow(),
"C:\\C++Proj\\LPSEmail\\LPShlp\\html\\LPSEmail.chm::
/afxFoldersAdd.htm", HH_DISPLAY_TOPIC,NULL);
}
However, when I compile I get the following link error:
LPSEmail error LNK2019: unresolved external symbol _HtmlHelpA@16 referenced in function "public: void __thiscall CMainFrame::OnCallHlp(void)" (?OnCallHlp@CMainFrame@@QAEXXZ)
I would be very grateful if someone could tell me how to make the programme link correctly. I presume the problem is because it cannot find the external HtmlHelp API library??
All help appreciated,
Trimtrom
|
|
|
|
|
You may need to link with a dll. I don't know the HTMLHelp API, but unless it comes standard in .NET, it might be good to check that. Also, are you sure that it's not under some namespace. With a different API like that, it could be a namespace different than std::.
|
|
|
|
|
Brandon,
Thanks for the answer. In the SDK docs there is no mention of a DLL.
I am not very experienced and so would not know how to check for a namespace. How would you do that??
Would it help if I deleted the pch files under the Debug directory, if there is some inherited problem?
|
|
|
|
|
You need to include HtmlHelp.lib in your Link|Library modules project setting.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Neville,
I have been looking under Tools, Options, Project folder. (This is very different to VC++ 6 which I was used to.)
Is there any where else I should check?
Trimtrom
|
|
|
|
|