ثامر أبو بلقيس
16-11-2014, 12:01 AM
السلام عليكم ورحمة الله وبركاته
لديك مشروع يتضمن ملفات ايكسل بها وحدات ماكرو
بدل أن تطلب من مستخدمي برنامجك بإخفاظ مستوى الامان كي تعمل الملفات بدون
إجراء العملية يدويا
نزرع الكود التالي عند دخول التجميعية في الحدث on startup
دون أن ننسى أن نجعل برنامجك مسؤولا اذ كان موجه لوينداوز أرقى من الـ xp
--abou_belkiss...2010 Security EXCEL2003
Registry.SetValue(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Office\\11.0\\Excel\\Security","Level","1",REG_DWORD);
--abou_belkiss...2010 Security EXCEL2010
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security","DataConnectionWarnings","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security","AccessVBOM","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security","VBAWarnings","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security","","",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location0","AllowSubFolders","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location0","Path","C:\\Program Files\\Microsoft Office\\Office12\\XLSTART\\",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location0","Description","3",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location1","Path","%APPDATA%\\Microsoft\\Excel\\XLSTART",REG_EXPAND_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location1","Description","4",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location2","Path","%APPDATA%\\Microsoft\\Templates",REG_EXPAND_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location2","Description","5",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location3","AllowSubFolders","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location3","Path","C:\\Program Files\\Microsoft Office\\Templates\\",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location3","Description","6",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location4","AllowSubFolders","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location4","Path","C:\\Program Files\\Microsoft Office\\Office12\\STARTUP\\",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location4","Description","7",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location5","AllowSubFolders","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location5","Path","C:\\Program Files\\Microsoft Office\\Office12\\Library\\",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location5","Description","12",REG_SZ);
--abou_belkiss...2010 Security EXCEL2007
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security","DataConnectionWarnings","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security","AccessVBOM","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security","VBAWarnings","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security","","",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location0","AllowSubFolders","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location0","Path","C:\\Program Files\\Microsoft Office\\Office12\\XLSTART\\",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location0","Description","3",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location1","Path","%APPDATA%\\Microsoft\\Excel\\XLSTART",REG_EXPAND_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location1","Description","4",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location2","Path","%APPDATA%\\Microsoft\\Templates",REG_EXPAND_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location2","Description","5",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location3","AllowSubFolders","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location3","Path","C:\\Program Files\\Microsoft Office\\Templates\\",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location3","Description","6",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location4","AllowSubFolders","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location4","Path","C:\\Program Files\\Microsoft Office\\Office12\\STARTUP\\",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location4","Description","7",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location5","AllowSubFolders","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location5","Path","C:\\Program Files\\Microsoft Office\\Office12\\Library\\",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location5","Description","12",REG_SZ);
-------------
windows = Window.EnumerateTitles();
window_name = "Program Manager";
for handle, title in pairs (windows) do
result = String.Find(title, window_name, 1, false);
if (result ~= -1) then
Window.Close(handle, CLOSEWND_TERMINATE);
end
end
ستلاحظ عند دخول التجميعية إجراء عملية تحديث موضوعة قصدا
حتى يتم تخفيض مستوى الامان مباشرة
موفق أخي :abc_138:
لديك مشروع يتضمن ملفات ايكسل بها وحدات ماكرو
بدل أن تطلب من مستخدمي برنامجك بإخفاظ مستوى الامان كي تعمل الملفات بدون
إجراء العملية يدويا
نزرع الكود التالي عند دخول التجميعية في الحدث on startup
دون أن ننسى أن نجعل برنامجك مسؤولا اذ كان موجه لوينداوز أرقى من الـ xp
--abou_belkiss...2010 Security EXCEL2003
Registry.SetValue(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Office\\11.0\\Excel\\Security","Level","1",REG_DWORD);
--abou_belkiss...2010 Security EXCEL2010
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security","DataConnectionWarnings","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security","AccessVBOM","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security","VBAWarnings","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security","","",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location0","AllowSubFolders","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location0","Path","C:\\Program Files\\Microsoft Office\\Office12\\XLSTART\\",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location0","Description","3",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location1","Path","%APPDATA%\\Microsoft\\Excel\\XLSTART",REG_EXPAND_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location1","Description","4",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location2","Path","%APPDATA%\\Microsoft\\Templates",REG_EXPAND_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location2","Description","5",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location3","AllowSubFolders","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location3","Path","C:\\Program Files\\Microsoft Office\\Templates\\",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location3","Description","6",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location4","AllowSubFolders","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location4","Path","C:\\Program Files\\Microsoft Office\\Office12\\STARTUP\\",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location4","Description","7",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location5","AllowSubFolders","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location5","Path","C:\\Program Files\\Microsoft Office\\Office12\\Library\\",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\14.0\\Excel\\Security \\Trusted Locations\\Location5","Description","12",REG_SZ);
--abou_belkiss...2010 Security EXCEL2007
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security","DataConnectionWarnings","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security","AccessVBOM","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security","VBAWarnings","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security","","",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location0","AllowSubFolders","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location0","Path","C:\\Program Files\\Microsoft Office\\Office12\\XLSTART\\",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location0","Description","3",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location1","Path","%APPDATA%\\Microsoft\\Excel\\XLSTART",REG_EXPAND_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location1","Description","4",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location2","Path","%APPDATA%\\Microsoft\\Templates",REG_EXPAND_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location2","Description","5",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location3","AllowSubFolders","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location3","Path","C:\\Program Files\\Microsoft Office\\Templates\\",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location3","Description","6",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location4","AllowSubFolders","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location4","Path","C:\\Program Files\\Microsoft Office\\Office12\\STARTUP\\",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location4","Description","7",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location5","AllowSubFolders","1",REG_DWORD);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location5","Path","C:\\Program Files\\Microsoft Office\\Office12\\Library\\",REG_SZ);
Registry.SetValue(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Office\\12.0\\Excel\\Security \\Trusted Locations\\Location5","Description","12",REG_SZ);
-------------
windows = Window.EnumerateTitles();
window_name = "Program Manager";
for handle, title in pairs (windows) do
result = String.Find(title, window_name, 1, false);
if (result ~= -1) then
Window.Close(handle, CLOSEWND_TERMINATE);
end
end
ستلاحظ عند دخول التجميعية إجراء عملية تحديث موضوعة قصدا
حتى يتم تخفيض مستوى الامان مباشرة
موفق أخي :abc_138: