تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
الجزء الثاني من حزمة الاكواد
#1
كيفية تفعيل و تعطيل زر الإغلاق في النوافذ بالكود

في قسم التصريحات العامة
PHP كود :
private declare function getsystemmenu lib "user32" (byval hwnd _
as longbyval brevert as boolean) as long
private declare function getmenuitemcount lib "user32" (byval _
hmenu 
as long) as long
private declare function removemenu lib "user32" (byval _
hmenu 
as longbyval nposition as longbyval wflags as long_
as long
private declare function drawmenubar lib "user32" (byval hwnd as long) as long
private const mf_byposition = &h400&
private const 
mf_remove = &h1000&
public 
sub disableclose(frm as formoptional _
disable 
as boolean true)
'setting disable to false disables the 'x',
'
otherwiseits reset
dim hmenu 
as long
dim ncount 
as long
if disable then
hmenu 
getsystemmenu(frm.hwndfalse)
ncount getmenuitemcount(hmenu)
call removemenu(hmenuncount 1mf_remove or _
mf_byposition
)
call removemenu(hmenuncount 2mf_remove or _
mf_byposition
)
drawmenubar frm.hwnd
else
getsystemmenu frm.hwndtrue
drawmenubar frm
.hwnd
end 
if
end sub 


أما في زر التفعيل
PHP كود :
call disableclose(mefalse

و في زر التعطيل
PHP كود :
call disableclose(metrue


كــٍوٍدٍ لوضع الموقع في المفـضـله
PHP كود :
في المديـل
private declare function shgetspecialfolderlocation _
lib 
"****l32.dll" (byval hwndowner as long_
byval nfolder 
as special****lfolderids_
pidl 
as long) as long

private declare function shgetpathfromidlist _
lib 
"****l32.dll" alias "shgetpathfromidlista" _
(byval pidl as long_
byval pszpath 
as string) as long

private declare sub cotaskmemfree lib "ole32.dll" _
(byval pv as long)

public 
enum special****lfolderids
csidl_desktop 
= &h0
csidl_internet 
= &h1
csidl_programs 
= &h2
csidl_controls 
= &h3
csidl_printers 
= &h4
csidl_personal 
= &h5
csidl_favorites 
= &h6
csidl_startup 
= &h7
csidl_recent 
= &h8
csidl_sendto 
= &h9
csidl_bitbucket 
= &ha
csidl_startmenu 
= &hb
csidl_desktopdirectory 
= &h10
csidl_drives 
= &h11
csidl_network 
= &h12
csidl_nethood 
= &h13
csidl_fonts 
= &h14
csidl_templates 
= &h15
csidl_common_startmenu 
= &h16
csidl_common_programs 
= &h17
csidl_common_startup 
= &h18
csidl_common_desktopdirectory 
= &h19
csidl_appdata 
= &h1a
csidl_printhood 
= &h1b
csidl_altstartup 
= &h1d
csidl_common_altstartup 
= &h1e
csidl_common_favorites 
= &h1f
csidl_internet_cache 
= &h20
csidl_
******= &h21
csidl_history 
= &h22
end enum


public sub addfavorite(sitename as stringurl as string)
dim pidl as long
dim intfile 
as integer
dim strfullpath 
as string

on error 
goto goodbye

intfile 
freefile
strfullpath 
space(255)


if 
shgetspecialfolderlocation(0csidl_favoritespidl) = 0 then
if pidl then
if shgetpathfromidlist(pidlstrfullpaththen
if instr(1strfullpathchr(0)) then
strfullpath 
mid(strfullpath1_
instr
(1strfullpathchr(0)) - 1)
end if

if 
right(strfullpath1) <> "\" then
strfullpath = strfullpath & "
\"
end if

strfullpath = strfullpath & sitename & "
.url"
open strfullpath for output as #intfile
print #intfile, "
[internetshortcut]"
print #intfile, "
url=" & url
close #intfile

end if
cotaskmemfree pidl
end if
end if

goodbye:

End sub
في الزر
private sub command1_click()
addfavorite "
منتدى فجوال بيزيك لكل العرب", "http://vb4arb.com/vb/forum.php"
end sub 

يجب تغيير النجوم بكلمة s h e l l 32
{وَسَارِعُواْ إِلَى مَغْفِرَةٍ مِّن رَّبِّكُمْ وَجَنَّةٍ عَرْضُهَا السَّمَاوَاتُ وَالأَرْضُ أُعِدَّتْ لِلْمُتَّقِينَ }آل عمران133
الرد }}}
تم الشكر بواسطة:
#2
جزاك الله خير

وبارك الله فيك
الرد }}}
تم الشكر بواسطة:



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم