|
I'm using VSS interface in my program.
I'm getting the latest version of the file by using Get function in IVSSItemPtr.
IVSSItemPtr vssi;
COleVariant varBuf(strProjectFolder);
vssi = m_vssdb->GetVSSItem( varBuf.bstrVal,0);
vssi->Get( NULL,VSSFLAG_USERRONO | VSSFLAG_RECURSYES | VSSFLAG_FORCEDIRYES | VSSFLAG_GETYES );
The above code works perfectly for me. It gets the latest version. But I'm suffering from biggest disadvantage. Once this function is called it disables my main application. No messages are handled by main window, when the Get function is called. Once that function execution is finished then only Window accepts messages. Till then all the messages are blocked. Even all the threads are suspended. For large folders when we use Get function, it's takes very long time and it's quite annoying that Window gets disabled and all background threads are suspended. Is there any way to overcome it? I wanted to monitor the status of the Get function. Is there any way to run background thread to monitor it? Can we enable the Window to accept messages.
Thanks,
Stanly
|
|
|
|
|
Why not do it the other way around, and spin off a new thread to perform the get?
Of course, you'll need to coinit your new thread and marshall your interface into the new thread, but that isn't exactly rocket science. Your 'get' thread can post a message when it's complete.
Unfortunately, there don't appear to be any useful events that fire during the get, so you can't "monitor" as such. An alternative would be to handle the recursion yourself in the thread, and have the thread post messages to your UI thread or a window.
The application 'hangs' for a simple reason; the UI thread it isn't pumping messages, because the call hasn't completed yet. When you say the threads are suspended, I'm guessing that none of them have their own message loops.
Steve S
Developer for hire
|
|
|
|
|
Thanks a lot for responding. I tried using thread to perform 'get'. In this case also, once the 'get' function is called application is not responding to any messages even the message loop of each thread. The 'get' completely blocks other messages. I tried using recursion mechanism to 'get' file. There is a major drawback for this method. The performance is affected to a large extent. It's take very long time to get a big folder because it has to recurse to each folders and subfolders. Thats why I thought of shifting to single call mechanism to 'get' whole folder. Can you please help me with this problem?
Thanks,
Stanly
|
|
|
|
|
It is a lot of work (in terms of CPU time) to get a large folder and any subfolders. If you do it using the SourceSafe UI, time it and see how long it takes - and then compare that with your single get, and if possible, your recursive version.
Doing the automation work can be a bit of a pain, but if your code is reasonable, it shouldn't be that much worse than using the SS UI.
What exactly are your other threads doing, and have you adjusted the priority of them? It sounds like you're just CPU starved, and while SS uses a lot, you should be able to do other things at the same time - I have a snapshot utility that replicates a given SS db to a new SS db (eliminating any history) and I can run other stuff along side it, although I have a P4 2.8GHz cpu ...
Steve S
Developer for hire
|
|
|
|
|
I found that the CPU is much lesser(30%) than total CPU available. The single get is much faster than recursive version and also it's faster than SS UI.
It's better than SS UI.
The VSS database is located in remote machine. Is it because of reading from remote machine makes the application to freeze? One thread is to monitor the content of one folder. The control is never reaching this thread, once the 'get' function is called. I tried using timers also, timer event is also not happening. Thanks a lot for your help.
Thanks,
Stanly
|
|
|
|
|
stanlymt wrote: One thread is to monitor the content of one folder. The control is never reaching this thread, once the 'get' function is called. I tried using timers also, timer event is also not happening.
How do you know that the thread is not running? Does it have it's own windows and message loop, or are you outputting to a debug window (TRACE/ATLTRACE/OutputDebugWindow)?
The single get will be faster, but then you have to do your own monitoring of progress, which means looking for file change notifications etc. I suggested the recursive version because you said you wanted to have progress notifications, and this would be one way. I'm guessing that the SS UI does it this way, since there aren't events that get fired (at least, not that we get told about!).
It might be the STA that's contributing to the lockups. You could try using CoInitializeEx to get an MTA instead (in both the main thread and the get thread), and see if that helps at all.
When you say timers, do you mean SetTimer(), which will only cause WM_TIMER to be pulled out of the queue, which, as you're not pumping msgs, won't be happening....
Steve S
Developer for hire
|
|
|
|
|
I know the control is coming to that thread because I've put some debug logs which was not printing. I think I'll go for recursive version.
Thanks a lot for your help.
|
|
|
|
|
BOOL WriteFile(
HANDLE hFile,
LPCVOID lpBuffer,
DWORD nNumberOfBytesToWrite,
LPDWORD lpNumberOfBytesWritten,
LPOVERLAPPED lpOverlapped
);
BOOL ReadFile(
HANDLE hFile,
LPVOID lpBuffer,
DWORD nNumberOfBytesToRead,
LPDWORD lpNumberOfBytesRead,
LPOVERLAPPED lpOverlapped
);
|
|
|
|
|
It's understandable from Parameter names
check MSDN
CHeck MSDN[^]
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Patte
|
|
|
|
|
WriteFile is for write to file and ReadFile is for read from file see
<br />
CString WriteToFile;<br />
HANDLE hFile;<br />
DWORD dwRead;<br />
WriteToFile="This is a test";<br />
<br />
hFile=CreateFile((LPCTSTR)"c:\\test.txt",GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);<br />
<br />
DWORD m_dwSize=WriteToFile.GetLength();<br />
BOOL bResult=WriteFile(hFile,(LPCTSTR)WriteToFile,m_dwSize,&dwRead,NULL);<br />
CloseHandle(hFile);<br />
<br />
CString strRead="";<br />
DWORD dwReads=0;<br />
hFile=CreateFile((LPCTSTR)"c:\\test.txt",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);<br />
<br />
DWORD dwBufferSize=GetFileSize(hFile,NULL);<br />
<br />
bResult=ReadFile(hFile,strRead.GetBuffer(dwBufferSize),dwBufferSize,&dwReads,NULL);<br />
<br />
MessageBox(strRead);<br />
CloseHandle(hFile);<br />
<br />
And see MSDN
whitesky
|
|
|
|
|
Hi,
Does any one know how to get a security descriptor from SID . I got the SID of a user using LookupAccontName API. I dont now how to get the security descriptor corresponding to the SID.
Thanks in advance
|
|
|
|
|
See Here[^] and this[^]site maybe it is some helpful to you
whitesky
|
|
|
|
|
What is the difference between Win32 applcation and Win32 Console application?
Because I did one simple addition function in Win32 application,it gave me a link error and it mention some error in WinMain()
-- modified at 0:53 Thursday 20th July, 2006
|
|
|
|
|
A console app runs in a console window, and the entry point is main() . A GUI app doesn't automatically get a console window, and the entry point is WinMain() .
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Win32 console is a text terminal window within the system of Windows API. A Win32 console has a screen buffer and an input buffer.
A Win32 application is a 32-bit application that meets Microsoft's Win32 API standard. This standard ensures that applications can take advantage of Windows features such as graphics, window management, memory management, file I/O, security, networking, and threading. Win32 applications run on one processor or multiple processors and on multiple hardware architectures.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
From your comment I got the impression that you tried to say that Win32 applications are more flexible than Win32 console applications, but that is not true.
Win32 console applications can be as flexible as Win32 applications. In fact, a Win32 console application is a Win32 application which allocates a console for printf to work right away. Also, the entry point is main() because it is assumed that you will be making normal C/C++ applications when the project type is Win32 console.
In every other respect, they are capable of the same functionalities and can have the same features. They both can include "windows.h" and use all Win32 API functions. This means you can use "CreateFile" instead of "fopen" in a Win32 console application, just like in a Win32 application.
Rilhas
|
|
|
|
|
Hello all,
I have created propertysheet in wizard mode and i want to change the caption of third Wizardpage(derived from CPropertyPage) after it popups. In dialog editor i set caption of that propertypage(Say "x"). I want to change it to(say"Y") for reusability.
Can anybody help me?
Regards;
Aj
|
|
|
|
|
|
i use vc++2005, mfc, xp professional sp2.when i debug in functions of a files,the cursor doesn't exactly piont to the excuted line, but it piont to the third line before the excuted line. however,in the other files, everything is normal. i cleaned the solution and rebuilded it, but it don't work yet. what shold i do to make it normal?
|
|
|
|
|
// .h file
class CAPI : public CWnd
{
public:
CString Login(LPCTSTR UserName, LPCTSTR Password, LPCTSTR UserId);
}
// .cpp file function
CString CAPI::Login(LPCTSTR UserName, LPCTSTR Password, LPCTSTR UserId)
{
//username = wwtest2;
//Password = RD9234;
//Userid = wwtest2;
CString result;
static BYTE parms[] =VTS_BSTR VTS_BSTR VTS_BSTR;
InvokeHelper(0x2, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms,UserName, Password, UserId);
return result;
}
"God helps to whom who helps other"
|
|
|
|
|
priyanka s wrote:
// .h file
class CAPI : public CWnd
Buddy, there no way we can help you as this class is not By MS!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
You created a function for login ok then...
whitesky
|
|
|
|
|
i have cereated the function for login...but i dont know how to write code for that???
I am using Active X controls in my project.And the Api has all the function for that which i have in my project as awrapper class.This Active X control is going to b bridge b/w client and server....
I am stuck in the point of coding..
I am new to programmimg.....Thanks
|
|
|
|
|
|
LOGIN TO ODL SERVER TO GET SESSION ID AND DATA FROM THAT
|
|
|
|
|