|
Hello,
I wanted to understand the functions that are directly called by the system and the reason behind it.
Prithaa
|
|
|
|
|
We suppose you made a program Windows send messges to your program if you need to these messages you can declare events for them like WM_MOUSE* or WM_PAINT and etc.You dont need to call windows events because windows sends them to your program for exmaple you need to change color of a static control so you tell to Windows that I need to this event with declare this event.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hello,
Thanks for the reply.
but how do I know exactly which functions are called by the system an which ones I am suppose to call. is there any article which makes this clear.
Prithaa
|
|
|
|
|
You can see them on the MSDN for example if you enter WM_COPYDATA on the MSDN you will be see "This message is sent when an application passes data to another application" or WM_INPUT "The WM_INPUT message is sent to the window that is getting raw input."
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
I want to read the file while downloading through the ftp client before download complete I got the error (The file is already in use. Close other programs that might be using the file, or stop playing the file, and then try again).
when I download the same file throught the window explorer by ftp I am able to read the file before download complete. My project requirement is to read some file content before download complete .How can I achieve that .
|
|
|
|
|
That is a big question. You should give more details i believe. Did you write the FTP downloader part yourself? How did you create/open the file for writing (the one you are downloading)?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Yes I write the FTP downloader part myself. I am uing CInternetSession ,CFtpConnection class to download the file and use the function FTPConnection->GetFile(LPCTSTR pstrRemoteFile,
LPCTSTR pstrLocalFile, BOOL bFailIfExists = TRUE,
DWORD dwAttributes = FILE_ATTRIBUTE_NORMAL,
DWORD dwFlags = FTP_TRANSFER_TYPE_BINARY,
DWORD_PTR dwContext = 1
).
I am downloading wmv file and while downloading I want to play on windows mediaplayer.
|
|
|
|
|
As you can see here[^], looking at the flags (especially CFile::shareDenyRead) you can guess that CFtpConnection::GetFile probably creates the target file denying read (and also probably write) access to it, so if you try to play the file in the player, the OS won't allow it to open the file. I have currently no idea how you could change the sharing-mode CFtpConnection uses to create the file.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Is there another API to download the file from the FTP to solve my above problem.
|
|
|
|
|
Well, am not sure about that, but This[^] looks promising, and you get source code with it too so you can shape it the way you want.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Thanks dear but problem is not solve there is same problem.
|
|
|
|
|
Well, looking at the code of the FTP client i'd say it should work, maybe there is something i do not know about... could you show me how your code looks like now?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hi all:
I have encountered a strange and difficult problem when running application on multi-user mode.
User A and User B are running the same appclication which is using the same database(SQL2000)with remotely log in.User A is doing a operation which might take a long time to query the data from databse on the GUI of the application,at the same time,the Interface of application on user B will bolck when User B is clicking,editing the GUI of the application,Exactly I have found why this problem occurs:the requery() function is timeout when user B is querying,ODBC S1T00 query time out expired.
what I did to fix this problem is that ignore this CDBException when catched this exception,and let the application keep running anyway.but there might be any error when operating the application again.
so what is the proper way to fix this problem,setting the value of timeout should never be a good idea,I think.
Could anyone help me ,thank you in advance.
regards
Keshin
|
|
|
|
|
|
You possibly may get better help at the General Database forum [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You can ask the same here instead :
DB Forum[^]
But I don't understand why it should wait for the other application to finish it's query. Both should run independently. In general, If you find the queries are taking too long, you make opt for a worker thread.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
I'm using a remote execution tool called 'PsExec' from sysinternals.
I use it this way in my command prompt :
D:\Tools\Testing>psexec netsh firewall show opmode>D:\Log.txt
This generates the output for 'netsh firewall show opmode' and redirects to D:\Log.txt
Now, I implement the same logic/code in my application like this :
CString csCmdLineParams = "netsh firewall show opmode>D:\\TestdwLog.txt";
STARTUPINFO StartUpInfo;
PROCESS_INFORMATION ProcInfo;
DWORD ExitCode = -1;
memset(&StartUpInfo, 0, sizeof(StartUpInfo));
memset(&ProcInfo, 0, sizeof(ProcInfo));
StartUpInfo.dwFlags = STARTF_USESHOWWINDOW;
StartUpInfo.wShowWindow = SW_SHOW;
CreateProcess( "C:\\windows\\system32\\cmd.exe", csCmdLineParams.GetBuffer(csCmdLineParams.GetLength() + ONE), NULL, NULL, NULL, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &StartUpInfo, &ProcInfo);
WaitForSingleObject(ProcInfo.hProcess, INFINITE);
GetExitCodeProcess(ProcInfo.hProcess, &ExitCode );
if (ExitCode) {
csCmdLineParams.ReleaseBuffer();
CloseHandle(ProcInfo.hProcess);
}
csCmdLineParams.ReleaseBuffer();
CloseHandle(ProcInfo.hProcess);
But, I'm not able to redirect the output to D:\TestdwLog.txt. In fact the file is not created itself.
Note : I do have administrator rights for my system. [required for PsExec]
What am I doing wrongly ?
I also tried
StartUpInfo_IDI.dwFlags = STARTF_USESTDHANDLES; instead of StartUpInfo.dwFlags = STARTF_USESHOWWINDOW;
Replies would be appreciated
Thanks in advance.
|
|
|
|
|
|
Put psexec netsh firewall show opmode>D:\Log.txt in a batch file, and run the batch file from CreateProcess() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanks David.
This works.
Also found another option of using system()
Thanks
|
|
|
|
|
I know how to use the MS XML Parser in VC++ 6. For instance, I can do a #import the dll using the appropriate namespace.
But this does not seem to work in VC++ 2005 Express Edition...
What do I need to do so that I could use MSXML parser in my C++ sources which are to be compiled with the free VC++ 2005 Express Edition alone (and no other compiler)?
Please provide pointers to any helpful articles/pages here or elsewhere.
Thanks in advance.
|
|
|
|
|
What's the error you are getting? when you do an import in VS2005?
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
To use #import with an Express edition, you need to remove any mention of ATL (as the express editions don't ship with ATL). That means no smart pointers, no wrappers for VARIANT or BSTR . You can tell #import not to use ATL with attributes (see the second example below).
So, it can be done, but it means going from code like this:
#include <tchar.h>
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#include <atlbase.h>
#include <atlstr.h>
#include <iostream>
#import <progid:Msxml2.DOMDocument.6.0> rename_namespace("TestNS")
int _tmain(int argc, _TCHAR* argv[])
{
CoInitializeEx(0, COINIT_MULTITHREADED);
TestNS::IXMLDOMDocument3Ptr pDoc(__uuidof(TestNS::FreeThreadedDOMDocument60));
pDoc->load("CHange-History.xml");
pDoc->setProperty("SelectionLanguage", "XPath");
TestNS::IXMLDOMNodeListPtr selected = pDoc->documentElement->selectNodes("//configuration");
long nodeCount;
selected->get_length(&nodeCount);
std::cout << nodeCount << " configuration nodes\n";
CoUninitialize();
return 0;
}
to code like this (it runs and gives the same answer as the code above, but I'm not sure that I manage resources correctly....
#include <tchar.h>
#include <iostream>
#import <progid:Msxml2.DOMDocument.6.0> rename_namespace("TestNS") raw_interfaces_only no_implementation no_smart_pointers raw_native_types
int _tmain(int argc, _TCHAR* argv[])
{
CoInitializeEx(0, COINIT_MULTITHREADED);
TestNS::IXMLDOMDocument3* pDoc;
HRESULT hr;
if (SUCCEEDED(hr = ::CoCreateInstance(__uuidof(TestNS::FreeThreadedDOMDocument60), 0, CLSCTX_ALL, __uuidof(TestNS::IXMLDOMDocument3), (void**)&pDoc)))
{
BSTR file = ::SysAllocString(L"CHange-History.xml");
VARIANT vFile;
V_VT(&vFile) = VT_BSTR;
V_BSTR(&vFile) = file;
VARIANT_BOOL loadedOK;
if (SUCCEEDED(hr = pDoc->load(vFile, &loadedOK) && loadedOK == VARIANT_TRUE))
{
BSTR propName = ::SysAllocString(L"SelectionLanguage");
BSTR selectionLanguage = ::SysAllocString(L"XPath");
VARIANT vSelLang;
V_VT(&vSelLang) = VT_BSTR;
V_BSTR(&vSelLang) = selectionLanguage;
TestNS::IXMLDOMElement* docElement;
BSTR xpath = ::SysAllocString(L"//configuration");
TestNS::IXMLDOMNodeList* selected;
if (SUCCEEDED(hr = pDoc->setProperty(propName, vSelLang)))
{
if (SUCCEEDED(hr = pDoc->get_documentElement(&docElement)))
{
if (SUCCEEDED(hr = docElement->selectNodes(xpath, &selected)))
{
long nodeCount;
if (SUCCEEDED(selected->get_length(&nodeCount)))
{
std::cout << nodeCount << " configuration nodes\n";
}
selected->Release();
}
docElement->Release();
}
}
::SysFreeString(xpath);
::SysFreeString(propName);
::SysFreeString(selectionLanguage);
}
::SysFreeString(file);
pDoc->Release();
}
CoUninitialize();
return 0;
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks, Stuart!
BTW, in the meanwhile, I have already made use of TinyXML because my requirements were very very simple. My document has a very simple (and predictable) structure that is just two/three levels deep... It doesn't have to to have validation...
Why TinyXML? Because, Google showed it above the others, that's why...
Thanks again, anyway, and bye for now
|
|
|
|
|
Ajit Jadhav wrote: TinyXML
Sounds like the right thing for your scenario.
Another option that might have suited you is RapidXML[^] - it's so small that it's contained in a single header file you #include into your code!
[edit]Or Microsoft's XmlLite[^], possibly[/edit]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|