|
You can try this http://msdn.microsoft.com/en-us/library/ms744829.aspx i tried this and succeed some time ago.
|
|
|
|
|
Hello,
I am trying to create a program that will allow me to copy all the files from one directory to another with the click of a button and then compare those files to the files in the directory they were copied from in the future. I have the program built and working but all I have is a way to move just one file at a time. Thanks to all for any help
Arnold.
|
|
|
|
|
ajj100 wrote: ...but all I have is a way to move just one file at a time.
Are you using SHFileOperation() ?
"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
|
|
|
|
|
No. I am useing the MoveFile();
|
|
|
|
|
ajj100 wrote: I am useing the MoveFile();
So what do you expect to compare with in the future? MoveFile() does not leave the original file in place.
I must get a clever new signature for 2011.
|
|
|
|
|
Hello all,
Correction I was useing CopyFile() not MoveFile() sorry. I did use SHFileOperation() and it works perfectly. Now I am working on the compare function. I want to check for added files to the directory and list the added file in a listbox then check for changes made to any file in the directory.
Thanks for all help,
AJ
|
|
|
|
|
ajj100 wrote: I want to check for added files to the directory and list the added file in a listbox then check for changes made to any file in the directory.
Check out FindFirstChangeNotification() and/or ReadDirectoryChangesW() .
"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
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
I want to compare file size and check for new files added to the directory.
|
|
|
|
|
Got a problem.
Why does this work lpFileOp.pFrom = "C:\\Test\\*.*";
In SHFileOperation()
but this don't? m_sFileEdit = "C:\\Test\\*.*"; I am UpdateData(true);
and UpdateData(false); as required.
|
|
|
|
|
You are comparing two unrelated things. SHFileOperation() does not use m_sFileEdit , so assigning it a value is meaningless.
ajj100 wrote: I am UpdateData(true);
and UpdateData(false); as required.
See here for why you should rarely, if ever, call this method directly.
"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
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
ajj100 wrote: compare those files to the files in the directory
Compare what ? the size ? date created/modified ? what is inside ?
As David wrote, use ShFileOperation (with the appropriate parameters) and check the error code returned to help you there.
you can also use FindFirstFile/FindNextFile to search the file in the destination folder to see if the file is there and if it exists, then do any kind of comparision between the two.
M.
Watched code never compiles.
|
|
|
|
|
Hello,
I'm currently migrating projects from VC6 to VS10 and encountered
a problem using template classes with friend template functions.
The following example was reduced to the minimum to reproduce
the problem. The code compiles without errors/warnings in VC6:
------------------- 8< --------------------------------
#include <StdAfx.h>
#include <string>
using namespace std;
class factory;
class attribute {
protected:
attribute(const string & table, const string & column, factory * fac);
attribute(const attribute & attr);
};
template <typename T, typename P>
class attributeimpl : public attribute {
friend class attribute * MakeAttribute(
const string & table,
const string & column,
factory * fac,
T P::* member
);
typedef T P::* member_t;
member_t m_Value;
protected:
attributeimpl(const string & table, const string & column, factory * fac, member_t mem)
: attribute(table, column, fac)
, m_Value(mem)
{
}
attributeimpl(const attributeimpl<T,P> & attr);
};
template <typename T, typename P> inline
attribute * MakeAttribute(
const string & table,
const string & column,
factory * fac,
T P::* member) {
return (attribute*)(new attributeimpl<T, P> (table, column, fac, member));
}
#define BindVar(CLASS,MEMBER,TABNAME,COLNAME) \
MakeAttribute(TABNAME, COLNAME, this, &CLASS::MEMBER)
class factory {
protected:
factory();
};
class object {
protected:
object();
};
class myobj : public object {
friend class myfac;
string m_name;
string m_surname;
};
class myfac : public factory {
attribute * name;
attribute * surname;
public:
myfac();
};
myfac::myfac() {
name = BindVar(myobj, m_name, "customer", "name");
vorname = BindVar(myobj, m_surname, "customer", "surname");
}
------------------- 8< --------------------------------
VS10 produces the following errors:
------------------- 8< --------------------------------
1>templ.cpp(44): error C2248: 'attributeimpl<t,p>::attributeimpl' : cannot access protected member declared in class 'attributeimpl<t,p>'
1> with
1> [
1> T=std::string,
1> P=myobj
1> ]
1> templ.cpp(28) : see declaration of 'attributeimpl<t,p>::attributeimpl'
1> with
1> [
1> T=std::string,
1> P=myobj
1> ]
1> templ.cpp(85) : see reference to function template instantiation 'attribute *MakeAttribute<std::string,myobj>(const std::string &,const std::string &,factory *,T myobj::* )' being compiled
1> with
1> [
1> T=std::string
1> ]
1>
1>Build FAILED.
------------------- 8< --------------------------------
AFAIK I don't need to explicitly declare a friend function. The compiler
should take the "friend" declaration to declare the function in the next
outer scope that is not a class (in the example this is the global scope).
But even if I explicitly declare the function "MakeAttribute()" in
the global scope and reference the friend declaration to ::, the compiler
gives me errors. In such a case VS10 says it cannot deduce the template
parameters T and P of "MakeAttribute()".
At this point I'm totally clueless... :-|
So how do I have to declare the friend function?
Jörg
|
|
|
|
|
Joerg Koenig wrote:
friend class attribute * MakeAttribute(
const string & table,
const string & column,
factory * fac,
T P::* member
Two things look wrong or suspicious:
Remove "class" after "friend"
What does "T P::* memeber" mean? You might need to add typename in there somewhere.
Also check out this FAQ[^]
--Mike--
Dunder-Mifflin, this is Pam.
|
|
|
|
|
Joerg Koenig wrote: friend class attribute * MakeAttribute(
const string & table,
const string & column,
factory * fac,
T P::* member
);
I think the correct declaration (inside attributeimpl class) should be:
template <typename T, typename P>
friend attribute * MakeAttribute(
const string & table,
const string & column,
factory * fac,
T P::* member
);
However, the modified code has still troubles with the linker, on my VS 2010.
BTW: did the code author contributed to ATL ?
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]
|
|
|
|
|
CPallini wrote: BTW: did the code author contributed to ATL?
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
CPallini wrote: I think the correct declaration (inside attributeimpl class) should be:
template <typename t,="" typename="" p="">
friend attribute * MakeAttribute(
const string & table,
const string & column,
factory * fac,
T P::* member
);
However, the modified code has still troubles with the linker, on my VS 2010.
The example was not made to link correctly.
Anyway - your suggestion solved the problem.
I always believed that the compiler uses the template parameters from the class where the friend was declared in, but I was obviously wrong...
CPallini wrote: BTW: did the code author contributed to ATL?
Sure not
The whole library was written in plain C++ with STL.
Many thanks for the help!
|
|
|
|
|
In CMyApp::InitInstance
SwfWnd * w = new SwfWnd;
SwfWnd->Create(...);
MSG msg;
While(GetMessage(&msg, SwfWnd->GetHWnd, 0, 0))
{
TranlateMessage(&msg);
Dispatch(&msg);
}
SwfWnd * w = new SwfWnd;
SwfWnd->Create(...);
COtherDlg dlg;
dlg.DoModal();
Any way to make the 1st version work?
|
|
|
|
|
Did you assign the address of the control to the m_pMainWnd member of the CWinApp object before running the message loop ?
Push Framework - now released !
http://www.pushframework.com
|
|
|
|
|
tried, but still not work
if popup the context menu, it plays
|
|
|
|
|
Hi,
i have created a dialog based application in vc 8 for excel automation .
#import \
".\MSO.DLL" \
rename("DocumentProperties","DocumentPropertiesXL") \
rename("RGB", "RGBXL")
#import \
".\VBE6EXT.OLB"
#import ".\EXCEL.EXE" \
rename("DialogBox", "DialogBoxXL") rename("RGB", "RGBXL") \
rename("DocumentProperties", "DocumentPropertiesXL") \
rename("ReplaceText","ReplaceTextXL") \
rename("CopyFile","CopyFileXL") \
exclude("IFont","IPicture") no_dual_interfaces
When i m using the wrapper class, i m getting the following errors.
1>------ Build started: Project: Test_excel, Configuration: Release Win32 ------
1>Compiling...
1>StdAfx.cpp
1>e:\my projects\test_excel\release\mso.tlh(19948) : error C2059: syntax error : 'constant'
1>e:\my projects\test_excel\release\mso.tlh(19948) : error C2238: unexpected token(s) preceding ';'
1>e:\my projects\test_excel\release\mso.tlh(20352) : error C2059: syntax error : 'constant'
1>e:\my projects\test_excel\release\mso.tlh(20352) : error C2238: unexpected token(s) preceding ';'
1>e:\my projects\test_excel\release\mso.tlh(25155) : error C2589: 'constant' : illegal token on right side of '::'
1>e:\my projects\test_excel\release\mso.tlh(25155) : warning C4091: '' : ignored on left of 'long' when no variable is declared
1>e:\my projects\test_excel\release\mso.tlh(25155) : error C2143: syntax error : missing ';' before '::'
1>e:\my projects\test_excel\release\mso.tlh(25155) : error C2059: syntax error : '::'
1>e:\my projects\test_excel\release\mso.tlh(25242) : error C2589: 'constant' : illegal token on right side of '::'
1>e:\my projects\test_excel\release\mso.tlh(25242) : warning C4091: '' : ignored on left of 'long' when no variable is declared
1>e:\my projects\test_excel\release\mso.tlh(25242) : error C2143: syntax error : missing ';' before '::'
1>e:\my projects\test_excel\release\mso.tlh(25242) : error C2059: syntax error : '::'
1>e:\my projects\test_excel\release\excel.tlh(29621) : error C2059: syntax error : 'constant'
1>e:\my projects\test_excel\release\excel.tlh(29621) : error C2238: unexpected token(s) preceding ';'
1>e:\my projects\test_excel\release\excel.tlh(30002) : error C2059: syntax error : 'constant'
1>e:\my projects\test_excel\release\excel.tlh(30002) : error C2238: unexpected token(s) preceding ';'
1>e:\my projects\test_excel\release\excel.tlh(35825) : error C2059: syntax error : 'constant'
1>e:\my projects\test_excel\release\excel.tlh(35825) : error C2238: unexpected token(s) preceding ';'
1>e:\my projects\test_excel\release\excel.tlh(74947) : error C2059: syntax error : 'constant'
1>e:\my projects\test_excel\release\excel.tlh(74947) : error C2238: unexpected token(s) preceding ';'
1>e:\my projects\test_excel\release\excel.tlh(76532) : error C2059: syntax error : 'constant'
1>e:\my projects\test_excel\release\excel.tlh(76532) : error C2238: unexpected token(s) preceding ';'
1>e:\my projects\test_excel\release\excel.tlh(76979) : error C2059: syntax error : 'constant'
1>e:\my projects\test_excel\release\excel.tlh(76979) : error C2238: unexpected token(s) preceding ';'
1>e:\my projects\test_excel\release\excel.tlh(86803) : error C2589: 'constant' : illegal token on right side of '::'
1>e:\my projects\test_excel\release\excel.tlh(86803) : warning C4091: '' : ignored on left of 'long' when no variable is declared
1>e:\my projects\test_excel\release\excel.tlh(86803) : error C2143: syntax error : missing ';' before '::'
1>e:\my projects\test_excel\release\excel.tlh(86803) : error C2059: syntax error : '::'
1>e:\my projects\test_excel\release\excel.tlh(86932) : error C2589: 'constant' : illegal token on right side of '::'
1>e:\my projects\test_excel\release\excel.tlh(86932) : warning C4091: '' : ignored on left of 'long' when no variable is declared
1>e:\my projects\test_excel\release\excel.tlh(86932) : error C2143: syntax error : missing ';' before '::'
1>e:\my projects\test_excel\release\excel.tlh(86932) : error C2059: syntax error : '::'
1>e:\my projects\test_excel\release\excel.tlh(88372) : error C2589: 'constant' : illegal token on right side of '::'
1>e:\my projects\test_excel\release\excel.tlh(88372) : warning C4091: '' : ignored on left of 'long' when no variable is declared
1>e:\my projects\test_excel\release\excel.tlh(88372) : error C2143: syntax error : missing ';' before '::'
1>e:\my projects\test_excel\release\excel.tlh(88372) : error C2059: syntax error : '::'
1>e:\my projects\test_excel\release\excel.tlh(94797) : error C2589: 'constant' : illegal token on right side of '::'
1>e:\my projects\test_excel\release\excel.tlh(94797) : warning C4091: '' : ignored on left of 'long' when no variable is declared
1>e:\my projects\test_excel\release\excel.tlh(94797) : error C2143: syntax error : missing ';' before '::'
1>e:\my projects\test_excel\release\excel.tlh(94797) : error C2059: syntax error : '::'
1>e:\my projects\test_excel\release\excel.tlh(95039) : error C2589: 'constant' : illegal token on right side of '::'
1>e:\my projects\test_excel\release\excel.tlh(95039) : warning C4091: '' : ignored on left of 'long' when no variable is declared
1>e:\my projects\test_excel\release\excel.tlh(95039) : error C2143: syntax error : missing ';' before '::'
1>e:\my projects\test_excel\release\excel.tlh(95039) : error C2059: syntax error : '::'
1>e:\my projects\test_excel\release\excel.tlh(95143) : error C2589: 'constant' : illegal token on right side of '::'
1>e:\my projects\test_excel\release\excel.tlh(95143) : warning C4091: '' : ignored on left of 'long' when no variable is declared
1>e:\my projects\test_excel\release\excel.tlh(95143) : error C2143: syntax error : missing ';' before '::'
1>e:\my projects\test_excel\release\excel.tlh(95143) : error C2059: syntax error : '::'
1>Build Time 0:03
1>Build log was saved at "file://e:\My Projects\Test_excel\Release\BuildLog.htm"
1>Test_excel - 40 error(s), 8 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
How to correct these errors?
please help me for this.
Thanks in advance,
|
|
|
|
|
Check file e:\my projects\test_excel\release\mso.tlh on line 19948. There is something there the compiler doesn't understand.
|
|
|
|
|
I am trying to use ITextHost(see http://support.microsoft.com/kb/270161/).
dwStyle = ES_MULTILINE;<br />
fHidden = TRUE;<br />
<br />
fRich = FALSE;<br />
The problem is, when the bottom line is empty the vert scrollbar can not scroll to bottom
is there way to accomplish this?
Thanks in advance!
tangwang han
66
|
|
|
|
|
hello guys... I need to get the file path of the current document that im using. For example if I am using MyMainClass.cpp as the current document in VS 2008 then I want to get the full file path of the current document and print in console app. Using google I got to GetModuleFileName() but dont know whether it is the right function or not.
modified on Monday, February 21, 2011 1:17 PM
|
|
|
|
|
Your question is not clear. Do you want to get the path of the source module you have open in Visual Studio? Then GetModuleFileName() won't do it. That will get you the full path of the running executable.
|
|
|
|
|
overloaded Name wrote: hello guys... I need to get the file path of the current document that im using.
Check out CDocument::GetPathName() .
"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
|
|
|
|
|