|
Before you try to do some nasty casting or conversion in your code, I suggest that you take a look at this article[^]. Things will get much clearer afterwards
|
|
|
|
|
"before posting, answer this question.
are you asking about converting strings?
see this article..."
|
|
|
|
|
I think we should add that in the posting guidelines, yes
I don't know how many times I already linked to that article but it is a lot.
|
|
|
|
|
I am using tubo c explorer
I want to get a file name from file list box
like FileListBox1->FileName which is an
AnsiString and use it in create process
which needs lptstr.I also have to provide
the console exe and parameters.
I m new to c++ I used javascript before
please help.
|
|
|
|
|
Hi,
I am trying to open this key : "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRxDAV\EncryptedDirectories"
I am getting error code '5' when I try to access this key which means 'Access Denied'. However I am able to access other subkey in same hierarchy eg. "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRxDAV\Security"
Can anybody tell how to avoid this '5' error or whats the cause of it ?
Also I am the admin on the machine on which I am scanning this regkey.
Thanks,
Supriya Tonape
|
|
|
|
|
You need to run your app with elevated privileges.
Right click your app and choose "Run as Administrator"
and it should work.
What does your RegOpenKeyEx() code look like? Are you
requesting more access rights than you need?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes I am an Admin on the machine I am running this query/app..
Here is a code :
//Attempt to open the key on the target.
int retval = RegOpenKeyEx(
hkRegHive, // Hive of the RegKey
pszRegFullKeyPath, // Full path of the key excluding Hive name
0, // Reserved
KEY_READ | (Node32Bit ? KEY_WOW64_64KEY : 0), // Access rights to the key
&hkScanKey); // Handle to opened key
if(retval != NSCOK)
return FALSE;
Ouput : retval = 5
regards,
Supriya Tonape.
|
|
|
|
|
Supriya Tonape wrote: Yes I am an Admin on the machine I am running this query/
That doesn't matter on Vista. You still need to run the process with
elevated privileges to perform certain operations, even if you're an administrator.
Try KEY_QUERY_VALUE instead of KEY_READ. If that doesn't work then your
app requires elevated privileges (you can set this up in the app manifest to
force a UAC prompt).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am running this application on XP right now but yes includes Vista too though. I will try what you told. will get back to you.
Regards,
Supriya Tonape
|
|
|
|
|
nope KEY_QUERY_VALUE doesnt work.. i am not clear abt 2nd option you told..
|
|
|
|
|
You should be able to read that key.
What's the value of Node32Bit at the time of the call?
What are the permissions set on that key? You can view them in regedit.
Are you looking in your own registry or a registry on a remote machine?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am taking break will reply you after some time. thx for the help!!! appreciate it. (for the time being resolved the prob though.)
|
|
|
|
|
No one cares. Read the site guidelines.
Blog link to be reinstated at a later date.
|
|
|
|
|
Hi,
can I derive a class from CButton and make it not take the focus? Would like to make it only accessible by mouse click, the button should not take the focus from the control which has it, no tab stop is needed. Thanks for help!
|
|
|
|
|
What if you create the button without the WS_TABSTOP style
(or using SetWindowLong() to remove the style)?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark, the button was created without: the resource file has NOT WS_TABSTOP .
|
|
|
|
|
So you're not able to tab to it, correct?
As far as getting focus on a click...
I'm not sure if it will work, but maybe derive a class from CButton,
add a WM_SETFOCUS handler, and in the handler method set focus back to the
window losing focus.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: So you're not able to tab to it, correct?
That's correct. I will try some different things, OnSetFocus handler etc... thanks for the tips!
|
|
|
|
|
Hello,
I am trying to use extended CListCtrl in my C++ MFC MDI application with LVS_REPORT style.
I could find a few very interesting CListCrl extensions here (CGridListCtrlEx is one of).
I need to use it resized to fit whole window. Unfortunetly authors usualy give egzamle how to use it in dialogs.
What is the best start:
Have View class based on CListView (class inheritade from CListView) and try to replace ocurents of CListCtrl with CListCtrlExtensions?
or
Have View class based on CView?
or
CFormView and try to dock CListCtrlExtension to fit whole window? like in http://www.codeproject.com/KB/list/ReportControl.aspx
Sorry for taking time, but I have spent searching, reading and trying and still nothing is clear to me with this ...
|
|
|
|
|
Being contrary, I'll suggest a 4th way...
CListView, CEdit view all inherit from CCtrlView. I suggest inheriting from that yourself, using your control.
So, you can pretty much copy and paste CListView, and do a search replace for your new shiny control instead. Inheriting directly from CListView is probably making too much bodging code.
Iain.
|
|
|
|
|
Thank you very much. I hope to be abele to follow that way
Thomas
|
|
|
|
|
hi,
I am working on an mfc application in which I am using a CTreeCtrl Control. My problem is that I want to have several root nodes instead on one single root node.
These root nodes are having their own child nodes.
The number of root nodes and child nodes are known during runtime.
Please help me.
Thanks In Advance.
Dhiraj Kumar Saini
modified on Saturday, October 25, 2008 7:44 AM
|
|
|
|
|
|
Hello,
I use several controls with the CMainFrame=>CView. These controls are for putting different values like 'amount', 'price', and 'text'. There is also possibility to print all CView content. And the problem is with setting 'what you see is what you get' for CRichEditCtrl.
My CRichEditCtrl is calculated to have 8 cm + some offset width, because text printed, and print previewed has also 8 cm width.
I would like the text in my CRichEditCtrl looked identical as on the printout.
So I use CRichEditCtrl::SetTargetDevice(...) in order to set:
1. Printer DC
2. line width calculated as 8 cm.
After I used SetTargetDevice the word wrapping is the same as on the printout, but there is still very big problem. I mean the text is very often partly shifted out of the CRichEditCtrl in the horizontal view. It looks like CRichEditCtrl didn't have enough space to contain all text width, but it is not true. It really has 8 cm + offset. The line set with SetTargetDivice has also 8 cm width. So I don't understand why the CRichEditControl does not contain whole text width. I checked the same text, with the same font setting, with the same margin in the MS Word, and in MS Word everything looks fine. Whole text is well fitted.
My question is: Did i miss some setting? What am i doing wrong here? Or maybe I should get "what you see is what you get" in some other way?
I'm including printscreen showing the problem:
http://rapidshare.com/files/157373743/Screen.png[^]
Regards.
|
|
|
|
|
Hi
I want to know how to analyze crash dump created by WinDbg.Please tell me the step by step methods by which one can know actually which function,Class, DLL, line no, is causing the crash.
Thanks...
|
|
|
|