|
Hi there,
Can someone please help me. I am programming a dialog GUI for a touch screen interface to control a motor and I want it to run the motor when someone presses the button and holds it and then the motor is stopped when it button is released.
Can I use BN_PUSHED and BN_UNPUSHED? or is there another way.
Does anyone have any examples that I could reference?
Cheers
Jim
|
|
|
|
|
BN_PUSHED and BN_UNPUSHED are old 16bit windows notifications used for drawing owner drawn buttons. Do not use them.
You should be be handling the WM_LBUTTONDOWN and WM_LBUTTONUP messages (or what ever the touch screen equivalent is) that are sent to your button control.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
|
Thanks for the help.
That's all running now.
Jim
|
|
|
|
|
I have the merge modules that Microsoft put out for the VC++ 2003 Redistributables but since VS2003 SP1 came out, I have not seen any new merge modules for VC++ 2003.
Does anyone know if the files in the redistribution merge modules would even get affected by SP1?
I dug around a bit and the MFC dll's didn't seem to get updated but I've not really done an exhaustive search. Can we still use the original redistribution dll's for VC++ 2003?
***********************
Update: I started to build a custom msm and Visual Studio directed me to where the merge modules are located when I tried to compile it???
(assuming a default installation path)
C:\Program Files\Common Files\Merge Modules
Call me slow, but I was searching for them from the root of my Visual Studio Directory. Sure, NOW I find it in MSDN.
Someone just shoot me before I reproduce.
modified on Wednesday, November 19, 2008 2:10 PM
|
|
|
|
|
Oops, I take that back, the dll's did get updated after all. I'm just blind.
I'm guessing I just piece together my own merge modules with the updated dll's in my system directory. Any comments still welcome as I'm hoping these .msm files are neatly tucked away somewhere and I'm just not finding them.
thanks in advance.
modified on Wednesday, November 19, 2008 2:19 PM
|
|
|
|
|
Hello,
I wasn't sure if I should post this here or on the vista forum..
I have an MFC application that I would like to install on Vista in the normal C:\Program files\My App, it is also possible that my application updates certain files using a web update program that updates/writes to the executable directory as well. In vista, only Admins, syatems...can do that, How can i make all users be able to write to program files\My App ?
I know installer programs can write to C:\program files with no problem, I was curious to how does vista know it is an installer and it allows it to write but prevents non-installers from writing, the I reason was wondering may be it is like a registry key or varibale that i can read and I will be able to set it somehow to make my update program write to the program files too? I really don't want to change this to C:\users because its not a per user thing....
Does any one know or have an experience of how to go around or beat this vista permission issue?
Thanks
|
|
|
|
|
Add a security section to your application manifest file. This will effectively turn off UAC for the application (If UAC is on) and it will prevent virtualization for the Registry and File sections that the user does not have rights to.
That brings up topic number 2. The user will still need to have an Admin token to write to Program Files directory, HKLM, HKCR, etc as they always have on NT class machines. You can set up the security manifest to use "AsInvoker" but this will simply fail when they don't have an admin token. Use "requireAdministrator" for admin utility programs that require administrator access to the machine. This will prompt the user for admin credentials when they try to use the app if they don't already have an admin token. (and it'll put that cool little shield on your icon)
Windows Vista Application Development Requirements for User Account Control Compatibility[^]
|
|
|
|
|
Thanks,
Can I find the information you sent in the link, if not, do you have a sample manifest or a link that can help me write such a manifest?
Thanks again
|
|
|
|
|
If you have VC++ 2003 or above (I think 2002 as well but not sure) you will get a manifest file created for your app if you create an MFC doc/view and basically choose the defaults. If you are adapting this manifest to a VC++ 6.0 application, you will need to adjust the contents as needed since the internal name needs to match the app I believe.
It's pretty straightforward once you know that. This article helps when trying to use manifests in VC++ 6.0 for Vista compatibilility and/or XP/Vista Themes. The author has a sample manifest but you'll probably want to dig the security section out of the doc in the previous post or search for one here.
Help with manifests[^]
|
|
|
|
|
|
One more thing, Visual C++ 2008 has some built in wizard stuff to assist with the security section so this is getting easier as they move forward.
|
|
|
|
|
Thanks,
I am using VS 2005 which has the following format:
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*' />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC80.MFC' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
</assembly>
should my Manifest look like this to take care of my problem?
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*' />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC80.MFC' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
com:asm.v2">
<ms_asmv2:security>
<ms_asmv2:requestedPrivileges>
<ms_asmv2:requestedExecutionLevel level="requireAdminstrator">
</ms_asmv2:requestedExecutionLevel>
</ms_asmv2:requestedPrivileges>
</ms_asmv2:security>
</ms_asmv2:trustInfo>
///////////////////////////////////////
</assembly>
modified on Wednesday, November 19, 2008 2:00 PM
|
|
|
|
|
I'm thinking something like this (with "requireAdministrator" if desired)
<ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
<ms_asmv2:security>
<ms_asmv2:requestedPrivileges>
<ms_asmv2:requestedExecutionLevel level="asInvoker">
</ms_asmv2:requestedExecutionLevel>
</ms_asmv2:requestedPrivileges>
</ms_asmv2:security>
</ms_asmv2:trustInfo>
|
|
|
|
|
|
I just meant that for some security manifests, you'll want
<ms_asmv2:requestedExecutionLevel level="asInvoker">
and other apps you'll want "requireAdministrator" instead "asInvoker".
|
|
|
|
|
I'm creating some colored icons for a list view control, but the colors displayed on vista differ from the colors displayed on XP , or Vista 64 . Do you have any ideas? The colors are the same , but they repeat faster in the list
although the formula is the same: RGB( (p*12 + 128) % 256, (p*12+ 64) % 256 , (p*12) % 256 );
m_cImageList.Create(16, 16, ILC_COLOR32|ILC_MASK, 1, 1);
COLORREF cl = RGB( (p*12 + 128) % 256, (p*12+ 64) % 256 , (p*12) % 256 );
colors[p] = cl;
// AND mask - monochrome - determines which pixels get drawn
for( int j=0; j<32; j++ )
{
AND[j] =0;
}
// XOR mask - 32bpp ARGB - determines the pixel values
for( int k=0; k<256; k++ )
{
XOR[k] = cl;
}
icon = ::CreateIcon(NULL,16,16,1,32,AND,(BYTE*)XOR);
pDlg->m_cImageList.Add( icon );
DestroyIcon( icon );
pDlg->m_listFolders.SetImageList(&pDlg->m_cImageList, LVSIL_SMALL);
|
|
|
|
|
You say the colours differ, then you say they are the same. How are you determining that the colours differ?
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Is it possible to know if a control (label) is visible or not using WinApi?
We have to plug into our app with a custom application and need to know if a certain label is visible or not. I know you can show/not show it, but how to know what the state is?
thanks !
|
|
|
|
|
There is the obscurely named IsWindowVisible ...
It only tells you the visible flag state though - if a parent is hidden, this is too, etc.
Iain.
|
|
|
|
|
Looks like its working.
We were looking more at message types than real functions, that's why we didn't see it.
|
|
|
|
|
V. wrote: We were looking more at message types than real functions, that's why we didn't see it.
So you did not find the WS_VISIBLE style?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
yes we did, but MSDN was working against me
|
|
|
|
|
V. wrote: but MSDN was working against me
Yes, it seems that documentation has a negative effect on a large portion of the developer population these days. We see it here all the time.
led mike
|
|
|
|
|
so you mean we took the easy way out asking the forum, hoping that someone would know?
|
|
|
|