Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / importing c# dll

Author
Message
frstPrsn
18
Years of Service
User Offline
Joined: 13th Apr 2006
Location:
Posted: 25th Sep 2007 23:08
I maybe a little bit new to this but with dgdk, how do you import a dll created in C#.net? If anyone can point me to the right direction, it is much appreciated.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 26th Sep 2007 01:47 Edited at: 26th Sep 2007 01:48
If you enable the /CLR option under your C++ project properties, you can then use managed/unmanaged C++ extensions for pulling in C# exposed classes. This is normally done by declaring:



at the top of your C++ source files, and then use the managed method of creating .NET objects:


This is off the top of my head so you may need to investigate it further, but this is how it's usually done.

[EDIT] Don't forget to reference your C# class library DLL as well, otherwise your C++ project won't know what the hell you're referring to

Paul.

frstPrsn
18
Years of Service
User Offline
Joined: 13th Apr 2006
Location:
Posted: 1st Oct 2007 19:47 Edited at: 1st Oct 2007 20:35
Ahh that '^' character is one of my errors, thank you.

Another problem that I am having is that I'm trying to get a file date and I'm having trouble with it. Is this the right way of doing it?



when I go through it, it seems like it is not getting any file names.


Edit:
Oopse my mistake, I forgot to add dbFindFirst()
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 2nd Oct 2007 00:58
(I hate writing those directory parsers... I've made some good recursive ones in other languages - but they are usually a pain)

frstPrsn
18
Years of Service
User Offline
Joined: 13th Apr 2006
Location:
Posted: 4th Oct 2007 22:56 Edited at: 4th Oct 2007 23:31
Is there a db command to get the file creation date of a file?

[edit]
sorry what I meant was the file creation time. Or can you guys give me a clue as to how to determine if a file is new within 24 hours?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 5th Oct 2007 01:12 Edited at: 5th Oct 2007 01:13
@frstPrsn - I saw your post - then rescanned the rest of the thread above - and saw your code snippet - and basically you can do the same thing with the Windows API.

Quote: "
The GetFileAttributes function returns attributes for a specified file or directory.

DWORD GetFileAttributes(

LPCTSTR lpFileName // address of the name of a file or directory
);
Parameters

lpFileName

Points to a null-terminated string that specifies the name of a file or directory.

Windows NT

There is a default string size limit for paths of MAX_PATH characters. This limit is related to how the GetFileAttributes function parses paths. An application can transcend this limit and send in paths longer than MAX_PATH characters by calling the wide (W) version of GetFileAttributes and prepending "\?" to the path. The "
\?" tells the function to turn off path parsing; it lets paths longer than MAX_PATH be used with GetFileAttributesW. This also works with UNC names. The "\?" is ignored as part of the path. For example, "\?C:myworldprivate" is seen as "C:myworldprivate", and "\?UNCbill_g_1hotstuffcoolapps" is seen as "\
bill_g_1hotstuffcoolapps".

Windows 95

The lpFileName string must not exceed MAX_PATH characters. Windows 95 does not support the "\?" prefix.

Return Value

If the function succeeds, the return value contains the attributes of the specified file or directory.
If the function fails, the return value is 0xFFFFFFFF. To get extended error information, call GetLastError.
The attributes can be one or more of the following values:

Value Meaning
FILE_ATTRIBUTE_ARCHIVE The file or directory is an archive file or directory. Applications use this flag to mark files for backup or removal.
FILE_ATTRIBUTE_COMPRESSED The file or directory is compressed. For a file, this means that all of the data in the file is compressed. For a directory, this means that compression is the default for newly created files and subdirectories.
FILE_ATTRIBUTE_DIRECTORY The "file or directory" is a directory.
FILE_ATTRIBUTE_HIDDEN The file or directory is hidden. It is not included in an ordinary directory listing.
FILE_ATTRIBUTE_NORMAL The file or directory has no other attributes set. This attribute is valid only if used alone.
FILE_ATTRIBUTE_READONLY The file or directory is read-only. Applications can read the file but cannot write to it or delete it. In the case of a directory, applications cannot delete it.
FILE_ATTRIBUTE_SYSTEM The file or directory is part of, or is used exclusively by, the operating system.
See Also

DeviceIOControl, FindFirstFile, FindNextFile, SetFileAttributes "


If you need a reference manual for win32 I can probably help - email me.
[edit] Point is this snippet from help shows alot of the same "kinds" of calls you're doing in DarkGDK.[/edit]

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 5th Oct 2007 01:13
Quote: "
The GetFileTime function retrieves the date and time that a file was created, last accessed, and last modified.

BOOL GetFileTime(

HANDLE hFile, // identifies the file
LPFILETIME lpCreationTime, // address of creation time
LPFILETIME lpLastAccessTime, // address of last access time
LPFILETIME lpLastWriteTime // address of last write time
);
Parameters

hFile

Identifies the files for which to get dates and times. The file handle must have been created with GENERIC_READ access to the file.

lpCreationTime

Points to a FILETIME structure to receive the date and time the file was created. This parameter can be NULL if the application does not require this information.


lpLastAccessTime

Points to a FILETIME structure to receive the date and time the file was last accessed. The last access time includes the last time the file was written to, read from, or, in the case of executable files, run. This parameter can be NULL if the application does not require this information.

lpLastWriteTime

Points to a FILETIME structure to receive the date and time the file was last written to. This parameter can be NULL if the application does not require this information.

Return Value

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE. To get extended error information, call GetLastError.

Remarks

The FAT, NTFS, and HPFS file systems all support the file creation, last access, and last write time values.
Windows 95: The precision of the time for a file in a FAT file system is 2 seconds. The time precision for files in other file systems, such as those connected through a network depends on the file system but may also be limited by the remote device.

See Also

FILETIME, GetFileSize, GetFileType, SetFileTime
"


frstPrsn
18
Years of Service
User Offline
Joined: 13th Apr 2006
Location:
Posted: 6th Oct 2007 01:33
Cool, thanks!! I did not have enough time to implement checking file date and creation so I ended up just having a document id that increments every time it is created; so that's how I check if the file is new or not. Although, the information that you gave me is very important so thanks. I knew there is a way to check it using win32 I just could not find it.

Login to post a reply

Server time is: 2024-09-29 03:15:38
Your offset time is: 2024-09-29 03:15:38