|
I think so, as long as the read and write operations are not happening at the exact spot in the file. See LockFile() for more.
zahid_ash wrote: i want to shorten the read write time
Well, creating a bunch of threads on a uniprocessor machine is one way to not "shorten the read write time." The overhead of context-switching between all of the threads will be your demise.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Will they run parallely on multi processor machine.
How can i demise the context switching of thread,
Regards.
|
|
|
|
|
zahid_ash wrote: Will they run parallely on multi processor machine.
Yes, but I've no experience with this. I think SetThreadIdealProcessor() will be required.
zahid_ash wrote: How can i demise the context switching of thread,
I'm not sure exactly what it is that you are asking here, but I think the answer is, "When more than one thread is involved, the processosr will need to periodically switch between them so that at any given monent, only one thread is actually active." This obviously incurs overhead that cannot be avoided.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi!
DOes anybody know, what I have to do, if I want either to create an new .XML-File or open an existing .XML-File to write at the beginning of this file?
I thought, that I can handle this like a normal text-file but that has been a mistake.
So, if anybody knows something about this, please let me know!
Thanks, Hanno
|
|
|
|
|
Use IXMLDocument or DOMDocument .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thanks for your help. Could you send a small piece of code, explaning this a little bit?
With best regards, Hanno
|
|
|
|
|
Why not just Google for those two interfaces? Also try CodeProject articles, and MSDN.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
If you want a light-weight XML library (i.e. not MSXML), have a look at http://tinyxml.sourceforge.net/[^].
I used TinyXML in several projects, it works pretty well.
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Whats the symbol to put to stdin to finish its reading
//console app reading in a loop until that magic symbol
while(res)
res = fscanf(stdin,"%s",&str);
//while pressing in console
string1
string2
string3
??? how to quit it
9ine
|
|
|
|
|
Use F6 or Ctrl-Z.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
whats the code for that combination ctrl-z? \r \n \t ... ?
9ine
|
|
|
|
|
If you are typing at a command prompt (which is what I inferred from your "while pressing in console" comment), \r \n \t are meaningless. What exactly are you trying to do?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I'm not going to type numbers and then pressing F6, I need to write to console application stdin so it will read it like fscanf(stdin, ... ) or whatever the method until that character F6 encountered
9ine
|
|
|
|
|
Ok, let me see if I can put the pieces together. You have a Windows application that is going to spawn a console application. Right so far? The console applicaton is going to be reading from stdin , so you need to populate that stream from within the Windows application. Correct?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Exactly! and send that stream of floating numbers prepared as char strings array of course to console input so it will be reading it until F6 encountered.
9ine
|
|
|
|
|
|
CTRL Z is ASCII 26, you can enter it in your text literals using the octal notation \032
You may be right
I may be crazy
But it just may be a lunatic you’re looking for
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Isn't the onSize() event supposed to fire when you resize a CDialog?
void CDlgMap0::OnSize(UINT nType, int cx, int cy)
{
MakePE();
CDialog::OnSize(nType, cx, cy);
}
In my case the execution never steps into the function.
I have in the .h file, where I added it by hand
protected:
afx_msg void OnSize(UINT nType, int cx, int cy);
DECLARE_MESSAGE_MAP()
thanks,
sb
|
|
|
|
|
ns wrote:
In my case the execution never steps into the function.
How do you know?
What does CDlgMap0 's BEGIN_MESSAGE_MAP() method look like?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
The begin_mesage_map was empty. I've been away from MFC for 2 years (been using QT) . I see now I needed ON_WM_SIZE() in there. Thanks so much for the hint. It works now.
sb
|
|
|
|
|
Hey,
I have no idea why this isn't working but I am trying to simply toggle between ES_PASSWORD on a edit control with in a dialog. I have tried Get/SetWindowLong and ModifyStyle and neither seem to work... Here is a sniplet of my code.
What am I doing wrong?
void CActivationDlg::OnBnClickedCMask()
{
UpdateData(TRUE);
m_bMask = m_bMask ? TRUE : FALSE;
DWORD dwStyle = GetWindowLong(m_cKey.GetSafeHwnd(), GWL_STYLE);
if(!m_bMask)
{
TRACE("Remove PW mask\n");
dwStyle &= ~ES_PASSWORD;
SetWindowLong(m_cKey.GetSafeHwnd(),
GWL_STYLE,
dwStyle);
}
else
{
TRACE("Add PW mask\n");
dwStyle |= ES_PASSWORD;
SetWindowLong(m_cKey.GetSafeHwnd(),
GWL_STYLE,
dwStyle);
}
m_cKey.Invalidate();
UpdateData(FALSE);
}
Thanks in advance!
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Are you sure the ES_PASSWORD style can be un/set at runtime? Some styles are unchangeable.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
You might be right... I did notice on MSDN that some of the other styles state if changes need to be made after creation use the SetWindowLong function, unfortunately it doesn't say anything about ES_PASSWORD, it probably can't be changed with ease...
DOH!
Thanks,
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Would it be feasible to create two of the same controls, one with the style and one without? Then at runtime you could just show/hide the appropriate control.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Yeah I could have just done that... Instead I have removed the old control and created a new one. If anyone is interested this is the code. Most of this code is from the SuperPad MSDN example for changing word wrap...
void CActivationDlg::OnBnClickedCMask()
{
UpdateData(TRUE);
m_bMask = m_bMask ? TRUE : FALSE;
CFont* pFont = m_cKey.GetFont();
int nLen = m_strKey.GetLength();
TCHAR* pSaveText = new TCHAR[m_strKey.GetLength()+1];
GetWindowText(pSaveText, nLen+1);
DWORD dwStyle = GetWindowLong(m_cKey.GetSafeHwnd(), GWL_STYLE);
if(!m_bMask)
dwStyle &= ~ES_PASSWORD;
else
dwStyle |= ES_PASSWORD;
CActivationDlg* pParent = (CActivationDlg*)m_cKey.GetParent();
CRect rect;
m_cKey.GetWindowRect(rect);
pParent->ScreenToClient(rect);
UINT nID = m_cKey.GetDlgCtrlID();
HWND hWnd = ::CreateWindowEx(WS_EX_CLIENTEDGE, _T("edit"), NULL, dwStyle,
rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top,
pParent->m_hWnd, (HMENU)nID, AfxGetInstanceHandle(), NULL);
if (hWnd == NULL)
{
delete[] pSaveText;
return;
}
m_cKey.SetWindowText(NULL);
::SetWindowText(hWnd, pSaveText);
delete[] pSaveText;
if (pFont != NULL)
{
ASSERT(pFont->m_hObject != NULL);
::SendMessage(hWnd, WM_SETFONT, (WPARAM)pFont->m_hObject, 0);
}
SetDlgCtrlID(nID+1);
HWND hWndOld = m_cKey.Detach();
::SetWindowLong(hWndOld, GWL_WNDPROC, (LONG)*GetSuperWndProcAddr());
ASSERT(m_cKey.m_hWnd == NULL);
m_cKey.SubclassWindow(hWnd);
ASSERT(m_cKey.m_hWnd == hWnd);
UINT nTabStops = 7;
m_cKey.SetTabStops(nTabStops);
m_cKey.GetClientRect(&rect);
m_cKey.SetWindowPos(NULL, 0, 0, 0, 0,
SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_NOZORDER|SWP_SHOWWINDOW);
m_cKey.UpdateWindow();
::SetWindowPos(hWndOld, NULL, 0, 0, 0, 0,
SWP_HIDEWINDOW|SWP_NOREDRAW|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|
SWP_NOZORDER);
::DestroyWindow(hWndOld);
UpdateData(FALSE);
}
Whoever said nothing's impossible never tried slamming a revolving door!
-- modified at 6:45 Wednesday 1st March, 2006g door!
|
|
|
|