Search found 22 matches

by Poltergeist
Tue Sep 14, 2021 3:03 pm
Forum: Coding Questions
Topic: error available from cmd prompt, but not in PureBasic
Replies: 4
Views: 1144

Re: error available from cmd prompt, but not in PureBasic

You are so right. Thank you for the insight!
by Poltergeist
Tue Sep 14, 2021 10:36 am
Forum: Coding Questions
Topic: error available from cmd prompt, but not in PureBasic
Replies: 4
Views: 1144

Re: error available from cmd prompt, but not in PureBasic

Can I answer my own question? Ter Leering ende vermaeck, as we say in dutch:

It was solved by placing the line

Code: Select all

error.s=ReadProgramError(cmail)
after the while-wend loop...

Isn't that strange? I thought ReadProgramError only works if ProgramRunning <> 0
by Poltergeist
Tue Sep 14, 2021 10:23 am
Forum: Coding Questions
Topic: error available from cmd prompt, but not in PureBasic
Replies: 4
Views: 1144

error available from cmd prompt, but not in PureBasic

Hi,

when running a program (in this case Cmail.exe) from the commandprompt, I can redirect the output using the commandline cmail.exe -config:configfile.txt -d > %temp%\cmail.log 2>&1 to a file. This includes the data from -d (which is written to stdout) and the error (which is written to stderr ...
by Poltergeist
Fri Jan 08, 2021 3:38 pm
Forum: Coding Questions
Topic: Extracting JSON arrays
Replies: 4
Views: 1399

Re: Extracting JSON arrays

That's a very nice tutorial. Thank you. I've used this before (and used it as an example for my own code), but ran into the same issue with it. However, I think I will manage another way to get those arrays (if I need them)
by Poltergeist
Tue Jan 05, 2021 5:06 pm
Forum: Coding Questions
Topic: Extracting JSON arrays
Replies: 4
Views: 1399

Extracting JSON arrays

I'm trying to wrap my head around JSON, but find it quite difficult, to be honest. I'm probably doing it all wrong, but I have this piece of code:

Declare.s GetJsonAnyValue(value)
Declare.s HTTPJsonRequest(posttype,string.s,gegevens.s="")
Declare ExtractJsonObject(value)
Declare ...
by Poltergeist
Tue Sep 11, 2018 11:09 am
Forum: Coding Questions
Topic: ODBC Examinedatabase returns unexpected results
Replies: 1
Views: 661

ODBC Examinedatabase returns unexpected results

Hi,

I would like to find out which ODBC drivers are installed on my system. That should be an easy task, using the following code:


UseODBCDatabase()
If ExamineDatabaseDrivers()
While NextDatabaseDriver()
Debug DatabaseDriverName()+":"+DatabaseDriverDescription()
Wend
EndIf


However, this ...
by Poltergeist
Thu Apr 07, 2016 7:56 am
Forum: Coding Questions
Topic: addpackfile after openpack not working in 5.42
Replies: 3
Views: 1438

Re: addpackfile after openpack not working in 5.42

Ofcourse that would work, but it's a workaround for something that used to work.

Tested some more. In 5.40, the addpackfile after the openpack gives a [ERROR] Invalid memory access. (read error at address 0)
In 5.42, the same command just returns a zero.
by Poltergeist
Wed Apr 06, 2016 3:46 pm
Forum: Coding Questions
Topic: addpackfile after openpack not working in 5.42
Replies: 3
Views: 1438

addpackfile after openpack not working in 5.42

UseZipPacker()
Debug CreatePack(0,"c:\temp\test.zip")
Debug AddPackFile(0,"c:\temp\unpacked\Tobbe 2.lic","Tobbe 2.lic")
Debug ClosePack(0)
Debug OpenPack(0,"c:\temp\test.zip")
Debug AddPackFile(0,"c:\temp\unpacked\Tobbe 2.vbs","Tobbe 2.vbs")
ClosePack(0)
After creating a zipfile using createpack ...
by Poltergeist
Fri Sep 04, 2015 3:43 pm
Forum: Coding Questions
Topic: Elevation or not?
Replies: 0
Views: 752

Elevation or not?

This gonna sound stupid, probably, but

I wrote a program which needs elevation. I used the "request Administrator mode for Windows Vista and above" and this works. However, I needed the program to start not elevated, and than be restarted elevated, so I used the code from http://www.purebasic.fr ...
by Poltergeist
Wed Jul 29, 2015 7:41 am
Forum: Coding Questions
Topic: [PB 5.31] GetEnvironmentVariable gives faulty results
Replies: 3
Views: 1557

Re: [PB 5.31] GetEnvironmentVariable gives faulty results

Thank you. That's clear and logical. Is there any (purebasic) way around it, expect for using the 64bit purebasic, or runprogram(Getenvironmentvariable("comspec"),"/c echo %programfiles(x86)% > sometext.txt") (something like that)and parsing that output? The program needs to run on both 32 and 64 ...
by Poltergeist
Tue Jul 28, 2015 3:40 pm
Forum: Coding Questions
Topic: [PB 5.31] GetEnvironmentVariable gives faulty results
Replies: 3
Views: 1557

[PB 5.31] GetEnvironmentVariable gives faulty results

Debug GetEnvironmentVariable("ProgramFiles(x86)")
Debug GetEnvironmentVariable("ProgramFiles")

both give c:\program files (x86) back.

Also

Debug GetEnvironmentVariable("Commonprogramfiles(x86)")
Debug GetEnvironmentVariable("commonprogramfiles")

both C:\Program Files (x86)\Common Files

Checked ...
by Poltergeist
Mon Jun 29, 2015 7:31 am
Forum: Coding Questions
Topic: mapped drives with openFileRequester
Replies: 3
Views: 1506

Re: mapped drives with openFileRequester

Already know what's happening: I run the program in Administrative Mode (Elevated). Then the mapped drives are not available. When not running elevated, it's working as expected...
by Poltergeist
Fri Jun 26, 2015 4:00 pm
Forum: Coding Questions
Topic: mapped drives with openFileRequester
Replies: 3
Views: 1506

mapped drives with openFileRequester

When using OpenFileRequester, the mapped drives (on Windows 8, at least) are not shown. Is it possible to do so?
by Poltergeist
Tue Aug 05, 2014 10:51 am
Forum: Coding Questions
Topic: Getting data from a server, login fails
Replies: 6
Views: 1930

Re: Getting data from a server, login fails

Commands don't count up to the first 0. The simply seem to ignore the zero's. If I do a PokeS with that logonstring, the zeros are gone. The effect is the same: it doesn't work, but the 0 is not a terminator, apparently. That ShowMemoryViewer function is certainly easy...

I will try your code when ...
by Poltergeist
Mon Aug 04, 2014 10:21 pm
Forum: Coding Questions
Topic: Getting data from a server, login fails
Replies: 6
Views: 1930

Re: Getting data from a server, login fails

I tried that also, but the effect is the same. Does not work, unfortunatly...


logondata.s=Chr(1)+"username"+Chr(0)+"password"+Chr(0)
*buffer=AllocateMemory(Len(logondata))
PokeS(*buffer,logondata,Len(logondata),#PB_UTF8)
If InitNetwork()
ConnectionID=OpenNetworkConnection("datafeed.aislive.com ...