|
Hi everyone!
I'm using ReadDirectoryChangesW for tracking any changes in the dedicated Source folder and apply it to the Destination folder.
But, when multiple files are selected and deleted at once in the Source folder, only the first file is deleted in the Destination folder.
Is there any way to delete all files at once?
Thanks beforehand.
|
|
|
|
|
I haven't used this myself, however reading the MSDN documentation it seems ReadDirectoryChangesW fills a buffer with one or more FILE_NOTIFY_INFORMATION structures, of which the NextEntryOffset field is the key to finding the next (unless zero). From your description, it seems you are ignoring this field.
[ADDED] The doc also says nothing gets returned when the buffer is too small, which is more likely to happen when lots of things need reported at the same time. You may want to ask for a bigger buffer. [/ADDED]
|
|
|
|
|
mints555 wrote: But, when multiple files are selected and deleted at once in the Source folder, only the first file is deleted in the Destination folder.
If you are having trouble deleting files, what does that have to do with ReadDirectoryChangesW() ?
What does your deletion code look like?
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
hi guys,,,
i'm have a project about MFC. how to create bitmap from mousemovent??
for mousemovent i'm can write to picturebox.
the code is written in mfc wizard exe in a dialog based application.
for picturebox -> IDC_PIC
for button -> IDC_SAVE
my code:
void CSignature1Dlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_pic1.GetSafeHwnd();
HCURSOR hcur = NULL;
CRect rc;
m_pic1.GetClientRect(&rc);
rc.NormalizeRect();
rc.left=0;
rc.right=250;
rc.top=0;
rc.bottom=250;
POINT MousePosition = point;
BOOL isOnPictureControl = PtInRect(&rc, MousePosition);
if((m_iPrevX >=rc.left && m_iPrevX <=rc.right) && (m_iPrevY >=rc.top && m_iPrevY <=rc.bottom )){
if((nFlags & MK_LBUTTON) == MK_LBUTTON)
{
CDC* pDC = m_pic1.GetDC();
CDC dcMem;
dcMem.CreateCompatibleDC(pDC);
dcMem.SelectObject(&m_bmpBitmap);
CPen pen (PS_SOLID,2,RGB(0,0,0));
pDC->SelectObject (&pen);
pDC->MoveTo(m_iPrevX,m_iPrevY);
pDC->LineTo(point.x,point.y);
pDC->SetPixel(point.x,point.y, RGB(0,0,0)) ;
m_iPrevX=point.x;
m_iPrevY=point.y;
}
}
CDialog::OnMouseMove(nFlags, point);
}
void CSignature1Dlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
HCURSOR hcur = NULL;
CRect rc;
m_pic1.GetClientRect(&rc);
rc.NormalizeRect();
m_iPrevX=point.x;
m_iPrevY=point.y;
CDialog::OnLButtonDown(nFlags, point);
}
void CSignature1Dlg::OnSave()
{
// TODO: Add your control notification handler code here
?????????
}
so give me advice, how to can create and save the mousemovent into bitmap???
i hope u can help me...
|
|
|
|
|
josipahutar wrote: so give me advice, how to can create and save the mousemovent into bitmap???
See the Scribble MFC sample[^].
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
thx your reply sir..
i dont understand because i newbie in MFC..
so can u give me a example about my problem...
Regard's
Johannes
|
|
|
|
|
josipahutar wrote: so can u give me a example about my problem...
This MFC tutorial gives a little bit of everything, even for newbies.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi,
The example is the CScribbleView class code for:
virtual void OnDraw(CDC* pDC);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
.
If you cannot study this code and understand how it is an answer to your question think of another kind of working area
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
hello guys... i got this small speech api sample and tried to compile but got this error.
error C2440: 'static_cast' : cannot convert from 'void (__thiscall CSpeechDlg::* )(void)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
This is where it takes me when hiting on the error.
ON_MESSAGE(WM_RECOEVENT,OnRecoEvent)
This is the function signature of OnRecoEvent
void CSpeechDlg::OnRecoEvent()
And this is what WM_RECOEVENT is..
#define WM_RECOEVENT WM_USER+5 // Window message used for recognition events
what should I do? thnx
modified on Monday, December 13, 2010 3:44 AM
|
|
|
|
|
Your OnRecoEvent() function is called in response to a Windows message so it must follow the rules as explained in the error message. That is to say, it takes a WPARAM and an LPARAM as input parameters and returns an LRESULT .
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
The prototype for an ON_MESSAGE invoked member-function should be
LRESULT(::*)(WPARAM, LPARAM)
and not
void(::*)()
as you did.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
Hi every one,
Have you ever saw minifilter driver source code in WinDDK examples?
I want to write a program like the user app that connects to driver but I want to make Win32 App with dialogs, ...
When I compile it, Free Build Environment reports errors.
for example this is a part of my code:
int WINAPI
WinMain (
__in HINSTANCE hInstance,
__in_opt HINSTANCE hPrevInstance,
__in LPSTR lpCmdLine,
__in int nCmdShow
)
{
DWORD requestCount = SCANNER_DEFAULT_REQUEST_COUNT;
DWORD threadCount = SCANNER_DEFAULT_THREAD_COUNT;
SCANNER_THREAD_CONTEXT context;
HANDLE port, completion;
PSCANNER_MESSAGE msg;
DWORD threadId;
HRESULT hr;
DWORD i, j;
HWND h;
hr = FilterConnectCommunicationPort( ScannerPortName,
0,
NULL,
0,
NULL,
port );
------------------------------------------------------------------------
And Free Build Environment reports:
BUILD: Compile and Link for x86
BUILD: Start time: Sun Dec 12 12:27:56 2010
BUILD: Examining d:\av-fsd2\test directory for files to compile.
d:\av-fsd2\test Invalidating OACR warning log for 'root:x86fre'
BUILD: Compiling and Linking d:\av-fsd2\test directory
Configuring OACR for 'root:x86fre' - <OACR on>
Compiling resources - resource.rc
Compiling - test.c
1>errors in directory d:\av-fsd2\test
1>d:\av-fsd2\test\test.c(277) : error C2220: warning treated as error - no 'obje
ct' file generated
Linking Executable - objfre_win7_x86\i386\test.exe
1>link : error LNK1181: cannot open input file 'd:\av-fsd2\test\objfre_win7_x86\
i386\test.obj'
BUILD: Finish time: Sun Dec 12 12:27:57 2010
BUILD: Done
4 files compiled - 5 Warnings - 1 Error
1 executable built - 1 Error
------------------------------------------------------------------------
And this is the content of sources file:
TARGETNAME=test
TARGETTYPE=PROGRAM
TARGET_DESTINATION=dbg\layout
USE_MSVCRT=1
MSC_WARNING_LEVEL=/W4 /WX
MUI=0
MUI_COMMENT=TO_COMMENT, old disabled, owners need to contact MUICore to get new comment and comment code
UMTYPE=windows
UMENTRY=winmain
UMBASE=0x1000000
!if $(_NT_TARGET_VERSION) != $(_NT_TARGET_VERSION_WS03)
# Use current headers (don't set _NT_TARGET_VERSION)
# Run downlevel to XP
SUBSYSTEM_VERSION=$(SUBSYSTEM_501)
!endif
C_DEFINES = $(C_DEFINES) -DUNICODE -D_UNICODE
INCLUDES=$(INCLUDES); \
$(IFSKIT_INC_PATH); \
$(DDK_INC_PATH); \
..\inc
TARGETLIBS=\
$(SDK_LIB_PATH)\kernel32.lib \
$(SDK_LIB_PATH)\user32.lib \
$(SDK_LIB_PATH)\gdi32.lib \
$(SDK_LIB_PATH)\comctl32.lib \
$(SDK_LIB_PATH)\cfgmgr32.lib \
$(SDK_LIB_PATH)\setupapi.lib
TARGETLIBS= $(TARGETLIBS) \
$(IFSKIT_LIB_PATH)\fltMgr.lib
SOURCES=test.c \
resource.rc
So does any body know how I can use windows user mode filtering functions in Win32 projects? (not in console mode)
Thanks
|
|
|
|
|
And what does row 277 in file d:\av-fsd2\test\test.c say? This is where the error occurs according to the output.
|
|
|
|
|
As you can see I said in the code block #1 (/*Line 277*/).
I mean that when I mix user mode filtering functions with Win32 Project it gives errors. for example in the dialog procedure.
|
|
|
|
|
Ok, sorry. What does it give without the /WX switch?
|
|
|
|
|
I think the problem does not belong to line 277 (declaration of HWND h) maybe it is due to the next line, means FilterConnectCommunicationPort calling.
I suggest please make a Win32 project and use functions like FilterConnectCommunicationPort or FilterGetMessage or FilterReplyMessage in the e.g. mail dialog procedure and finally compile it with WinDDK and tell me the result.
|
|
|
|
|
Hi all,
Is it possilbe to set socket connection timeout? For e.g. If I want to connect to some host with socket connection within 5 seconds if I cant connect within 5 seconds,function return from this point without process further operation.
I have checked socket class, apprently I cant find out some way for connection timeout ? Can anybody help me regarding this?
i m using this for socket connection
WSADATA wsaData;
if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0)
{
int i = WSAGetLastError();
}
sock = socket(AF_INET,SOCK_STREAM,0);
if(sock==-1)
{
int i = WSAGetLastError();
}
USES_CONVERSION;
struct sockaddr_in my_addr;
memset(&my_addr,0,sizeof(my_addr));
my_addr.sin_family = AF_INET;
my_addr.sin_port = htons(MYPORT);
LPSTR lpszAscii = T2A((LPTSTR)ServerName);
my_addr.sin_addr.s_addr = inet_addr(lpszAscii);
if (my_addr.sin_addr.s_addr == INADDR_NONE)
{
LPHOSTENT lphost;
lphost = gethostbyname(lpszAscii);
if (lphost != NULL)
{
my_addr.sin_addr.s_addr = ((LPIN_ADDR)lphost->h_addr)->s_addr;
}
else
{
WSASetLastError(WSAEINVAL);
return WSAEINVAL;
}
}
if(connect(sock,(struct sockaddr *)&my_addr,sizeof(struct sockaddr))==-1)
{
return FALSE;
}
please help me for this.
thanks in advance.
|
|
|
|
|
I use the fcntl(sock, F_SETFD, O_NONBLOCK);
to set the socket non-block after the socket has beed created.
you can get the system timer before create socket connection, then check if timeout when read once buffer.
If timeout return or throw TimneoutException.
|
|
|
|
|
yu-jian wrote: fcntl(sock, F_SETFD, O_NONBLOCK);
how can u use this.
this is not available in mfc vc++.
|
|
|
|
|
Hello, Im using a dialog based app (VC++ 6), with a main dialog and his child dialog (modals dialogs).
And i have to use a user defined message to send a message to the parent dialog. When i'm debugging, in the handler of this message (in the parent dialog) i get this exception in the return sentence "Unhandled exception in Myapp.exe (MFC42D.DLL):0xc0000005: Acces Violation
Parent dialog header, declaration of Handler:
.
.
afx_msg LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);
.
.
Parent dialog header, Declared Mesagge map:
.
.
afx_msg void OnMsjGuardarConfig();
.
.
Parent dialog source, file Message map:
.
.
ON_MESSAGE(WM_MsjGuardarConfig, OnMsjGuardarConfig)
.
.
Parent dialog source, file definition of the handler:
LRESULT CCalibracionDlg::OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam)
{
return 0;
}
Defining the user defined message in StdAfx.h:
.
.
#define WM_MsjGuardarConfig WM_USER+1 //
.
.
Posting the message in the child dialog:
void CConfiguracionDlg::OnBUTTONGuadar()
{
GetParent()->;PostMessage(WM_MsjGuardarConfig,NULL,NULL);
}
Probably is some newbie problem , but i can't fix it until now.
Thanks in advance!!
modified on Friday, December 10, 2010 10:25 AM
|
|
|
|
|
timbk wrote: //i do some stuffs
what are the stuffs you do there?
timbk wrote: afx_msg void OnMsjGuardarConfig();
what is this meant for, though it may not be the reason for your problem.?
|
|
|
|
|
Cool_Dev wrote: timbk wrote:
//i do some stuffs
what are the stuffs you do there?
At the moment nothing , all code inside es comented, so this is how it looks now:
LRESULT CCalibracionDlg::OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam)
{
return 0;
}
Cool_Dev wrote:
timbk wrote:
afx_msg void OnMsjGuardarConfig();
what is this meant for, though it may not be the reason for your problem.?
I'm not sure to understand very weel this question, but anyway , this piece of code that you quote is in the header file of parent dialog let say's MydialogDlg.h :
.
.
protected:
HICON m_hIcon;
.
.
afx_msg void OnSetfocusEditSens7();
afx_msg void OnSetfocusEditSens8();
afx_msg void OnConfiguracion();
afx_msg void OnMsjGuardarConfig();
.
.
DECLARE_MESSAGE_MAP()
|
|
|
|
|
timbk wrote: afx_msg void OnMsjGuardarConfig();
shouldn't that be :
LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);
Watched code never compiles.
|
|
|
|
|
Maximilien wrote: timbk wrote:
afx_msg void OnMsjGuardarConfig();
shouldn't that be :
LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);
Ok , I tried with this:
LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);
instead of
afx_msg LRESULT OnMsjGuardarConfig(WPARAM wParam, LPARAM lParam);
and besides :
afx_msg void OnMsjGuardarConfig();
instead of
afx_msg void OnMsjGuardarConfig();
Is this what you meant?
No erros compiling, but I get the same exception.
|
|
|
|
|
Use WM_APP + 1 instead of WM_USER + 1 .
|
|
|
|
|