|
Windows ME
Visual C++ 6.0
Hi!
I need to get/set the attibutes and date/time of directories.
I tried the win32 functions GetFileTime & SetFileTime. For this functions I need a handle to the directory.
HANDLE handle = CreateFile(
"C:\\TEMP",
GENERIC_READ, //for GetFileTime
0, //don't share
NULL, //no SECURITY_ATTRIBUTES
OPEN_EXISTING,
FILE_NORMAL, //also tried FILE_ATTRIBUTE_DIRECTORY
//and & FILE_FLAG_BACKUP_SEMANTICS
NULL);
I always get INVLID_HANDLE_VALUE, GetLastError returns 5.
How to get a handle in Win 95-98?
Thanx
|
|
|
|
|
Peppe wrote:
FILE_FLAG_BACKUP_SEMANTICS
Isn't that an NT-only flag?
If so, I believe you have to resort to the old DOS-ish INT 21h interface ("documented" in MSDN) - no promises that what you want to do is supported there though.
|
|
|
|
|
Hi,
since I'm not vey dedicated to GUI programming and it is in some cases necessary, I was seeking the way to make GUI in my applications faster, which I was writting directly through API, but not to use any RAD tool.
I started to learn MFC which is very (not to say hard ) opaque to me, maybe because I used to do programming in API directly or something else.
Friend of mine, suggested me to use WTL to make GUI faster, which is (in his opinion, I don have one yet ) much better in any aspect regarding MFC.
So, I've downloaded WTL 7.0 from MS site, but not to count add-in wizard in VC I don't know where to start from, for learning to do programming using this library. I've found one .chm file on this subject but it was corrupted, and nothing else.
So my question is, can anyone help to get start, firstly by informing me where can I find some good free documentation on this subject and a good tutorial to understand better WTL and to begin my programming very soon independantly.
Thanks.
|
|
|
|
|
try this :
http://perso.wanadoo.fr/laurent.kempe/technical/wtl/
|
|
|
|
|
When the dialog's OnInitDialog() function is called I spawn a new thread to copy a bunch of files to the drive. When the new thread is finished copying the files to the drive I want it to close itself. I made a pointer the the current dialog, and when I use it in win98 it works fine. In Win2K it says that the program created errors.
Is there a different way to close a dialog from a separate thread?
SAVAGE KEN
|
|
|
|
|
Post a message from the worker thread to the dialog (IDs starting at WM_APP are reserved for apps to use as message IDs, so use WM_APP ). When the dialog receives that message, it can call EndDialog() or DestroyWindow() depending on whether it's modal or modeless.
--Mike--
Looks like I picked the wrong week to stop sniffing glue.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
How can I cast the fccHandler from an Avi to a four character code/string?
|
|
|
|
|
If you've got a DWORD 'DIV3' (or whatever) you can't just cast it. To get a C zero terminated string you also need a terminating null.
Depending on host byte order you could even get away with
char sz[5];
*(long*)sz = *fccHandler;
sz[5] = '\0';
but the only portable solution is to extract the bytes one by one from the DWORD, add them to an (at least) 5 chars large char array, and end it with a zero char.
|
|
|
|
|
Thanks and forgive me for sounding stupid but there are wide gaps in my c++ knowledge so I will ask you another question. MSDN states DWORD to be 32 bit unsigned int. How exactly would I go about extracting bytes from a DWORD? Would I treat it like say an array and use a for loop: eg:
for (int iLoop = 0; iLoop < 4; iLoop++)
sz[iLoop] = fccHandle[iLoop];
In fact now that I think about it my knowledge of working with bits is actually also zero, something I've been avoiding but now it's time to learn. Can you suggest a book or a good tutorial on bit manipulation? Thanks again.
|
|
|
|
|
georgiek50 wrote:
you suggest a book or a good tutorial on bit manipulation?
If I'm not completely mistaken there's an article on this very subject right here at CP. I can't remember neither the name of the article, nor the author though. Maybe someone else remembers? In the meantime you might try browsing the articles.
|
|
|
|
|
|
|
I currently have a tree set up and when you the selction is changed it opens a dialog that corresponds with what you clicked. How can I make it so it opens when you double click an object and it doesn't necessarily have to have changed? (Example I click "General" and then I close it but I want to open "General" again without changing back and forth)
EDIT: Nevermind. I found it
|
|
|
|
|
Handle the NM_DBLCLK notification.
--Mike--
Looks like I picked the wrong week to stop sniffing glue.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi, I've got stuck on a problem with the Java Native Interface, wondering if anyone has a solution to this one! I'm trying to use JNI to allow my project to start up the JVM then do some simple method calls for a pluggable interface I'm making. I've got the code to compile, but have run into a number of problems:
Firstly if I load it simply it gives "Unable to Locate Component" claiming that it is missing jvm.dll. I've included the directoy jvm.dll is in in both the PATH environment variable and in the VC++ directory for executables, neither approach seems to work.
I can get it to load if I simply put the jvm.dll in the folder with the executable, but at this point JNI_CreateJavaVM consistently fails to load. All the paths have been set directly, rather than using variable references to them. I would ideally like this application to run on any system with a JVM installed, but at the moment its not looking likely! By the way, I'm using the SDK1.4.1.
Thanks,
James
|
|
|
|
|
Is there a good resourcece anywhere on Threading and MFC Classes? (Google hasn't found anything.
My question is why does it crash when I try to call GetFiles? (Its locked within a critical section.
CString CBookmarks::GetXML(CString sTag, CString eTag, CString m_Content)
{
int nStart, nEnd=0;
nStart=m_Content.Find(sTag,0);
nEnd=m_Content.Find(eTag,nStart);
nStart+=sTag.GetLength();
return m_Content.Mid(nStart, nEnd-nStart);
}
DWORD CBookmarks::BKOrg_ThreadStub(DWORD arg)
{
return ((CBookmarks*)arg)->BKOrg_Thread();
}
DWORD CBookmarks::BKOrg_Thread()
{
CString m_strOutput;
::MessageBox(GetSafeHwnd(),"Lockdown","Thread",MB_OK);
m_Sync.Lock();
m_strOutput=bBks.GetFiles(m_strStr_Websites[0]);
m_Sync.Unlock();
::MessageBox(GetSafeHwnd(),"Ended"+m_strOutput,"Thread",MB_OK);
AfxEndThread(0);
return 0;
}
void CBookmarks::StartBKOrg_Thread(void )
{
pThread=AfxBeginThread((AFX_THREADPROC)&BKOrg_ThreadStub,(void*)this);
}
//Get Keywords from bookmarked sites
//Date: 1 19 03
CString CBookmarks::GetFiles(CString URL)
{
//Define Varibles
//Date: 11 23 02
CInternetSession GetFile_Session("404Browser: Retrieving Keyword Info. NOTE: This info comes from the meta tags.");
CStdioFile *remotefile;
CFile* pFile=NULL;
CString fContents, remoteFilecont;
#define HTTPBUFLEN 512
char httpbuff[HTTPBUFLEN];
int numbytes;
//
TRY
{
remotefile=GetFile_Session.OpenURL(URL, 1,
INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_RELOAD);
while (numbytes = remotefile->Read(httpbuff, HTTPBUFLEN))
{
remoteFilecont.Format("%s",httpbuff);
fContents+=remoteFilecont.Mid(0,numbytes);
if (fContents.GetLength()>=2048)
break;
}
}
CATCH(CInternetException, iEx)
{
iEx->ReportError();
}
AND_CATCH(CMemoryException, mEx)
{
AfxAbort();
}
END_CATCH;
if (pFile!=NULL)
{
pFile->Close();
delete pFile;
}
fContents.MakeLower();
//Get Head
//Date: 1 19 03
if ( (fContents.Find("",0)!=-1) && (fContents.Find("",0)!=-1))
fContents=GetXML("","",fContents);
//Get Keywords
//
//Date: 1 19 03
fContents=GetXML("name=\"keywords\"","\" ",fContents);
fContents=GetXML("content=\"","\">",fContents);
//
return fContents;
}
//
-Steven
CP Addict
By reading this message you are held fully responsible for any of the mispelln's or grammer, issues, found on, codeproject.com.
For those who were wondering, actual (Linux) Penguins were harmed in creating this message.
|
|
|
|
|
Steven Hicks wrote:
m_strOutput=bBks.GetFiles(m_strStr_Websites[0]);
What us bBks, where is it initialized, is it valid? CBookmarks::BKOrg_Thread() has a 'this' ptr, why isn't it just being used. ie, If bBks is pointing to a different instance of CBookmarks you are treading on thin ice. Also is the critical section a static member of CBookmarks? And have you tried the obvious thing, stepping through the code with the debugger?
And finally old stle C casts shouldn't be used these days: ((CBookmarks*)arg)->
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Neville Franks wrote:
bBks
Its CBookmarks bBks, i thought that the tread couldn't see outside the function.. (stupid me). The code works without being in a thread.
-Steven
CP Addict
By reading this message you are held fully responsible for any of the mispelln's or grammer, issues, found on, codeproject.com.
For those who were wondering, actual (Linux) Penguins were harmed in creating this message.
|
|
|
|
|
Steven Hicks wrote:
Neville Franks wrote:
bBks
Its CBookmarks bBks, ..
I have no idea what this means.
I have similar code in a thread and it works just fine.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
my control is a draw self button.
|
|
|
|
|
Er, I feel a little stupid asking this. I just installed Dundas Ultimate Toolbox, as well as the integrated VS.NET help.
I ran VS.NET but it hasn't added any new App Wiz templates for me? Am I missing something here, or do I have to manually include Dundas headers, Dundas libs etc... ? If so where is the getting-starting documentation? I have no idea what to include right now
Thanks,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
I installed Dundas Ultimate Toolbox 6 on my machine. It has no Application Wizard. For this reason, I add every header/implementation file (.h, .cpp) to my project. Refer to Dundas UT Help file for knowning which .h/.cpp you must add to your project.
A. Riazi
|
|
|
|
|
|
Hello Nish,
The Ultimate Toolbox does not come any AppWizards because we have found that in most cases our clients typically add our tools to their project after the AppWizards are used to create the application or when upgrading existing projects. As result creating AppWizards (although a great idea) was never a priority for Dundas Software.
The easiest way to work with Ultimate Toolbox is to build it into a DLL, link your application to it, and then only include the header files that you need.
Peter
|
|
|
|
|
|