Search found 117 matches

by newbieforever
Feb 17, 2019 20:07
Forum: Beginners
Topic: How to convert String (or Double) to SerialNumber
Replies: 11
Views: 2487

Re: How to convert String (or Double) to SerialNumber

Thank you, fxm! Function Str2SerNum(ss As String) As Double Dim As Integer ye = Val(Mid(ss, 1, 4)) Dim As Integer mo = Val(Mid(ss, 5, 2)) Dim As Integer da = Val(Mid(ss, 7, 2)) Dim As Integer ho = Val(Mid(ss, 9, 2)) Dim As Integer mi = Val(Mid(ss, 11, 2)) Dim As Integer se = Val(Mid(ss, 13, 2)) Dim ...
by newbieforever
Feb 17, 2019 13:28
Forum: Beginners
Topic: How to convert String (or Double) to SerialNumber
Replies: 11
Views: 2487

How to convert String (or Double) to SerialNumber

Hi!

If tst0 is a timestamp of a file, e.g. 20190217142630, defined as String (or as Double), how to convert it to tst as SerialNumber?
by newbieforever
Feb 15, 2019 14:02
Forum: Beginners
Topic: FileDateTime() for Unicode
Replies: 14
Views: 3207

Re: FileDateTime() for Unicode

Thanks, Josep...such a stupid typo... This seems to be the final result of my request, which is transparent enogh to me as a newbie. Or are there suggestions to write the two functions more elegant? Thanks to all here for your extraordinary help!!! #Include once "windows.bi" #Include once ...
by newbieforever
Feb 15, 2019 12:50
Forum: Beginners
Topic: FileDateTime() for Unicode
Replies: 14
Views: 3207

Re: FileDateTime() for Unicode

Hi! This is "nearly perfect": Both GetFileTimeW() and SetFileTimeW() (using Windows functions GetFileTime() and SetFileTime()) are working, but SetFileTime fails if the file name contains Unicode characters. WHY??? #Include once "windows.bi" #Include once "vbcompat.bi" ...
by newbieforever
Feb 14, 2019 14:30
Forum: Beginners
Topic: FileDateTime() for Unicode
Replies: 14
Views: 3207

Re: FileDateTime() for Unicode

Thanks to all! This is another solution, a code adapted (by me) from a very old posting. It uses the Windows function GetFileTime(). BOOL GetFileTime( HANDLE hFile, LPFILETIME lpCreationTime, LPFILETIME lpLastAccessTime, LPFILETIME lpLastWriteTime ); And it works perfectly. #Include once "windo...
by newbieforever
Feb 11, 2019 23:28
Forum: Beginners
Topic: FileDateTime() for Unicode
Replies: 14
Views: 3207

Re: FileDateTime() for Unicode

Thank you, dodicat. I see now that there would be a way to get the file's timestamp, but to implement a solution to set e.g. the last modification time would be beyond my possibilities...
by newbieforever
Feb 11, 2019 10:35
Forum: Beginners
Topic: FileDateTime() for Unicode
Replies: 14
Views: 3207

FileDateTime() for Unicode

Hi! A new newbie question: There is a FileDateTime() function in file.bi and vbcompat.bi. Is there an equivalent function supporting file names containing Unicode characters (Windows)? (I suppose it's pointless to ask if there is a function to set the file modification date...) EDITED: In the course...
by newbieforever
Jan 25, 2019 13:05
Forum: Beginners
Topic: ShellExecuteW() (does a folder exist?)
Replies: 4
Views: 1396

Re: ShellExecuteW() (does a folder exist?)

OK, I understand, thank you verry much, jj2007. Btw: windows.bi includes the function GetFileAttributes() , which returns 16 for an existing folder. And (what a surprise!) this function seems to support Unicode!!! This seems to be the simpliest way... So long! #Define Unicode #Include once "win...
by newbieforever
Jan 25, 2019 11:40
Forum: Beginners
Topic: ShellExecuteW() (does a folder exist?)
Replies: 4
Views: 1396

ShellExecuteW() (does a folder exist?)

Hi!

I am unable to find out whether ShellExecuteW() returns a usable value.
I would be interested to get the echo of a DOS command, but this probably will be impossible...

So long!

Code: Select all

ShellExecuteW(0, "open", "cmd.exe", "if exist aSubFolder echo yes", 0, SW_HIDE)
by newbieforever
Jan 23, 2019 23:01
Forum: Beginners
Topic: How to add null characters?
Replies: 9
Views: 1886

Re: How to add null characters?

Yessss, that's it!!!

So long!
by newbieforever
Jan 23, 2019 22:48
Forum: Beginners
Topic: How to add null characters?
Replies: 9
Views: 1886

Re: How to add null characters?

Btw: Can this be shortened (for a larger number of null characters)?
rpl = rpl + chr(0) + chr(0) + ...
by newbieforever
Jan 23, 2019 22:36
Forum: Beginners
Topic: How to add null characters?
Replies: 9
Views: 1886

Re: How to add zero characters?

Sorry...sorry...sorry... I reduced my code to a too simplified example. Your answer, badidea, showed me that I located my error in the wrong place. Of course, this is working fine, and I discovered now my error.

Thank you both, badidea & dodicat, for your helpful hints!!!
by newbieforever
Jan 23, 2019 19:53
Forum: Beginners
Topic: How to add null characters?
Replies: 9
Views: 1886

How to add null characters?

Another newbie question: I have a string of bytes (data read from a binary file by LoadFile()) in which I have to replace a substring by another string. This other string, rpl, is shorter than the substring, and should be extended to the length of the substring by adding a number of null characters ...
by newbieforever
Jan 21, 2019 17:57
Forum: Beginners
Topic: FileExists() and FileCopy() supporting Unicode file names
Replies: 7
Views: 1709

Re: FileExists() and FileCopy() supporting Unicode file names

OK, I will test later too. An additional question: With #Define unicode #Include once "windows.bi" #Include once "win/shellapi.bi" Unicode-supporting functions LoadFile() and SaveFile() (and ShellExecuteW()) are provided. As I have now discovered, also DeleteFile() is included. A...
by newbieforever
Jan 20, 2019 23:02
Forum: Beginners
Topic: FileExists() and FileCopy() supporting Unicode file names
Replies: 7
Views: 1709

FileExists() and FileCopy() supporting Unicode file names

These functions (included in file.bi) seems not to work with file names containing non-ASCII characters.

Where functions can be found which would support file names like "Сергeй.txt"?