Page 1 of 1

VBA Code crashes on VM but not on the real PC

Posted: 31. Oct 2011, 00:26
by archampi
Hi everybody,

I am new to VirtualBox. I installed it on my PC wich runs Windows 7 64 bits. I use this virtual machine to test a program on Excel VBA that runs perfectly well on my PC (Excel 2007, 32 bits) but fails on the VM (Win 7 64 bits, Excel 2010, 32bits).

I found that the error comes out at the following line of code:

Code: Select all

EnumFontFamiliesA GetDC(0), 0, CallBack1, Fonts 
This is part of a procedure that reads and lists all the available fonts on a machine.
As I said, it works fine one the real machine but crashes on the VM.
Those lines of code are in the Declaration section:

Code: Select all

Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long

Declare Function EnumFontFamiliesA Lib "gdi32" _
  (ByVal hdc As Long, ByVal lpFaceName As Long, _
  ByVal lpFontFunc As String, Fonts As SFont) As Long
Is it a limitation of VirtuelBox or what?

Thanks

Pierre