الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

برامج visual Basic 6 و Windows XP

مغلق
بدأه IUnknown في 18 مايو 2006 · 4 رد · 1,492 مشاهدة · في لغة Ms Visual Basic 6 وما قبلها من إصدارات
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

عند عمل برامج باستخدا VB6 وتشغيلها في XP لا تأخذ نفس الشكل بل تظل كلاسيكيه :rolleyes: اقصد هنا الcontrols من Buttons, scrollbars , combo boxes الخ الخ

هل من الممكن ان اقوم بعمل برنامج باستخدام VB6 وعند تشغيلع في XP يحصل على الشكل الجديد ؟؟

When all else fails, read the instructions.

If there is a possibility of several things going wrong the one that will cause the most damage will be the one to go wrong.

No Matter how many times you repeat, there will be someone not listening .

To beat the bureaucracy, make your problem their problem

55926083.png

#2

هل حاول احد البحث عن حل لهذه المشكلة ام انني اول من فكر فيها :) لا أظن ذلك. عموما انا عندي حل لها ولكن هل من مهتم. ام أن VB.NET قد استحوذ على جميع مبرمجي VB6

حاليا كتب C# ولكن تظل VB6 كاللغة العربية بالنسبة لي

When all else fails, read the instructions.

If there is a possibility of several things going wrong the one that will cause the most damage will be the one to go wrong.

No Matter how many times you repeat, there will be someone not listening .

To beat the bureaucracy, make your problem their problem

55926083.png

#3

راجع مخوضوعي في الأسفل "تفعيل ستايل ويندوز أكس بي على vb 2003 ونفذ نفس

الطريقة

-_- -_- -_-

#4

شكرا لك يا أخي على اهتمامك . والحل الذي ذكرته فعلا هو الحل لهذه المعضله.

Hi all ;

I read this article and I think many of us may need to be aware of it. When you run a Visual Basic application on an XP machine, you will see that although the form gets an XP-style title bar, the controls on the form still draw in the old-fashioned Windows style. However, it doesn't take much to persuade an application to use the new styles. In some cases, you can get existing applications to use the new styles with no additional code whatsover.

The New XP Styles

The Windows XP Visual Styles are provided by ComCtl32.dll version 6 or later. (In fact, anyone who is as old as me and remembers back to Visual Basic 3 may find this familiar, since the exciting 3D control look which was provided with Windows 95 was also implemented in the same way). Note that unlike previous versions of this DLL, version 6 is not redistributable - which sadly means you can only use the visual styles on an operating system that has this version installed. At the time of writing this means XP only.

ComCtl32 does not apply the latest styles to the client area of an application by default. In order to enable it, you need to ensure that your application is linked to ComCtl32.dll (by calling the ComCtl InitCommonControls API call) and then you need to provide a Manifest which specifies that the new version of the control styles should be used.

Manifests

Manifests are part of the technologies introduced by Microsoft to attempt to resolve the DLL versioning conflicts (normally referred to as DLL hell) so common in Windows development. You can read more about these technologies and manifests in the Windows XP Technical Article "How To Build and Service Isolated Applications and Side-by-Side Assemblies for Windows XP" at MSDN. However, for this article all you need to know is that to use version 6 of the common controls you need to be able to provide an XML document known as a Manifest to ComCtl32.

The manifest XML document required to use XP Visual Styles is as follows:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<assemblyIdentity

version="1.0.0.0"

processorArchitecture="X86"

name="CompanyName.YourAppName"

type="win32" />

<description>Your application description here</description>

<dependency>

<dependentAssembly>

<assemblyIdentity

type="win32"

name="Microsoft.Windows.Common-Controls"

version="6.0.0.0"

processorArchitecture="X86"

publicKeyToken="6595b64144ccf1df"

language="*" />

</dependentAssembly>

</dependency>

</assembly>

Note that the name attribute and the description element are essentially free text.

Ensuring Your Application Links to ComCtl32.dll

If you provide a manifest, but your application does not link to ComCtl32.dll, then it will fail to load - sometimes with no error message!. You need to call at least InitCommonControls before any visual elements are displayed. Sometimes, you don't need to do anything because your application may already link to ComCtl32.dll (for example, if it includes any of the Windows Common Controls provided with Visual Basic), however, to be certain it works it is best to call InitCommonControls prior to displaying any forms.

Here is the code you need at the start of your application to ensure you've linked to ComCtl32.dll:

Private Type tagInitCommonControlsEx

lngSize As Long

lngICC As Long

End Type

Private Declare Function InitCommonControlsEx Lib "comctl32.dll" _

(iccex As tagInitCommonControlsEx) As Boolean

Private Const ICC_USEREX_CLASSES = &H200

Public Function InitCommonControlsVB() As Boolean

On Error Resume Next

Dim iccex As tagInitCommonControlsEx

' Ensure CC available:

With iccex

.lngSize = LenB(iccex)

.lngICC = ICC_USEREX_CLASSES

End With

InitCommonControlsEx iccex

InitCommonControlsVB = (Err.Number = 0)

On Error Goto 0

End Function

Public Sub Main()

InitCommonControlsVB

'

' Start your application here:

'

End Sub

Providing the Manifest

There are two ways to provide the manifest: the simplest (but least elegant) way is to provide the manifest on disk for an executable. Let's say your application is called TimeSlot.exe. Then if you save the manifest XML above as TimeSlot.exe.manifest

in the same directory as the executable, TimeSlot.exe will automatically get the XP styles. VB5 and VB6 examples are provided. If you rename the .manifest file prior to running the app, you can switch off the XP styles. A more robust method is to compile the manifest as a resource in your application. To do this, the manifest must appear as resource type RT_MANIFEST (24) with id CREATEPROCESS_MANIFEST_RESOURCE_ID (1). For some bizarre reason, you must also ensure that the resulting XML file is an even multiple of 4 bytes long. So for example, if your file is actually 597 bytes you need to add padding spaces to make up the file size to 600 bytes before compiling. The Resource examples demonstrate how to create this resource file using a resource compiler script (.rc file) and RC.exe.

Some Notes

XP styles do not apply during development time, only at run time. Test your executable frequently.

Option buttons do not seem to draw correctly when placed on a frame, particularly with VB6. You must place your option boxes onto a picture box.

3D borders on PictureBoxes, Images and so on do not draw in the new XP style, which is a single line in some combination of the highlight color and the form background

أرجو ان تكون مفيده

When all else fails, read the instructions.

If there is a possibility of several things going wrong the one that will cause the most damage will be the one to go wrong.

No Matter how many times you repeat, there will be someone not listening .

To beat the bureaucracy, make your problem their problem

55926083.png

#5
اقتباس
عموما انا عندي حل لها ولكن هل من مهتم. ام أن VB.NET قد استحوذ على جميع مبرمجي VB6

حاليا كتب C# ولكن تظل VB6 كاللغة العربية بالنسبة لي

في حال كنت تعرف معلومة يمكنك إضافتها مباشرة ...

بالتوفيق ...

ani.gif

هذا الموضوع مغلق.

مواضيع مشابهة