|
Come on Richard, we all know moving them closer together makes it faster!
"The whole idea that carbon dioxide is the main cause of the recent global warming is based on a guess that was proved false by empirical evidence during the 1990s." climate-models-go-cold
|
|
|
|
|
You first have to test how your average speed (about 13 Mbit/s) compares with the speed of your network and then (if it is the case) investigate to find out the bottleneck. You should probably first check your own code, I strongly doubt the (possible) bottleneck is caused by the send call.
Veni, vidi, vici.
|
|
|
|
|
Get a faster network card....
"The whole idea that carbon dioxide is the main cause of the recent global warming is based on a guess that was proved false by empirical evidence during the 1990s." climate-models-go-cold
|
|
|
|
|
If your connection is faster, then yes.
In general, to achieve maximum performance, you will need a high performance protocol and I am not sure the Send API you are referring to falls into that category.
Typical characteristics for high performance protocols are:
* UDP based
* Packet loss tolerant
* Latency tolerant
You may have to write your own protocol, or Google for "high performance open source UDP file transfer" and you may find something.
Regards
|
|
|
|
|
I am preparing for my exams and i just found this question from previous question papers:
Give the C Expression for the following algebric expression :
1. ab^4c^2-d/m-n
2. ab-[{(e+f)^9}/c}]
Please help me as i am preparing for my exams and haven't read this topic yet.
help plz
|
|
|
|
|
himanshuchawla4393 wrote: and haven't read this topic yet. Then I suggest you read it; it will not help you if you just copy the answers from other people without understanding what it means. You can find all the information you need at http://msdn.microsoft.com/en-us/library/fw5abdx6.aspx[^].
|
|
|
|
|
Hi,
I am new to MFC. Can anybody tell me how to check the CDateTimeCtrl is dirty or not
Thanks in advance
|
|
|
|
|
Depends what you mean by "dirty".
|
|
|
|
|
Call its GetTime() method to get the currently selected date/time from the control. Then use COleDateTime::GetStatus() to check the validity.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
|
I find a error in the thread code: i call stop to screen saver in the other thread, more slow, than the thread where check if is all in stop; so the first don't know that if is all stopped; now it works - i'm sorry.
At the moment remains the problem regarding the hook: if i have the focus in my application, it works, but if i open the notepad and change focus, this hook don't works. Feel like the hook is "attacked" only on my application: It's due to the fact that the winthread object is called inside my application ? I have to change hook code ?
Thank you
Drugo
|
|
|
|
|
Today i'm find the correct way to work; i don't know why, but i'm fixed on the way to count time for starts screen saver inside my application, so i need hooks; i try to use hooks (i need global hook) and it works, but i think it's better in another way: the correct way is leave the screen saver administration to the system and enable it or disable it when occurs; the correct way is:
- Read if the screen saver is enabled from the system (so i know if i have to use it)
- If disabled i do nothing
- If enabled, disable it
- Run all on my application
- If device is sleeping for 1 minute, enable screen saver and reset counting
- If device is current in use, disable screen saver and reset counting
The rest it' better leave to the system: in this way i have only a delay of one minute for screen saver starting.
Now it works fine; i'm sorry for these post.
Thank you
Drugo
|
|
|
|
|
In an application i wrote years ago, i need to have a handle to printer propertiers device mode structure; i searched documents and i finded this function (DocumentProperties()); i searched example, i tried to use it, i writed code and the application works yet.
Now i have to write similar application and i note when i call this function, it cause a first-chance exception (only when i call it to know the size of buffer); so i try with the old application and also that cause the exception; i try to solve it, but the the example i find and the documentation i have tell me that the use of the function i make it's correct; the funny fact is this method works very well in release mode and with the old application the customer don't have problems.
The code is this:
BOOL PrinterSettings(LPTSTR pszPrinterName, BOOL bSet)
{
if (_tcslen(pszPrinterName) <= 0)
return FALSE;
if (bSet && theApp.m_hBarcodePrinterDev == NULL)
return FALSE;
PRINTER_DEFAULTS pd;
DWORD dwNeeded;
LONG lFlag;
HANDLE hPrinter = NULL;
DEVMODE FAR* pDevMode = NULL;
PRINTER_INFO_2* pPrintInfo2 = NULL;
BOOL bReturn = TRUE;
ZeroMemory(&pd, sizeof(pd));
pd.DesiredAccess = PRINTER_ALL_ACCESS;
bReturn = OpenPrinter(pszPrinterName, &hPrinter, &pd);
if (bReturn)
{
SetLastError(0);
bReturn = GetPrinter(hPrinter, 2, 0, 0, &dwNeeded);
if (!bReturn && (GetLastError() == ERROR_INSUFFICIENT_BUFFER) && dwNeeded > 0)
bReturn = TRUE;
}
if (bReturn && (dwNeeded <= 0))
bReturn = FALSE;
if (bReturn)
pPrintInfo2 = (PRINTER_INFO_2 *) GlobalAlloc (GPTR, dwNeeded);
if (bReturn && pPrintInfo2 == NULL)
bReturn = FALSE;
if (bReturn)
bReturn = GetPrinter(hPrinter, 2, (LPBYTE) pPrintInfo2, dwNeeded, &dwNeeded);
if (bReturn && pPrintInfo2->pDevMode == NULL)
{
dwNeeded = DocumentProperties(NULL, hPrinter, pszPrinterName, NULL, NULL, 0);
if (dwNeeded <= 0)
bReturn = FALSE;
if (bReturn)
pDevMode = (DEVMODE FAR*) GlobalAlloc(GHND, dwNeeded);
if (bReturn && pDevMode == NULL)
bReturn = FALSE;
if (bReturn)
{
lFlag = DocumentProperties(NULL, hPrinter, pszPrinterName, pDevMode, NULL,DM_OUT_BUFFER);
if (lFlag != IDOK || pDevMode == NULL)
bReturn = FALSE;
}
if (bReturn)
pPrintInfo2->pDevMode = pDevMode;
}
if (bReturn && pPrintInfo2->pDevMode == NULL)
bReturn = FALSE;
if (bReturn && bSet)
{
pPrintInfo2->pDevMode = (DEVMODE FAR*)::GlobalLock(theApp.m_hBarcodePrinterDev);
DWORD dwAttrib = pPrintInfo2->Attributes;
dwAttrib &= ~(PRINTER_ATTRIBUTE_WORK_OFFLINE);
pPrintInfo2->Attributes = dwAttrib;
lFlag = DocumentProperties(NULL, hPrinter, pszPrinterName, pPrintInfo2->pDevMode,
pPrintInfo2->pDevMode, DM_IN_BUFFER | DM_OUT_BUFFER);
if (lFlag != IDOK)
bReturn = FALSE;
if (bReturn)
bReturn = SetPrinter(hPrinter, 2, (LPBYTE) pPrintInfo2, 0);
GlobalUnlock(theApp.m_hBarcodePrinterDev);
}
if (bReturn && !bSet)
{
GlobalFree(theApp.m_hBarcodePrinterDev);
dwNeeded = DocumentProperties(NULL, hPrinter, pszPrinterName, NULL, NULL, 0);
if (dwNeeded <= 0)
bReturn = FALSE;
if (bReturn)
theApp.m_hBarcodePrinterDev = ::GlobalAlloc(GPTR, dwNeeded);
if (bReturn && theApp.m_hBarcodePrinterDev == NULL)
bReturn = FALSE;
if (bReturn)
{
lFlag = DocumentProperties(NULL, hPrinter, pszPrinterName,
(DEVMODE FAR*) theApp.m_hBarcodePrinterDev, NULL, DM_OUT_BUFFER);
if (lFlag != IDOK || theApp.m_hBarcodePrinterDev == NULL)
bReturn = FALSE;
}
if (bReturn && theApp.m_hBarcodePrinterDev == NULL)
bReturn = FALSE;
}
if (pPrintInfo2)
GlobalFree(pPrintInfo2);
if (pDevMode)
GlobalFree(pDevMode);
if (hPrinter)
ClosePrinter(hPrinter);
return bReturn;
};
Something can help me ?
Thanks
Drugo
|
|
|
|
|
What is the exception and where does it occur?
|
|
|
|
|
Whene the execution arrives in one of two lines i signed, compiler write:
First-chance exception in MyApp.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
First-chance exception in MyApp.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
but the function works normally.
Thanks
Drugo
|
|
|
|
|
These are not compiler messages, they look more like the messages you see in the debug log and can be ignored. Unless you get an exception inside your program, which causes the application to fail, you do not need to take any action.
|
|
|
|
|
... and what do you think could to be due this message ?
Thanks
Drugo
|
|
|
|
|
They are written to the debug log by the debugger; they are not being sent to the application. These exceptions are caught and handled by the system libraries.
|
|
|
|
|
I try to change printer and now i don't have no more exception.
Thank you so much for your answer.
Bye
Drugo
|
|
|
|
|
I have a technique that I use in WinAPI programs, to avoid stalling the message queue.
I start a separate thread in my program, which opens a hidden window with its own message queue. I typically call this thread the CommTask thread, since the first time I did this was to handle slow serial communications. When I want to perform a time-consuming task, I send a message to the CommTask thread using SendMessageCallback(), with a data packet telling it what to do.
When the CommTask thread completes handling of my message, my callback function gets executed.
What I don't know is, what thread is the callback function executing in?? Is it still in the CommTask thread, or has it somehow returned to my main program thread, or is there some other thread context that it executes in?
|
|
|
|
|
The documentation[^] hints at calling thread context. In any case you may easily verify it calling GetCurrentThreadId[^] inside the callback function.
Veni, vidi, vici.
|
|
|
|
|
Excellent idea!! Thank you, GetCurrentThreadId() will immediately and directly answer this question for me, I'll test it out this morning...
Yep, GetCurrentThreadId() confirmed that the callback thread executes in the context of the initiating thread.
modified 8-May-14 17:44pm.
|
|
|
|
|
Hello. I am trying to add some .C files in a new cpp project. Doing so gives me the fatal error C1853 i.e. precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa).
Now I have read a knowledge base article on microsoft forum about it which proposed 4 diffferent resolutions. I tried all of them but could not succeed (may be I couldn't understand what was required to be done). Can someone list down the steps to included .C files in cpp project. Thanks for your input.
This world is going to explode due to international politics, SOON.
|
|
|
|
|
Check properties for each of these files and set the compiler option for Precompiled Headers to "not using precompiled headers".
|
|
|
|
|
When using C files in a C++ unit you need to put an extern C around there include like this
#include "otherstuff" // you can include other c++ unit before it
extern "C" {
#include "Someunit" // include you c unit
}
#include "morestuff" // you can include other c++ units after it
In vino veritas
|
|
|
|