Page 1 of 2
Windows 7 here we come
Posted: Tue Aug 04, 2009 5:04 am
by RASHAD
Windows 7
Set Alwayes show all icons and notifications on taskbar PROGRAMMATIC
Tested x86/x64
Code: Select all
Global GetHandle.l ,hKey.l ,lType.l ,lpcbData.l ,lpData.s ,lReturnCode.l ,lhRemoteRegistry.l ,lpDataDWORD.l
Procedure.l GetValue(topKey, sKeyName.s, sValueName.s, ComputerName.s)
Shared GetValue.s
lReturnCode = RegConnectRegistry_(ComputerName, topKey, @lhRemoteRegistry)
GetHandle = RegOpenKeyEx_(lhRemoteRegistry, sKeyName, 0, #KEY_READ, @hKey)
If GetHandle = #ERROR_SUCCESS
lpcbData = 255
lpData = Space(255)
GetHandle = RegQueryValueEx_(hKey, sValueName, 0, @lType, @lpData, @lpcbData)
If GetHandle = 0
GetValue = Left(lpData, lpcbData - 1)
Else
GetValue = ""
EndIf
EndIf
RegCloseKey_(hKey)
ProcedureReturn GetHandle
EndProcedure
Procedure.l SetValue(topKey.l, sKeyName.s, sValueName.s, vValue.s, lType.l, ComputerName.s)
If ComputerName = ""
GetHandle = RegOpenKeyEx_(topKey, sKeyName, 0, #KEY_ALL_ACCESS, @hKey)
Else
lReturnCode = RegConnectRegistry_(ComputerName, topKey, @lhRemoteRegistry)
GetHandle = RegOpenKeyEx_(lhRemoteRegistry, sKeyName, 0, #KEY_ALL_ACCESS, @hKey)
EndIf
If GetHandle = #ERROR_SUCCESS
lpcbData = 255
lpData = Space(255)
GetHandle = RegSetValueEx_(hkey, sValueName, 0, #REG_SZ, @vValue, Len(vValue) + 1)
RegCloseKey_(hkey)
Error = 1
ProcedureReturn Error
Else
MessageRequester("Error", "An Error occured, Return value = " + Str(lRetVal), 0)
RegCloseKey_(hKey)
Error = 0
ProcedureReturn Error
EndIf
EndProcedure
GetValue(#HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","ProductName", "")
Result = FindString(GetValue, "7", 1)
If Result = 0
MessageRequester("Error","This is not WINDOWS 7 bye", #MB_ICONERROR)
End
Else
SetValue(#HKEY_CURRENT_USER , "Software\Microsoft\Windows\CurrentVersion\Explorer", "EnableAutoTray", "0", #REG_SZ, "")
Result = MessageRequester("Information","Going to LogOff LogOn Proceed?", #PB_MessageRequester_YesNo)
If Result = #PB_MessageRequester_Yes
RunProgram("Shutdown.exe"," -l","",#PB_Program_Hide|#PB_Program_Wait)
EndIf
EndIf
End
It in not that much
But it is the start
RASHAD
Re: Windows 7 here we come
Posted: Sat Aug 08, 2009 11:28 pm
by SFSxOI
RASHAD wrote:Windows 7
Set Alwayes show all icons and notifications on taskbar PROGRAMMATIC
Tested x86/x64
Code: Select all
(#HKEY_CURRENT_USER , "Software\Microsoft\Windows\CurrentVersion\Explorer", "EnableAutoTray", "0", #REG_SZ, "")
It in not that much
But it is the start
RASHAD
Hmmm...Thanks Rashad, but I think there is a small error with your code, EnableAutoTray is a DWORD, you have it as REG_SZ. The actual registry section looks like this when its exported:
Code: Select all
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]
"EnableAutoTray"=dword:00000000
This is on Winodws 7 RTM 32 bit. And i'm pretty sure its a DWORD cause I was doing it all thru the beta. But a REG_SZ at 0 might work too.
Posted: Sun Aug 09, 2009 8:55 am
by RASHAD
I wonder how you could manage hanging around insulting people and still know a thing @ windows
You are superman kid (MS changed that to REG_SZ not me)
For everybody
As long as you are not a member in the gang
You will be next
Go check Joestes
http://www.purebasic.fr/english/viewtop ... icongadget
and ask Fluid Byte & netmaestro about that may be you can get answer
also check and email it to your friends
http://basic.mindteq.com/index.php/comp ... basic.html
Posted: Sun Aug 09, 2009 10:25 am
by lexvictory
RASHAD wrote:I wonder how you could manage hanging around insulting people and still know a thing @ windows
You are superman kid (MS changed that to REG_SZ not me)
what the? no insult in SFSxOI's post.
and it IS a dword, MS didn't change anything....
as for the rest of your post

Posted: Sun Aug 09, 2009 10:46 am
by RASHAD
Windows 7 7600.16385 x64
check it is REG_SZ
Re: Windows 7 here we come
Posted: Sun Aug 09, 2009 10:47 am
by lexvictory
SFSxOI wrote:This is on Winodws 7 RTM 32 bit. And i'm pretty sure its a DWORD
Posted: Sun Aug 09, 2009 11:37 am
by blueznl
Rashad, you're either trolling, or your control over the english language is not good enough, or it's all a misunderstanding, or you are in your right but then there are better way to say things including proof.
Let's assume it's a misunderstanding, but please re-read your post and correct things. I'm not a moderator but this kind of post is bothering me.
Posted: Sun Aug 09, 2009 12:35 pm
by RASHAD
Done
Posted: Sun Aug 09, 2009 1:29 pm
by cas
RASHAD wrote:I wonder how you could manage hanging around insulting people and still know a thing @ windows
You are superman kid (MS changed that to REG_SZ not me)
Ok, i know you will say again that i am attacking you (like in other thread) but it is not MS that changed it to REG_SZ, it was you when you executed your program first time so you overwrited original key with REG_SZ (or created it without overwrite if key didn't existed before). I searched on google and i can't find any connection between "EnableAutoTray" and "REG_SZ", it is definitely still DWORD like in older versions of windows (but still, small chances are that i am wrong

).
And your response to SFSxOI... I was
Don't be mad at people if they respond to your thread.
EDIT:
RASHAD wrote:Windows 7 7600.16385 x64
check it is REG_SZ
Windows 7 x64 RTM:

Posted: Sun Aug 09, 2009 1:59 pm
by Fluid Byte
RASHAD wrote:and ask Fluid Byte & netmaestro about that may be you can get answer
About what?
Posted: Sun Aug 09, 2009 2:04 pm
by RASHAD
@cas
No i am not mad
and i did not say i do not believe you or the others
it is REG_DWORD in xp through win 7
But in front of me it is REG_SZ believe me
I thought it is MS to decrease the size of the reg.
remember the value always either 0 or 1
I used REG_SZ in the code and it worked
I used 0 and 1 and it worked
What can I say
If I have a way to put a snapshot so I will
Remember I did not say i do not believe you
Posted: Sun Aug 09, 2009 2:25 pm
by cas
RASHAD wrote:But in front of me it is REG_SZ believe me
I belive you, as i said in previous post, your code overwritten default DWORD key

, it would be stupid from Microsoft to change something that is working fine in last couple versions of their OS because they need to maintain compatibility with older programs and decreasing registry is not an option as today we have at least 200GB hdd's in modern PC's and whole registry is maybe 30-50MB on disk without any program installed.
Anyway, if you say that it is working even if key is REG_SZ type then fine. But i like to keep it right so i would change it to DWORD in your program because you never know what checks they will add in future versions of Windows, so your program may end up broken if creating wrong key type.
Posted: Sun Aug 09, 2009 2:42 pm
by RASHAD
@cas my system was running beta 2462 then I upgraded it to RTM
Now you make me suspect it is because of that and to be sure
it req me to install windows 7 on a clean hd
i do not want to do that in the time being I will do it later
Using DWORD does not upset me
You or me or any other member we do not post any code and say it is 100% perfect and do not change any thing no
Posted: Sun Aug 09, 2009 2:52 pm
by cas
It is working with REG_SZ but when i got to taskbar properties and i deactivate "Always show all icons and notifications on the taskbar" then your REG_SZ key is overwritten with DWORD key.
Looks like there is no problem , it is same if you use REG_SZ or DWORD, but as i said, future versions of windows could break this and ignore REG_SZ version of "EnableAutoTray", or maybe not but to be 100% sure that it will work, change it to DWORD as it is really simple, no need to rewrite code, just change parameter.
Here is quickly edited code which creates DWORD key:
Code: Select all
Global GetHandle.l ,hKey.l ,lType.l ,lpcbData.l ,lpData.s ,lReturnCode.l ,lhRemoteRegistry.l ,lpDataDWORD.l
Procedure.l GetValue(topKey, sKeyName.s, sValueName.s, ComputerName.s)
Shared GetValue.s
lReturnCode = RegConnectRegistry_(ComputerName, topKey, @lhRemoteRegistry)
GetHandle = RegOpenKeyEx_(lhRemoteRegistry, sKeyName, 0, #KEY_READ, @hKey)
If GetHandle = #ERROR_SUCCESS
lpcbData = 255
lpData = Space(255)
GetHandle = RegQueryValueEx_(hKey, sValueName, 0, @lType, @lpData, @lpcbData)
If GetHandle = 0
GetValue = Left(lpData, lpcbData - 1)
Else
GetValue = ""
EndIf
EndIf
RegCloseKey_(hKey)
ProcedureReturn GetHandle
EndProcedure
Procedure.l SetValue(topKey.l, sKeyName.s, sValueName.s, vValue.l, lType.l, ComputerName.s)
If ComputerName = ""
GetHandle = RegOpenKeyEx_(topKey, sKeyName, 0, #KEY_ALL_ACCESS, @hKey)
Else
lReturnCode = RegConnectRegistry_(ComputerName, topKey, @lhRemoteRegistry)
GetHandle = RegOpenKeyEx_(lhRemoteRegistry, sKeyName, 0, #KEY_ALL_ACCESS, @hKey)
EndIf
If GetHandle = #ERROR_SUCCESS
lpcbData = 255
lpData = Space(255)
GetHandle = RegSetValueEx_(hkey, sValueName, 0, #REG_DWORD, @vValue, 4)
RegCloseKey_(hkey)
Error = 1
ProcedureReturn Error
Else
MessageRequester("Error", "An Error occured, Return value = " + Str(lRetVal), 0)
RegCloseKey_(hKey)
Error = 0
ProcedureReturn Error
EndIf
EndProcedure
GetValue(#HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","ProductName", "")
Result = FindString(GetValue, "7", 1)
If Result = 0
MessageRequester("Error","This is not WINDOWS 7 bye", #MB_ICONERROR)
End
Else
SetValue(#HKEY_CURRENT_USER , "Software\Microsoft\Windows\CurrentVersion\Explorer", "EnableAutoTray", 0, #REG_DWORD, "")
Result = MessageRequester("Information","Going to LogOff LogOn Proceed?", #PB_MessageRequester_YesNo)
If Result = #PB_MessageRequester_Yes
RunProgram("Shutdown.exe"," -l","",#PB_Program_Hide|#PB_Program_Wait)
EndIf
EndIf
End
Posted: Sun Aug 09, 2009 3:57 pm
by RASHAD
@cas
Yoy ara absolutely right
I am tired even I did not read your first post carefuly
sorry boys