|
LKogut wrote:
Is there any way to filter the notifications so that I only get notified when I create or rename files? If not, is there any way to know which user caused the notification?
When a file is created, you can use GetNamedSecurityInfo() and LookupAccountSid() to see if the current owner of the file is you. Also, if renaming a file causes the owner to change, this will work too.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Thanks David, this will help me for sure!
But, unfortunately, not 100%. Looking for the functions on the help, they only work on an NTFS file system. Any clue for non NTFS file system?
|
|
|
|
|
How do I resize my PropertySheet and all pages based on size of the Main Dialog ?
I derived a class from PropertySheet and tried to implement an OnInitDialog .
Here's what i tried but didnt come out good
BOOL CMainSheet::OnInitDialog() {<br />
CPropertySheet::OnInitDialog();<br />
CWnd *parentWnd = this->GetOwner();<br />
ASSERT(parentWnd);<br />
parentWnd->GetClientRect(&parentRect);<br />
CTabCtrl *pTab = GetTabControl();<br />
ASSERT(pTab);<br />
this->SetWindowPos(0,parentRect.left,parentRect.top,200,200,0);<br />
pTab->SetWindowPos(0,parentRect.left,parentRect.top,200,30,0);<br />
<br />
<br />
CPropertyPage *page = GetActivePage();<br />
ASSERT(page);<br />
this->GetClientRect(&r);<br />
page->SetWindowPos(0,r.left,r.top,180,180,0)<br />
return TRUE ;<br />
}
Please advise
|
|
|
|
|
Is there any way to create a CArray object on the heap rather than on the stack?
Thanks
|
|
|
|
|
Yes, but why would you want to? As you add items to the array, memory is allocated from the heap to hold the individual items. The array object itself consumes very little memory.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
My guess is he wants it to exist outside the scope of the creating block.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Simple:
CArray<int> *theArray = new CArray<int>;
theArray->Add(1);
theArray->Add(42);
theArray->SetAt(0, 1337);
Or am I missing something?
Remember, even if you win the rat race, you're still a rat.
|
|
|
|
|
Hi guys
I've got this
CString file;
HANDLE hFile = CreateFile( ?????,........
What I have to put in ????? to get a valid value in hfile,all my tries have finished with a -1.
LPCSTR(file) doesn't work and I don't know what to do.
Thanks
Doc
|
|
|
|
|
|
Already read,but sorry, I can't see the solution.
My question is, how can I convert a CString to the right parameter to the CreateFile method?
Thanks
Doc
|
|
|
|
|
CString strFile = _T("C:\\myfile.txt");
HANDLE hFile = CreateFile (strFile, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Sorry, it has been my fault.
My problem comes maybe from the point that I can't assign my file directly putting double \\.
// My Code
TCHAR m_szDrive[10];
TCHAR m_szDir[MAX_PATH];
TCHAR m_szFullPath[MAX_PATH];
CString sFile;
// Application Path
::GetModuleFileName(NULL,m_szFullPath,MAX_PATH);
_splitpath(m_szFullPath,m_szDrive,m_szDir,NULL,NULL);
sFile=m_szDrive;
sFile+=m_szDir;
sFile+=_T("myfile.txt");
CreateFile(sFile,.... THAT DOESN'T WORK
Do you know how can I convert my string to the right parameter?
Thanks for your patience.
Doc
|
|
|
|
|
TCHAR* pSlash = NULL;
TCHAR szFilespec [_MAX_PATH];
::GetModuleFileName (AfxGetInstanceHandle(), szFilespec, _MAX_PATH);
pSlash = _tcsrchr (szFilespec, _T('\\'));
ASSERT (pSlash != NULL);
pSlash++;
*pSlash = _T('\0');
CString strFilename = szFilespec + _T("myFile.txt");
hFile = Create (strFilename, ...)
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I've corrected
error C2110: cannot add two pointers
CString strFilename = szFilespec + _T("myFile.txt");
but still same problem sorry
Doc
|
|
|
|
|
CString strFilename = szFilespec;
strFilename += _T("myFile.txt");
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
As I said in my last post, I've already corrected this compiler error and still the same problem.
Sorry
Doc
|
|
|
|
|
This works,
<br />
TCHAR m_szDrive[10];<br />
TCHAR m_szDir[MAX_PATH];<br />
TCHAR m_szFullPath[MAX_PATH];<br />
CString sFile; <br />
::GetModuleFileName(NULL,m_szFullPath,MAX_PATH);<br />
_splitpath(m_szFullPath,m_szDrive,m_szDir,NULL,NULL); <br />
sFile=m_szDrive;<br />
sFile+=m_szDir;<br />
sFile+=_T("myfile.txt");<br />
HANDLE h = ::CreateFile ( sFile,<br />
GENERIC_WRITE,<br />
FILE_SHARE_READ,<br />
NULL,<br />
OPEN_ALWAYS,<br />
FILE_ATTRIBUTE_NORMAL,<br />
NULL ) ;<br />
Given that your code appears to compile the problem is probably down to the arguments to 'CreateFile'. What are you using?
Paul
|
|
|
|
|
Anybody out there have this very frustrating problem?:
When I build my project, Visual often hangs and I have to kill the Visual C++.NET process and start over. It happens on a regular basis and the "Stop build" button does not work. It is very frustrating!!!
|
|
|
|
|
when accessing from another process.
All variables have not null values.
void getMenuItem(HWND hWndMenu)
{
HMENU menu = GetMenu(hWndMenu);
MENUITEMINFO mi, *_mi; unsigned long pid;
HANDLE process;
GetWindowThreadProcessId(hWndMenu, &pid);
process=OpenProcess (PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION, FALSE, pid);
_mi=(MENUITEMINFO*)VirtualAllocEx(process, NULL, sizeof(MENUITEMINFO), MEM_COMMIT, PAGE_READWRITE);
ZeroMemory(&mi, sizeof(MENUITEMINFO));
mi.cbSize = sizeof(MENUITEMINFO);
mi.fMask = MIIM_TYPE;
mi.fType = MFT_STRING;
mi.dwTypeData=NULL;
WriteProcessMemory(process, _mi, &mi, sizeof(MENUITEMINFO), NULL);
// this fails GetMenuItemInfo(menu, 1, true, _mi);
ReadProcessMemory(process, _mi, mi, sizeof(MENUITEMINFO), NULL);
int size = mi.cch;
VirtualFreeEx(process, _mi, 0, MEM_RELEASE);
|
|
|
|
|
I have an app that I recently opened a copy of in .Net to try to finish with .Net capabilities. Everything works fine so far, except that when I close the app, I get the following error message:
Unhandled exception at 0x00130276 in FB.exe: 0xC0000005: Access violation reading location 0x0099139c.
It's indicating the Bolded line in the following function (which I have never touched):
CRichEditCntrItem* CRichEditView::GetInPlaceActiveItem() const
{
ASSERT(m_lpRichEditOle != NULL);
CRichEditDoc* pDoc = GetDocument();
CRichEditCntrItem* pItem = NULL;
CReObject reo;
HRESULT hr = m_lpRichEditOle->GetObject(REO_IOB_SELECTION, &reo,
REO_GETOBJ_ALL_INTERFACES);
if (GetScode(hr) == S_OK && (reo.dwFlags & REO_INPLACEACTIVE))
{
pItem = pDoc->LookupItem(reo.poleobj);
if (pItem == NULL)
pItem = pDoc->CreateClientItem(&reo);
ASSERT(pItem != NULL);
}
return pItem;
}
Does anyone have any idea what's the problem? I'm very new to .Net and have no clue.
If it's broken, I probably did it
bdiamond
|
|
|
|
|
I have two VB apps in which I need to send a PeopleID from one app to another. If the 2nd app is closed, I could probably just specify it as a command-line argument. But what if the app is already running? Is there a way that I can do this in a dll?
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Hi. I'm looking for some hints (code) that will allow me add new rules to OE and add new Folder.
Thanks
Pain is a weakness living the body
|
|
|
|
|
Hi,
I have wrote a progrm that process word documents. I want to skip processing the password protected word documents.
How to find a word document is password protected, with out opening the document?
Thanks,
GTS
GTS
|
|
|
|
|
If you are using Word's COM interface (i.e., automation), then any attempt at opening a file with a missing/invalid password will fail. You can use such a return code to know whether to skip the file or not.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi
Using either Add method or Open method not causes the failure, it simply stalls the execution. Any idea?
Thanks,
GTS
|
|
|
|
|