Running and FBGFX based exe on start-up (win98)

Windows specific questions.
Post Reply
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Running and FBGFX based exe on start-up (win98)

Post by relsoft »

Hi guys, the office I worked with asked me to make a a password system for each of our computers. All of them uses win98 se. Now the inteface for the proggie is finished. They're more than hapy with a mode7 floormapping and some standad text. They thought I was the collest guy to make smething like that. hehehehehe

Now for the actual problem, I suck at windows programming. Too lazy to read stuff regarding OS'es. :*(

But voodooattack was kind enough to give me some helper funnctions. After some editing, seaching this forum for the actuall datatypes (ie. Hkey****), I found them on one of yetifoot's posts. But well, it didn't work.

Any idea why?

Here are the zips.

This one is supposed to put my run my proggie at startup. But doesn't work.

Code: Select all

#include once "crt.bi"
#include once "windows.bi"
#include "win\winreg.bi"


#define HKEY_CLASSES_ROOT     (CAST(HKEY, &H80000000))
#define HKEY_CURRENT_CONFIG   (CAST(HKEY, &H80000005))
#define HKEY_CURRENT_USER     (CAST(HKEY, &H80000001))
#define HKEY_DYN_DATA         (CAST(HKEY, &H80000006))
#define HKEY_LOCAL_MACHINE    (CAST(HKEY, &H80000002))
#define HKEY_PERFORMANCE_DATA (CAST(HKEY, &H80000004))
#define HKEY_USERS            (CAST(HKEY, &H80000003))

const as integer CMAX_PATH = 255

Function GetExePath() as String 
        Dim sPath as ZString * CMAX_PATH 
        Call GetModuleFileName(NULL, sPath, CMAX_PATH) 
        Return Trim(sPath) 
End Function 




Sub AddToStartup(sTitle as String, sPath as string) 
        
        Dim k as HKEY 
        
        Call RegOpenKey(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", @k) 
        
        Call RegSetValueEx(k, STRPTR(sTitle), 0, REG_EXPAND_SZ, STRPTR(sPath), Len(sPath)) 

        Call RegCloseKey(k) 
        
End Sub 



Function CheckStartup(sTitle as String, sPath as string) 

    Dim k as HKEY 
    
    Dim sVal  as ZString * CMAX_PATH 
    Dim iLen  as Integer = CMAX_PATH 
    
    sVal = Space(MAX_PATH) 
    
    Call RegOpenKey(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", @k) 
    
    Call RegQueryValueEx(k, STRPTR(sTitle), 0, 0, STRPTR(sVal), @iLen) 
    
    Call RegCloseKey(k) 

    If lcase(sVal) = lcase(sPath) then Return -1 

End Function 



Sub RemoveStartup(sTitle as String) 

    Dim k as HKEY 
    
    Call RegOpenKey(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", @k) 
    
    Call RegDeleteValue(k, STRPTR(sTitle)) 
            
    Call RegCloseKey(k) 

End Sub 


AddToStartup("Password Manager", "password.exe")

Here's the whole package including the password.exe

http://fileanchor.com/46171-d


thanks.

PS. How do I disable ALT+ENTER in anf FBGFX window?

Thanks to voodoo for all his help. :*)

I would have gone to #freebasic but it won't let me enter the darn channel.
redcrab
Posts: 623
Joined: Feb 07, 2006 15:29
Location: France / Luxemburg
Contact:

Post by redcrab »

to avoid ALT+ENTER

use flag with your SCREEN instruction

in wiki...
window mode flags
Window mode flags are meaningless if GFX_NULL mode is used
# GFX_FULLSCREEN (Value 1) The graphics card switch mode is switched to the requested mode and color depth and OS fullscreen mode is used. If the mode is not availabe in the present card FB switches to windowed mode..
# If GFX_FULLSCREEN is not specified, FB opens a window of the requested size in the present desktop.
# GFX_NOSWITCH (Value 4) prevents the user from changing to fullscreen or to windowed mode by pressing Alt-ENTER).
# If GFX_NOSWITCH is not specified, the user can switch fullscreen -windowed using ALT-ENTER keys.
I think you need to use GFX_NOSWITCH (Value 4)

EDIT : e.g : flag fullscreen and noswitch = 1(fullscreen) + 4(noswitch) = 5


Hope that help

Have fun
Last edited by redcrab on Jul 20, 2006 14:55, edited 1 time in total.
yetifoot
Posts: 1710
Joined: Sep 11, 2005 7:08
Location: England
Contact:

Post by yetifoot »

Changing the code to REG_SZ instead of REG_EXPAND_SZ worked for me.

Also you would need to put the full path to password.exe, if it is not going to reside in a folder such as system32

Something to note for others is that on XP you would need admin status to run this, because it changes a system wide setting.
HKEY_LOCAL_USER would be possible without admin, but would only affect the current user.

However this method of password control is not particully secure. I'm not sure of the best way to do this, but i remember you could replace the shell in the system.ini, however it's best to read up on this, as it may not be the prefered way, and could potentially cause some real grief if you get it wrong.

PS.. lol @ mode 7 floormapped password program.
Shadowwolf
Posts: 341
Joined: May 27, 2005 7:01
Location: Canada
Contact:

Post by Shadowwolf »

he is under win98se so its not like you really can put in any real secure password protection that would stop someone determined to get in.
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Post by relsoft »

Shadowwolf wrote:he is under win98se so its not like you really can put in any real secure password protection that would stop someone determined to get in.
Yeah, they just want kids to stop fidling with the comps. :*)

Thanks guys!!!
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Post by relsoft »

It works!!! Thanks guys.

One caveat though.

It only shows the texts :

Enter password:
***** (depends on anything I type)


The mode 7 GFX eyecandy does not show. Any ideas why?

I'm guessing some drivers for ddraw idn't get loaded. If so is there a way to force FBGFX to use GDI?
L_O_J
Posts: 181
Joined: Aug 20, 2005 9:05

Post by L_O_J »

environment variable ???
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Post by relsoft »

I did but it won't let me do FULL_SCREEN on GDI mode.
yetifoot
Posts: 1710
Joined: Sep 11, 2005 7:08
Location: England
Contact:

Post by yetifoot »

I've seen somewhere else on the forum that the fullscreen GDI problem has been fixed by Lillo in the CVS, but the CVS has been playing up....

I had the problem with no floormapping too. It looks like a current directory issue.

Try the line

CHDIR EXEPATH

at the start of the program.
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Post by relsoft »

yetifoot wrote:I've seen somewhere else on the forum that the fullscreen GDI problem has been fixed by Lillo in the CVS, but the CVS has been playing up....

I had the problem with no floormapping too. It looks like a current directory issue.

Try the line

CHDIR EXEPATH

at the start of the program.
I did an even better idea. I used your bin2bas+lzw proggie. ;*)


Thanks guys!

Works now.

voodooattack helped me with the registry stuff and I used yetifoot's bin2bas with lzw to make the bas files smaller. :*)

Download the stuff...
passregister registers your exe to startup.
passcheck checks if it's in the registry.
passremove to remove the pasword from startup.

Or you could just run pasword.exe to see the demo.

http://fileanchor.com/46619-d
yetifoot
Posts: 1710
Joined: Sep 11, 2005 7:08
Location: England
Contact:

Post by yetifoot »

I don't really like to rain on my own parade but...

In an instance like bin2bas+lzw would probably making a bigger exe, than a normal bin2bas.

This is because it is only managing to save a few hundred bytes, but the overheads are probably bigger than that.

However as you are using gfxlib anyway, the fb_Decode function will be compiled in anyway, nullifying some of this.

You can happily ignore this post!
Post Reply