Please can you help me with a WebGadget thing?

Just starting out? Need help? Post your questions and find answers here.
DARKGuy
User
User
Posts: 40
Joined: Thu Mar 11, 2004 10:08 pm
Contact:

Please can you help me with a WebGadget thing?

Post by DARKGuy »

Greetings! hehe I haven't been here for quite a time...well I was busy with work and all...but now you see, a friend of mine told me to make him a little autorun program that opens an "index.htm" in the CD-ROM drive, using a WebGadget to show the htm file. But you see, I try this....

(I'm a spanish guy, so ancho = width and alto = height)

WebGadget(1,0,20,ancho,alto-20,"index.htm")
WebGadget(1,0,20,ancho,alto-20,"./index.htm")
WebGadget(1,0,20,ancho,alto-20,"file://index.htm")
WebGadget(1,0,20,ancho,alto-20,"file://./index.htm")
WebGadget(1,0,20,ancho,alto-20,"file:/index.htm")

and a lot of more combinations and no one works...the program must run in a cd-rom drive and thus, thinking as a programmer and on the user, I don't know what will be the letter of the cd drive of the user, so I need to make it work correctly, it even doesn't work in my local HD!...can someone help me please? my friend needs it badly. Thanks in advance :)
IT"S NOT WISE TO START CODING SOMETHING WITHOUT KNOWING THE LANGUAGE....WE DON'T GET PAID TO WRITE SOURCE FOR YOU YA KNOW....
In honor to darklordz...
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

why not just let it open the default browser?

RunProgram("index.html")

if you use webgadget you need to have a form and so, wich i hope you know :)

but the other method is a lot more easier,
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Please can you help me with a WebGadget thing?

Post by PB »

If index.htm is in the same folder as your app, then this works:

Code: Select all

appdir$=Space(255) : GetCurrentDirectory_(255,@appdir$)
If Right(appdir$,1)<>"\" : appdir$+"\" : EndIf
WebGadget(0,x,y,w,h,appdir$+"index.htm")
Beach
Enthusiast
Enthusiast
Posts: 677
Joined: Mon Feb 02, 2004 3:16 am
Location: Beyond the sun...

Post by Beach »

A Slightly less technical approach would be to open the file with the default browser from a batch file:

@start index.html
@exit

PB's suggestion is way cooler though! :)

-Beach
DARKGuy
User
User
Posts: 40
Joined: Thu Mar 11, 2004 10:08 pm
Contact:

Post by DARKGuy »

@beach: lol yeah but the PB idea is cooler, and he didn't wanted any explorer buttons or anything :P

@PB: that code worked wonderfully at the first use! thank you very much! :D
IT"S NOT WISE TO START CODING SOMETHING WITHOUT KNOWING THE LANGUAGE....WE DON'T GET PAID TO WRITE SOURCE FOR YOU YA KNOW....
In honor to darklordz...
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

...I don't know what will be the letter of the cd drive of the user...
This should help you find the users CDROM drive letter.

Code: Select all

; *Sparks* from Sparkie

#DRIVE_UNKNOWN = 0
#DRIVE_NO_ROOT_DIR = 1
#DRIVE_REMOVABLE = 2
#DRIVE_FIXED = 3
#DRIVE_REMOTE = 4
#DRIVE_CDROM = 5
#DRIVE_RAMDISK = 6

Dim myDrive.s(5, 5) ; array to hold up to 6 drives of each of the 6 types

bits32.l = GetLogicalDrives_()
on.l = 1
drive$ = ""

; check bits original code is from a post I found by freak. Thanks for the info!!
For ckBit = 0 To 31
  drive$ = ""
  If bits32 & on<<ckBit
    drive$ = Chr(65 + ckBit) + ":\"
    driveType = GetDriveType_(@drive$)
    
    Select driveType
      
      Case #DRIVE_UNKNOWN
        myDrive(#DRIVE_UNKNOWN, unknownNum) = drive$ + "  Unknown drive type"
        unknownNum + 1
      Case #DRIVE_NO_ROOT_DIR
        myDrive(#DRIVE_NO_ROOT_DIR, noRootNum) =  drive$ + "  Drive has no root dir"
        noRootNum + 1
      Case #DRIVE_REMOVABLE
        myDrive(#DRIVE_REMOVABLE, removableNum) = drive$ + "  Removable media drive" 
        removableNum + 1
      Case #DRIVE_FIXED
        myDrive(#DRIVE_FIXED, fixedNum) = drive$ + "  Fixed disk drive" 
        fixedNum + 1
      Case #DRIVE_REMOTE 
        myDrive(#DRIVE_REMOTE, remoteNum) =  drive$ + "  Remote drive"
        remoteNum + 1
      Case #DRIVE_CDROM
        myDrive(#DRIVE_CDROM, cdromNum) = drive$ + "  CDROM drive"
        cdromNum + 1
      Case #DRIVE_RAMDISK
        myDrive(#DRIVE_RAMDISK, ramNum) = drive$ + "  Ramdisk"
        ramNum + 1
    EndSelect
    
  EndIf
  
Next

For dType = 0 To 5
  
  For dCount = 0 To 5
    If myDrive(dType, dCount) <> ""
      allDrives$ = allDrives$ + myDrive(dType, dCount) + Chr(10) + Chr(13)
    EndIf
  Next
  
Next

MessageRequester("List of drives found", allDrives$, #MB_ICONINFORMATION)

End
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
Beach
Enthusiast
Enthusiast
Posts: 677
Joined: Mon Feb 02, 2004 3:16 am
Location: Beyond the sun...

Post by Beach »

The 'GetCurrentDirectory' API call (in PB's suggested code) returns the full path of where the application is running from - the CDROM's drive letter will already be included...
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Oops, I thought the app was running from HD and in turn looking for the CDROM drive and then looking for index.html. My bad. :oops:
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
Post Reply