|
Manjunath S wrote: But in Vista it fails to create registry ...
Vista has lots of restrictions, dealing with registry. You may like to read UAC for that. Search for UAC on MSDN .
Prasad
MS MVP - VC++
|
|
|
|
|
Thanks for your reply
Any sample code available to just create a registry in windows Vista ...
Manjunath S
GESL
Bangalore
|
|
|
|
|
I faced the same problem with my application.
I used a manifest.xml in my application as a resource and it solved the problem.
Here are the contents of that manifest.xml file.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="CompanyName.ProductName.YourApp"
type="win32"
/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="highestAvailable"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Call InitCommonControls() in the InitInstance() of ur application
BOOL CURApp::InitInstance()
{
InitCommonControls();
--------------------------
----------------------
}
U can follow these steps to include manifest.xml in ur project.
Once writing manifest.xml is completed, you will want to add the manifest.xml file to your project in the resource editor. In Visual Studio 6, hit Ctrl+R to add a new resource, select all files and double click manifest.xml to add the file. When you see the custom resource dialog, enter the number "24" as the resource type and hit OK. Once imported, right click on the resource to open the properties window and change the ID to the number "1".
Sameer Thakur
|
|
|
|
|
Thanks Sammer for ur valuable reply...
Iam using Visual studio installer to install an application.In the installer i have a custom action DLL.In this DLL before installing the application i have to check the registry whetheir any entry with name same as my application name is present,if present take the path entered there, if not create a registry entry named with my applciation name....
Any tips to do above in vista ....
Manjunath S
GESL
Bangalore
|
|
|
|
|
Logically.....
You can add that xml file as a resource in a DLL that u are using as a custom action DLL.(No need to call InitCommonControls() in that case.)
By doing that ur DLL will get elevated privileges to read/write registry entries on Vista.
Sameer Thakur
|
|
|
|
|
Hi sameer
Can u tell me what actually done in this XMl...
How it helps to edit registry
And how Custom Dll Handles it...
Manjunath S
GESL
Bangalore
|
|
|
|
|
In Vista there is a concept of User Account Control (UAC) by which it prevents any major changes in registry (though you are logged in as an Admin).
To enable registry changes, we need to provide higher privileges to the application.
To do this there is a tag in manifest.xml …
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="highestAvailable"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
Here we are granting the “highestAvailable” privilege to the application/DLL which ultimately grants the permission to ur application/DLL to access (Read/Write) registry.
Sameer Thakur
|
|
|
|
|
Thanks sameer
I will try this and udapte ...
Manjunath S
GESL
Bangalore
|
|
|
|
|
What happens on Vista? Post your code.
|
|
|
|
|
Hi guys,
I tried with embedding the manifest.xml in my Dll as posted in the previous reply to write registry entry in windows vista. But this fails to create any effect (my Dll could not create the registry entry)
Manjunath S
GESL
Bangalore
|
|
|
|
|
The XML that specifies what execution level you want only makes sense for EXEs, not DLLs, since the execution level applies to a process as a whole.
|
|
|
|
|
Hi Mike,
How can i achieve ( writing to registry ) In vista using DLL...
Manjunath S
GESL
Bangalore
|
|
|
|
|
Please refer this[^].
Regards,
Paresh.
|
|
|
|
|
HI paresh,
Any sample code to writing a registry entry In vista using DLL...
Manjunath S
GESL
Bangalore
|
|
|
|
|
Hi,
In my poject want to disable and enable ToolBar Button(save,open,new..)
at runtime using view class.
I had used following code but this code not work properly(abnormal termination error are occure)
CToolBar m_wndToolBar;
m_wndToolBar.GetToolBarCtrl().SetState(ID_FILE_NEW,TBSTATE_ENABLED);
m_wndToolBar.GetToolBarCtrl().EnableButton(ID_FILE_NEW,FALSE);
Please help me....
|
|
|
|
|
mohindar_kks wrote: m_wndToolBar.GetToolBarCtrl().SetState(ID_FILE_NEW,TBSTATE_ENABLED);
Are you sure, GetToolBarCtrl is returning some valid pointer. Probably, it is returing NULL value.
mohindar_kks wrote: (abnormal termination error are occure)
This statement leads to above guess.
Prasad
MS MVP - VC++
|
|
|
|
|
Hi,
Am also try to run the following code, here also abnormal termination error are occured
CToolBar c_oToolBar;
CToolBarCtrl & a_roCtrl = c_oToolBar.GetToolBarCtrl();
a_roCtrl.EnableButton(ID_FILE_OPEN,FALSE);
|
|
|
|
|
I am not sure about the approach that u have specified here.
But the following approach will server the purpose of enabling / disabling the tool bar controls.
You need to add a function in your view class.
For example…
Add ON_UPDATE_COMMAND_UI(ID_FILE_NEW, OnUpdateFileNew ) at location shown.
CMyView.cpp
file
=======================================================
BEGIN_MESSAGE_MAP(CMyView, CScrollView)
//{{AFX_MSG_MAP(CMyView)
other message handler functions...
ON_UPDATE_COMMAND_UI(ID_FILE_NEW, OnUpdateFileNew )
other message handler functions...
END_MESSAGE_MAP()
Void
CMyView:: OnUpdateFileNew(CCmdUI* pCmdUI)
{
if( some_Condition)
pCmdUI->Enable(true);
else
pCmdUI->Enable(false);
}
CMyView.h file
Public:
void OnUpdateFileNew (CCmdUI* pCmdUI);
Framework will keep calling OnUpdateFileNew function frequently and will keep the tool bar option enabled or disabled in a way u want.
Sameer Thakur
|
|
|
|
|
I had solve the problem from your valuable reply
|
|
|
|
|
Excellent.
Sameer Thakur
|
|
|
|
|
You're getting a failed assert because m_wndToolBar is just a C++ object, it's not a window so you can't use the methods that operate on the underlying toolbar window.
|
|
|
|
|
Is Microsoft still investing on the development of MFC or is giving it up and rather concentrating on the .Net ?
Will applications written on MFC have their future ?
|
|
|
|
|
What do you mean by "future"? I find it to be an extremely vague term here. I will not explain you it in great detail, but "MFC is something that should not be compared with .NET", for the obvious reason why and where these technologies are employed. If MFC had to die, it must have been buried by now. There are more exciting things, but MFC won't die. It may rather take a different form. May be. Read more on managed and unmanaged code.
Shog on learning VB6: Ah, that would have been VB6. Kicked my ass anyway. So easy to learn, just like falling down a flight of stairs...
|
|
|
|
|
You say "should not be compared with .Net" because one is compiled, and the other is interpreted, so MFC will not die because it serves the domain of the application that needs fast execution and total control on the memory, pointers,etc.
I am still having that idea, but I am seeing many things, look at DirectShow, we now have DirectShow .Net, thus performance and fast execution of code (a critical thing for video codecs,etc and most importantly the direct access to memory : the pointer is real and is not wrapped (image=pixels, and imagine what happens if in the middle of a DCT or FFT, the garbage collector decides to trim the image pixel matrix to ensure memory defragmentation!!!!!??????) in spite of that all i'm seeing those other things brahmma.
I agree future is vague, but of course I do'nt mean the simple execution of programs written in MFC: those written in MFC 1.0 of 1990 still execute in Windows Vista, let it general, look at companies developing user interface control, those offering mfc (bcgsoft,jockebox,prof-uis, etc) are bypassed by the tremendous companies fs offering kits for .Net.
The future of MFC wo'nt be affected by the companies that serves that ?
|
|
|
|
|
charfeddine_ahmed wrote: You say "should not be compared with .Net" because one is compiled, and the other is interpreted,
Why are you assuming things? I said it could not be compared, mainly because of where and how these technologies are employed.
I would again tell you, MFC is not going to die. Not anywhere in the near future, at least. It might take a different form, *may be*.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|