bobmcflowers
asked on
Login program - customisation
Hello there experts
I am wanting to make a VB program that:
Opens a program that i already have to change the resolution.
Set an image as the wall paper (for my sake call it "C:\Windows\Desktop\Image. jpg")
Copy a file called "All.reg" that is stored in "N:\Mywork\All.reg" into registry
Could there also be a comment in to code for the Wallpaper part for whether it is stretched or tiled as i will be changint it from time to time and i will need to remake the program to stretch or tiled according to the image
THANKS PEOPLE
Bobmcflowers
I am wanting to make a VB program that:
Opens a program that i already have to change the resolution.
Set an image as the wall paper (for my sake call it "C:\Windows\Desktop\Image.
Copy a file called "All.reg" that is stored in "N:\Mywork\All.reg" into registry
Could there also be a comment in to code for the Wallpaper part for whether it is stretched or tiled as i will be changint it from time to time and i will need to remake the program to stretch or tiled according to the image
THANKS PEOPLE
Bobmcflowers
To do the wallpaper thing (assuming you have a bmp) take a look at https://www.experts-exchange.com/questions/11351457/Setting-Windows-Wallpaper.html
While it isn't exactly what your looking for, one of the respondents gives contact info for more details (e.g., non-bmp files and stretching)
Do you need help on the other parts (opening the other program and updating the registry) too?
While it isn't exactly what your looking for, one of the respondents gives contact info for more details (e.g., non-bmp files and stretching)
Do you need help on the other parts (opening the other program and updating the registry) too?
Looks like dc197 got you a full answer while I was typing.
One way of using .jpg files would be to take advantage of a limitation in the VB6 (maybe others too?) SavePicture function.
You can use the LoadPicture function to open a .jpg file, you can then use the SavePicture function -- which automatically saves in .bmp format.
So, if you have a picturebox called picturebox1 (or a form or any other control that has a picture) you can do this:
Picture1.Picture = LoadPicture("C:\path\to\pi cture.jpg" )
SavePicture Picture1.Picture, "C:\windows\wallpaper.bmp"
before you set the wallpaper.
One way of using .jpg files would be to take advantage of a limitation in the VB6 (maybe others too?) SavePicture function.
You can use the LoadPicture function to open a .jpg file, you can then use the SavePicture function -- which automatically saves in .bmp format.
So, if you have a picturebox called picturebox1 (or a form or any other control that has a picture) you can do this:
Picture1.Picture = LoadPicture("C:\path\to\pi
SavePicture Picture1.Picture, "C:\windows\wallpaper.bmp"
before you set the wallpaper.
For stretched or tiled, you need to change registry first
https://www.experts-exchange.com/questions/10260321/Stretch-to-fit-screen.html
https://www.experts-exchange.com/questions/10260321/Stretch-to-fit-screen.html
ASKER
dc197 Thats really good, the start bar ting (the one at the bottom of the screen) stays in the same place where i have to move it to the bottom manually. is there a way, perhaps refreshing the screen that would do this atuomaticaly too?
But i remembered one other thing that wasnt included in the original question.
There is also a program running called Windowgrab (it runs hidden) and this controls some of teh restrictions on the computer. I need to close this process from the program too. (i am in the computer committee and therefore am allowed to do such things as i am trusted by staff not to mess things up)
At the minute i have to close it manualy with Ctrl+alt+del before it removes itself from that menu (just after login) or using useful.exe (shows all running programs and allows you to kill them) but an automated way would be really good
EDDYKT and giantelvis - its alrite, it went to tiled which is what i wanted for the picture im using at the minute, and im so pleased i think ill stick with it lol, + its far too complicated for me!
THANKS AGAIN EVERYONE
But i remembered one other thing that wasnt included in the original question.
There is also a program running called Windowgrab (it runs hidden) and this controls some of teh restrictions on the computer. I need to close this process from the program too. (i am in the computer committee and therefore am allowed to do such things as i am trusted by staff not to mess things up)
At the minute i have to close it manualy with Ctrl+alt+del before it removes itself from that menu (just after login) or using useful.exe (shows all running programs and allows you to kill them) but an automated way would be really good
EDDYKT and giantelvis - its alrite, it went to tiled which is what i wanted for the picture im using at the minute, and im so pleased i think ill stick with it lol, + its far too complicated for me!
THANKS AGAIN EVERYONE
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Lol, I love the liberal use of "Die"
Will this still work as the program does not have a 'window'
also the thing about the startbar... refresh screen possibly, please advise
Bobmcflowers
Will this still work as the program does not have a 'window'
also the thing about the startbar... refresh screen possibly, please advise
Bobmcflowers
Yes.
It's interesting, if you extract some of the functions and use them on their own, you can list the "window caption" of most programs running.
Below is a list of all the "windows" currently running on my PC. As you can see there are a lot!
I wrote the program that did this, if you're interested, http://www.danielclarke.com/software/windowfinder/ , set the "String To Find" box to * to produce this.
About the screen refresh, does this happen after you adjust the resolution? I'll have a look into it.
My windows....
SysFader
SysFader
SysFader
SysFader
DirectDBNotifyWndProc
Outlook Express FolderSync Window Class
SysFader
OEStoreCleanupThread
DirectDBNotifyWndProc
SysFader
DirectDBNotifyWndProc
DirectDBListenWndProc
O
Fax Monitor
VirusScan On-Access Scan Messages
NetDDE Agent
Window Finder
WindowFinder
Windows Task Manager
Comment Added: Login program - customisation
MCI command handling window
DDE Server Window
DDE Server Window
Outlook Express
DDE Server Window
Secure VPN Client - GNAT Box VPN Client
Identity Mgr Notify
WAB Notification Window
wxTaskBarWindow
MCI command handling window
Identity Mgr Notify
Identity Mgr Notify
DDE Server Window
MCI command handling window
VirusScan On-Access Scan Statistics
VirusScan On-Access Scan Statistics - DAN
McAfee Updater
ePolicy Orchestrator Agent Monitor
DDE Server Window
Preferences
Connection Manager Tray Icon
CSC Notifications Window
Power Meter
Connections Tray
MS_WebcheckMonitor
DDE Server Window
SYSTEM AGENT COM WINDOW
NVSVCPMMWindowClass
MM Notify Callback
SysFader
Comment Added: Login program - customisation
Visual Basic: Login program - customisation - Microsoft Internet Explorer provided by BTopenworld
Good Answer! Winsock HTTP Filename to Pass Parameter Problem
modules
Experts exchnage - Outlook Express provided by BTopenworld
Program Manager
It's interesting, if you extract some of the functions and use them on their own, you can list the "window caption" of most programs running.
Below is a list of all the "windows" currently running on my PC. As you can see there are a lot!
I wrote the program that did this, if you're interested, http://www.danielclarke.com/software/windowfinder/ , set the "String To Find" box to * to produce this.
About the screen refresh, does this happen after you adjust the resolution? I'll have a look into it.
My windows....
SysFader
SysFader
SysFader
SysFader
DirectDBNotifyWndProc
Outlook Express FolderSync Window Class
SysFader
OEStoreCleanupThread
DirectDBNotifyWndProc
SysFader
DirectDBNotifyWndProc
DirectDBListenWndProc
O
Fax Monitor
VirusScan On-Access Scan Messages
NetDDE Agent
Window Finder
WindowFinder
Windows Task Manager
Comment Added: Login program - customisation
MCI command handling window
DDE Server Window
DDE Server Window
Outlook Express
DDE Server Window
Secure VPN Client - GNAT Box VPN Client
Identity Mgr Notify
WAB Notification Window
wxTaskBarWindow
MCI command handling window
Identity Mgr Notify
Identity Mgr Notify
DDE Server Window
MCI command handling window
VirusScan On-Access Scan Statistics
VirusScan On-Access Scan Statistics - DAN
McAfee Updater
ePolicy Orchestrator Agent Monitor
DDE Server Window
Preferences
Connection Manager Tray Icon
CSC Notifications Window
Power Meter
Connections Tray
MS_WebcheckMonitor
DDE Server Window
SYSTEM AGENT COM WINDOW
NVSVCPMMWindowClass
MM Notify Callback
SysFader
Comment Added: Login program - customisation
Visual Basic: Login program - customisation - Microsoft Internet Explorer provided by BTopenworld
Good Answer! Winsock HTTP Filename to Pass Parameter Problem
modules
Experts exchnage - Outlook Express provided by BTopenworld
Program Manager
Try this, it might work:
' form code:
Call SendMessageTimeout(HWND_BR OADCAST, _
WM_SETTINGCHANGE, _
SPI_SETNONCLIENTMETRICS, _
0&, SMTO_ABORTIFHUNG, _
1000&, success)
' Module code:
'SendMessageTimeout values
Public Const HWND_BROADCAST As Long = &HFFFF&
Public Const WM_SETTINGCHANGE As Long = &H1A
Public Const SPI_SETNONCLIENTMETRICS As Long = &H2A
Public Const SMTO_ABORTIFHUNG As Long = &H2
Public Declare Function SendMessageTimeout Lib "user32" _
Alias "SendMessageTimeoutA" _
(ByVal hwnd As Long, ByVal msg As Long, _
ByVal wParam As Long, ByVal lParam As Long, _
ByVal fuFlags As Long, ByVal uTimeout As Long, _
lpdwResult As Long) As Long
Public Declare Function RegQueryValueEx Lib "advapi32" _
Alias "RegQueryValueExA" _
(ByVal hKey As Long, ByVal lpszValueName As String, _
ByVal lpdwRes As Long, lpType As Long, _
lpData As Any, nSize As Long) As Long
Public Declare Function LockWindowUpdate Lib "user32" _
(ByVal hwndLock As Long) As Long
Public Declare Function GetDesktopWindow Lib "user32" () As Long
Public Declare Sub Sleep Lib "kernel32" _
(ByVal dwMilliseconds As Long)
' form code:
Call SendMessageTimeout(HWND_BR
WM_SETTINGCHANGE, _
SPI_SETNONCLIENTMETRICS, _
0&, SMTO_ABORTIFHUNG, _
1000&, success)
' Module code:
'SendMessageTimeout values
Public Const HWND_BROADCAST As Long = &HFFFF&
Public Const WM_SETTINGCHANGE As Long = &H1A
Public Const SPI_SETNONCLIENTMETRICS As Long = &H2A
Public Const SMTO_ABORTIFHUNG As Long = &H2
Public Declare Function SendMessageTimeout Lib "user32" _
Alias "SendMessageTimeoutA" _
(ByVal hwnd As Long, ByVal msg As Long, _
ByVal wParam As Long, ByVal lParam As Long, _
ByVal fuFlags As Long, ByVal uTimeout As Long, _
lpdwResult As Long) As Long
Public Declare Function RegQueryValueEx Lib "advapi32" _
Alias "RegQueryValueExA" _
(ByVal hKey As Long, ByVal lpszValueName As String, _
ByVal lpdwRes As Long, lpType As Long, _
lpData As Any, nSize As Long) As Long
Public Declare Function LockWindowUpdate Lib "user32" _
(ByVal hwndLock As Long) As Long
Public Declare Function GetDesktopWindow Lib "user32" () As Long
Public Declare Sub Sleep Lib "kernel32" _
(ByVal dwMilliseconds As Long)
ok, yeah it only happens when i change the resolution, but its not ur code thats done it though, it always needed re-adjusting after i used "Resolution.exe" so dont worry, tis not ur fault
sorry, what is that last one meant to do
Call SendMessageTimeout(HWND_BR OADCAST, _
WM_SETTINGCHANGE, _
SPI_SETNONCLIENTMETRICS, _
0&, SMTO_ABORTIFHUNG, _
1000&, success)
finds an error in that bit
do so with the "success" part
WM_SETTINGCHANGE, _
SPI_SETNONCLIENTMETRICS, _
0&, SMTO_ABORTIFHUNG, _
1000&, success)
finds an error in that bit
do so with the "success" part
ASKER
LOL, anything that was posted by cofneverlive to tell was from me lol, i didnt check the name.
sorry for any confusion caused lol
sorry for any confusion caused lol
ASKER
it never asked me for a password
Sorry, i will give the points to dc197 because of all the work they put in, but i found another way to do it lol
Thanks all
Thanks all
Attribute VB_Name = "Wallpaper"
Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long
Public Const SPI_SETDESKWALLPAPER = 20
Public Const SPIF_SENDWININICHANGE = &H2
Public Const SPIF_UPDATEINIFILE = &H1
Public Sub SetWallpaper(ByVal FileName As String)
Dim x As Long
x = SystemParametersInfo(SPI_S
0&, FileName, SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE)
End Sub
Put this in your form code:
Private Sub Form_Load()
Dim svRet
on error resume next
svRet = Shell("C:\path\to\my_resul
SetWallpaper "C:\Windows\Desktop\Image.
Shell "regedit /s N:\Mywork\All.reg ", vbNormalFocus ' the S makes it silent
on error goto 0
End Sub