This simple API code chunk draws a box in VB but doesn't in eVB - WHY O' WHY? 
Author Message
 This simple API code chunk draws a box in VB but doesn't in eVB - WHY O' WHY?

I must be missing something and need someone with a fresh perspective
to look the following code over and give me some advice.  All I'm
trying to do is draw a nice red box in the upper left hand corner of a
form.  When I run the following code in VB it works but when I run it
in eVB it doesn't!  I've tried it in the emulator as well as on the
palm device. I click the command button and it does nothing. It
doesn't hang or anything like that it just doesn't do anything.

With the exception of changing all the library references to "coredll"
for the eVB version the code is exactly the same.

Option Explicit

Dim thWnd As Long
Dim thdc As Long
Dim hBrush As Long
Dim hOldBrush As Long

Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor
As Long) As Long

Private Declare Function Rectangle Lib "gdi32" (ByVal thdc As Long,
ByVal nLeftRect As Integer, ByVal nTopRect As Integer, ByVal
nRightRect As Integer, ByVal nBottomRect As Integer) As Boolean

Private Declare Function SelectObject Lib "gdi32" (ByVal thdc As Long,
ByVal hgdiobj As Long) As Long

Private Declare Function DeleteObject Lib "gdi32" (ByVal hobject As
Long) As Boolean

Private Declare Function ReleaseDC Lib "user32" (ByVal thWnd As Long,
ByVal thdc As Long) As Boolean

Private Sub Command1_Click()
  Dim x
  thWnd = Form1.hWnd
  thdc = Form1.hDC
  hBrush = CreateSolidBrush(255)
  hOldBrush = SelectObject(thdc, hBrush)
  x = Rectangle(thdc, 10, 10, 100, 100)
  x = SelectObject(thdc, hOldBrush)
  x = DeleteObject(hBrush)
  x = ReleaseDC(thWnd, thdc)
End Sub



Sat, 24 Jan 2004 05:43:20 GMT  
 This simple API code chunk draws a box in VB but doesn't in eVB - WHY O' WHY?
gdi32.dll and user32.dll do not exist in windows ce. The functions you need
might be in coredll.dll

-Terry


Quote:
> I must be missing something and need someone with a fresh perspective
> to look the following code over and give me some advice.  All I'm
> trying to do is draw a nice red box in the upper left hand corner of a
> form.  When I run the following code in VB it works but when I run it
> in eVB it doesn't!  I've tried it in the emulator as well as on the
> palm device. I click the command button and it does nothing. It
> doesn't hang or anything like that it just doesn't do anything.

> With the exception of changing all the library references to "coredll"
> for the eVB version the code is exactly the same.

> Option Explicit

> Dim thWnd As Long
> Dim thdc As Long
> Dim hBrush As Long
> Dim hOldBrush As Long

> Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor
> As Long) As Long

> Private Declare Function Rectangle Lib "gdi32" (ByVal thdc As Long,
> ByVal nLeftRect As Integer, ByVal nTopRect As Integer, ByVal
> nRightRect As Integer, ByVal nBottomRect As Integer) As Boolean

> Private Declare Function SelectObject Lib "gdi32" (ByVal thdc As Long,
> ByVal hgdiobj As Long) As Long

> Private Declare Function DeleteObject Lib "gdi32" (ByVal hobject As
> Long) As Boolean

> Private Declare Function ReleaseDC Lib "user32" (ByVal thWnd As Long,
> ByVal thdc As Long) As Boolean

> Private Sub Command1_Click()
>   Dim x
>   thWnd = Form1.hWnd
>   thdc = Form1.hDC
>   hBrush = CreateSolidBrush(255)
>   hOldBrush = SelectObject(thdc, hBrush)
>   x = Rectangle(thdc, 10, 10, 100, 100)
>   x = SelectObject(thdc, hOldBrush)
>   x = DeleteObject(hBrush)
>   x = ReleaseDC(thWnd, thdc)
> End Sub



Mon, 02 Feb 2004 08:29:56 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Why doesn't this simple code work!!!!

2. Simple but doesn't work - why?

3. Why doesn't this simple thing work?

4. Why doesn't this simple piece of work (CommonDialog1.ShowColor)

5. GetCurrentDirectory() API - Why doesn't it work???

6. GetCurrentDirectory() API - Why doesn't it work???

7. Code doesn't work, why?

8. why this code doesn't work?

9. Why doesn't these codes work?

10. Validate Code - Why doesn't this work!?

11. why doesn't this code work?

12. Why doesn't this code work on win 2000

 

 
Powered by phpBB® Forum Software