|
Cool, Judy!
regards,
George
|
|
|
|
|
|
Hi Hamid,
Is it for Windows? I ask this question because I saw some Linux OS like configuration in this article. You know, the memory management logics are general on Wnidows/Linux, but there are too many specific things.
regards,
George
|
|
|
|
|
Each link has new things that is helpful for you.
|
|
|
|
|
Thanks Hamid,
Each link? There is only one link in your previous reply.
regards,
George
|
|
|
|
|
No in each link (not my reply) you can see new things.
|
|
|
|
|
Thanks for your help, Hamid!
I hope you can continue to discuss with me in the future for other topics.
regards,
George
|
|
|
|
|
Not problem.
|
|
|
|
|
A soft page fault happens when an application requests memory pages still inside RAM but outside of the application's Working Set.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks DavidCrow,
I think there are four situations of page fault.
1. Demond zero;
2. Copy write;
3. Shared memory from other process;
4. "Drag" page from system standby page list.
Do you agree all of them? Do I miss anything?
regards,
George
|
|
|
|
|
i have to read a file in remote system. so i am using named pipes for communication. In local system i can get handle to named pipe, but when i try to connect to remote system, i get invalid handle value.
HANDLE hPipe; <br />
LPTSTR lpvMessage=TEXT("Hi... hru ... message from client"); <br />
TCHAR chBuf[BUFSIZE]; <br />
BOOL fSuccess; <br />
DWORD cbRead, cbWritten, dwMode; <br />
LPTSTR lpszPipename = TEXT("\\\\servername\\pipe\\mynamedpipe"); <br />
<br />
SECURITY_ATTRIBUTES saAttr; <br />
<br />
<br />
saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); <br />
saAttr.bInheritHandle = TRUE; <br />
saAttr.lpSecurityDescriptor = NULL; <br />
<br />
<br />
while (1) <br />
{ <br />
hPipe = CreateFile( <br />
lpszPipename,
GENERIC_READ |
GENERIC_WRITE, <br />
0,
NULL,
OPEN_EXISTING,
0,
NULL);
<br />
<br />
if (hPipe != INVALID_HANDLE_VALUE) <br />
break; <br />
<br />
<br />
if (GetLastError() != ERROR_PIPE_BUSY) <br />
{<br />
printf("Could not open pipe"); <br />
return;<br />
}<br />
<br />
<br />
if (!WaitNamedPipe(lpszPipename, 20000)) <br />
{ <br />
printf("Could not open pipe"); <br />
return ;<br />
} <br />
} <br />
<br />
<br />
dwMode = PIPE_READMODE_MESSAGE; <br />
fSuccess = SetNamedPipeHandleState( <br />
hPipe,
&dwMode,
NULL,
NULL);
if (!fSuccess) <br />
{<br />
printf("SetNamedPipeHandleState failed"); <br />
return ;<br />
}<br />
<br />
<br />
fSuccess = WriteFile( <br />
hPipe,
lpvMessage,
(lstrlen(lpvMessage)+1)*sizeof(TCHAR),
&cbWritten,
NULL);
if (!fSuccess) <br />
{<br />
printf("WriteFile failed"); <br />
return ;<br />
}<br />
this is my problem .. if u have any idea ... pls give me answer asap...
|
|
|
|
|
Could you verify a few things please?
The remote computer's name really is "servername"? Is this how the name appears on your network? You have written and verified a pipe server that creates the named pipe "mynamedpipe"? That the code snippet will open the pipe on the "servername" computer?
|
|
|
|
|
Hi,
I have created a win32 dll and added a dialog resource.
And I exposed functions which would create a dialog and
work on it.
void MyFun()
{
BOOL blnSuccess ;
g_MySafeDlg = new CMySafeDlg();
MessageBox(NULL,_T("i am in MyFun"),NULL,MB_OK);
if(g_MySafeDlg != NULL)
{
BOOL ret = g_MySafeDlg->Create(IDD_DLG_MYSAFE);
if(!ret)
{
MessageBox(NULL,_T("dialog not created"),NULL,MB_OK);
return ;
}
}
-----
I am getting Dialog not created messagebox.
What could be the problem?
Any suggestions would be helpful.
Thanks
Today is a gift, that's why it is called the present.
modified on Thursday, January 10, 2008 1:03:05 AM
|
|
|
|
|
You can use of Create(IDD_DLG_MYSAFE); on the constructor of CMySafeDlg.
|
|
|
|
|
Problem Solved. I forgot to set the resource handle when
calling from the client
i.e done as below
HINSTANCE hInsta = LoadLibrary(_T("..\\..\\MySafeClDll\\debug\\MySafeClDll.dll"));
AfxSetResourceHandle(hInsta);
Thanks
Today is a gift, that's why it is called the present.
|
|
|
|
|
how to show all of the CStringArray members to editbox that have a cstring variable.
i have some difficulties coz only last member i can show in my editbox ?. , i try it in lzw compression article by The Prince of Chaos(www.codeproject.com/KB/recipes/LZWCompression.aspx)
|
|
|
|
|
ciiiek wrote: i have some difficulties coz only last member i can show in my editbox ?.
I didn't get you... Can you explain a little bit better?
|
|
|
|
|
If you want to show values of CStringArray to editctrl you must keep previous datas of edit ctrl and insert new value to that string of edit ctrl.
|
|
|
|
|
Are you looking for something like this?:
CStringArray szArr;
CString szStr;
szArr.Add(_T("One\r\n"));
szArr.Add(_T("Two\r\n"));
szArr.Add(_T("Three\r\n"));
szStr = szArr.ElementAt(0) + szArr.ElementAt(1) + szArr.ElementAt(2);
m_str = szStr;
UpdateData(false);
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
...formerly known as brahmma
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Dear All,
A strange behavior for drag and drop.
DROPEFFECT_NONE work when using my format but CF_HDROP.
Can some one tell me why and how can I do it ?
Thanks for your great help.
BOOL CtestdragDlg::OnInitDialog()
{
CDialog::OnInitDialog();
::OleInitialize(NULL);
BOOL bRes = m_Target.Register(&m_List);
m_cfFormat = RegisterClipboardFormat(_T("{2FCA1C31-D8F1-4f20-8051-B0CCF7B6FD0D}"));
m_List.InsertColumn(0,_T("First"),0,300);
m_List.InsertItem(0,_T("Hello"));
return TRUE; // return TRUE unless you set the focus to a control
}
HGLOBAL CtestdragDlg::GetData()
{
char Text[5] = "HHHH";
HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE,strlen(Text)+1);
char *pChar = (char *)GlobalLock(hGlobal);
strcpy(pChar,Text);
GlobalUnlock(hGlobal);
return hGlobal;
}
void CtestdragDlg::OnLvnBegindragList1(NMHDR *pNMHDR, LRESULT *pResult)
{
COleDataSource DataSource;
HGLOBAL hData = GetData();
if (hData)
{
//DataSource.CacheGlobalData(m_cfFormat,hData);
DataSource.CacheGlobalData(CF_HDROP,hData);
DROPEFFECT DropEffect = DataSource.DoDragDrop();
}
*pResult = 0;
}
DROPEFFECT CMyTarget::OnDragOver(CWnd* pWnd,COleDataObject* pDataObject,DWORD dwKeyState,CPoint point)
{
return DROPEFFECT_NONE;
}
|
|
|
|
|
Hi,
I am a little confused on the use of DLL's first I guess there is a difference between a static load and a Dynamic Load
A LoadLibrary is a Dynamic Load of a Dll So my questions is How can you ensure a DLL is Automatically Loaded when your app/exe starts up ??? (which I guess would be a static Load)
Second If want execute a Function in a DLL I can do A GetProcAddress and use the function or use IMPORT/EXPORT (__declspec) pairs
These are two mutally exclusive way of excuting the function ???
Thankx
|
|
|
|
|
ForNow wrote: which I guess would be a static Load)
yes
ForNow wrote: These are two mutally exclusive way of excuting the function ???
They are not exclusive. Even can mix both this method. How ever if you want to call a function by with any of the aboce technique, the only this you need to ensure is that the function should be exported eith using the __declspec or by adding the entry in the .def file.
|
|
|
|
|
How can you do a static load or ensure that the DLL get loaded when your app/exe starts up
|
|
|
|
|
Suppose you have a function say, void test() exported from a dll( using __declspec or using def file ). when you build the dll, along with the dll and lib file will also be generated.
. Now Declared the function in the exe( usually we include the header file of the dll in which the function is already declared )
.After that you can call the function. Also add the lib file of that dll in the project settings of the exe ( project settings->link->object or library modules).
|
|
|
|
|
The .lib file is the glue
The funny thing about this is when you run a app/exe Windows will somtimes not find because its not in the Path
However I guess it will always find a .DLL anywhere on your machine to Load it
|
|
|
|