|
Dear all,
I need to set quota limit for users on a shared folder on a file server.
How to implemented it in VC++? Is there a API function?
Thanks
|
|
|
|
|
Hi everyone,
I did not know where else to pose this question. So, here goes. If this is not the right place, please ignore it. Though, I would really appreciate some suggestions as to where to look.
I want to add an entry to the context menu of Windows explorer. Specifically, everytime someone right clicks on an XML file, I want to show a menu item which runs a python program. So I created the following registry entry file.
REGEDIT4
[HKEY_CLASSES_ROOT\.xml]
@="XMLfile"
[HKEY_CLASSES_ROOT\xmlfile]
@=""
[HKEY_CLASSES_ROOT\xmlfile\shell\Open with Something\command]
@="C:\\Python22\\wxPython\\tools\\boa\\boa.pyc"
This works fine, for any .EXE file. However, whenever I try to launch a python file, it does not work. It says [The XML file name] is not a valid Win32 document.
However, double clicking on boa.pyc runs it just fine. So, I do not know why it does not launch it.
Any suggestions or some registry scripts are welcome!
Pankaj
Without struggle, there is no progress
|
|
|
|
|
a .pyc file still runs through the python exe. try changing:-
[HKEY_CLASSES_ROOT\xmlfile\shell\Open with Something\command]
@="C:\PATH\TO\PYTHON\PYTHON.EXE C:\\Python22\\wxPython\\tools\\boa\\boa.pyc"
STL is a religeon. Enquiries to Reverend Christian Graus
|
|
|
|
|
how can i put with Create function a working button on a Child Window of my mdi app derived from CFormView ?
<< Thank you people >>
|
|
|
|
|
Add a meber varibale of the control type to your form view class. Then call Create on it in the OnInitialUpdate() procedure. You will also need to position the control correctly on your formview using MoveWindow() etc. If you re-size your form in OnSize() check to make sure the actual windows exist before trying to move them around.
CButton m_MyButton ;
m_MyButton.Create("STOP!", WS_CHILD | WS_VISIBLE | BS_OWNERDRAW | WS_TABSTOP | WS_CLIPSIBLINGS, CRect(0, 0, 10, 10), this, IDC_OF_YOUR_BUTTON) ;
m_MyButton.MoveWindow(...) ; // put button in correct place
Don;t forget to call m_MyButton.DestroyWindow() in the OnDestroy of your FormView.
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
how can i put with Create function a working button on a Child Window of my mdi app derived from CFormView ?
<< Thank you people >>
|
|
|
|
|
if you're using MFC it shouldn't be too difficult to call Create on a CButton object that you can allocate dynamically - haven't tried myself I have to say
|
|
|
|
|
I'm producing a Web Viewer so that our customers can view the Images that we scan for them from anywhere. They enter the site and perform a search for the images and then view them. Their search details are saved in the Web Server's Registry and the fields(text boxes) are populated with their last query the next time they enter the site. The site is writen using ASP, Javascript and an ISAPI extension dll, using MFC, that does all the database stuff and file handling etc.
However, although I can read their last query from the registry, I cannot set values. I am using CRegKey::Open, with the access set to KEY_SET_VALUE ( I have tried KEY_WRITE and KEY_ALL_ACCESS ).
The RegConnectRegistry( ) function before it is succeeding OK.
I have tried using GetLastError() and then FormatMessage to get the Error Message but it returns "The operation was successful"!
Oh, the OS is W2k.
Any help would be greatly appreciated.
code as below:
// open the Registry Key and update it...
// connect to the Registry...
if ( RegConnectRegistry( NULL, HKEY_LOCAL_MACHINE , &m_RegKey.m_hKey ) != ERROR_SUCCESS )
{
#ifdef _DEBUG
MessageBox( NULL,"Unable to connect to Registry", "ERROR !", MB_DEFAULT_DESKTOP_ONLY );
#endif
return;
}
// and open (or create and open) the key...
if( m_RegKey.Create( m_RegKey.m_hKey, m_strSubKey, REG_NONE, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, NULL ) != ERROR_SUCCESS )
{
// if it fails, find out why...
int nGetLastError = GetLastError( );
#ifdef _DEBUG
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, NULL, nGetLastError, 0, (LPSTR)szBuffer, 255, NULL );
MessageBox( NULL, szBuffer, "ERROR - SetLastQueryData()", MB_DEFAULT_DESKTOP_ONLY );
#endif
return;
}
Thanx for your patience and any help,
code dope.
|
|
|
|
|
I think it's because your web-application is running under the same security context as your users. If those users are anonymous the process dont have rights to write to that part of the registry.
Why don't you just save the data in a database?
It sounds a lot of data to save in the registry...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
This is a typical case for using cookies.
|
|
|
|
|
Thanks Alex - I'll look into it, although I'm afraid my knowledge on Cookies is absolutely Zero (I'm just an ordinary ol' C, C++ programmer who's venturing into the Big and scary new world of Web Development!). Is it fairly easy?
Thanx again,
code dope.
|
|
|
|
|
My knowledge in cookies is exactly as yours. However, I know that they are done exactly for such purpose - to keep client settings on client computer. I would ask the separate question about cookies in message board.
|
|
|
|
|
Thanks, Anders, I think you're probably correct. However, unfortunately I am not permitted to create any new tables, views etc in the database.
The actual data is only about 10 words, so not really that much. Is there a way of changing the rights for an anonymous user without jeopardising the site, code, database etc.?
Thanx again,
code dope.
|
|
|
|
|
You _clould_ change the security settings in the registry, but that would open up a huge security hole
How about saving the data in a (XML)file instead?
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
You definately want to use a Cookie, very simple in ASP. effin Simple.
I dont think a web application should ever store data in a registry entry.
Ryan Baillargeon
Software Specialist
Fuel Cell Technologies Inc.
|
|
|
|
|
In MainFrm.h
Add the following member:
CReBar m_wndReBar;
CButton m_wndButton;
In MainFrm.cpp
int CMainFrame::OnCreate(..) {
...
// I Add
m_wndButton.Create(_T("OK"), WS_CHILD | WS_VISIBLE, CRect(0, 0, 80, 20), this, AFX_IDW_TOOLBAR + 3);
m_wndReBar.AddBar(&m_wndToolBar);
...
}
But when the application displays, The button I create on the m_wndReBar is disabled, Why ??
It's me, code_cold
|
|
|
|
|
You need to provide ON_COMMAND or ON_UPDATE_CMD_UI handler for your button.
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Hello,
I apologise, if this question has been asked before. I couldn't check it because the search doesn't work.
There's a memory leak in my program. The part of the memory that leaks is allocated (at least) during call ProcessShellCommand(cmdInfo) and it is allocated by function CString::AllocBuffer(by line new BYTE[sizeof(CStringData) + (nLen+1)*sizeof(TCHAR)]; ). Is there anything I can do about this memory leak? I mean because I don't directly call AllocBuffer myself, can I do anything about it?
BTW the start point of my program is main and I call InitInstance() and Run() from there, if it has something to do with this.
-Janetta
|
|
|
|
|
Why did you use your own 'main'?
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Tomasz Sowinski wrote:
Why did you use your own 'main'?
It has to work as a console application in windows and unix besides gui.
-Janetta
|
|
|
|
|
But you've copied the AfxWinMain into your main, including the calls to AfxWinTerm?
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Tomasz Sowinski wrote:
But you've copied the AfxWinMain into your main, including the calls to AfxWinTerm?
No. I call AfxWinInit, InitApplication, InitInstance and Run myself. In AfxWinMain InitInstance and Run are called to a CWinThread, but I call those of the application. Could this be the problem? I tried adding AfxWinTerm after Run, but it didn't help.
-Janetta
|
|
|
|
|
Janetta wrote:
call those of the application. Could this be the problem?
I don't think so, but you may try to copy AfxWinMain into your main.
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Tried already, didn't help. Thank you anyway!
Anyone got any other ideas? Can I rely on CStrings being safe and not leaking memory themselves?
-Janetta
|
|
|
|
|
The CString data should delete itself when the ref count goes to zero. Which CString instance leaks? Do you do any CString::LockBuffer/CString::GetBuffer calls without matching CString::UnlockBuffer/CString::ReleaseBuffer?
Another possibility is that it doesn't really leak, I've seen people here at CP complaining that their leak detector was wrong (was it BoundChecker? Purify? I can't remember, doesn't use one myself), especially when dealing with global objects (such as the global CWinApp instance).
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|