(1) hDC for a picture box? (2) AddressOf? (3) App.Instance?
Hi,
I just downloaded Jabaco, and to try it out I started with converting a (relatively simple) program from VB6 (a small tool that was first written in VB3, and that I've been updating and whenever necessary).
I hit quite a lot of errors.
unimportant:
things I couldn't solve:
Anyway - I replaced <picturebox>.hDC with Jabaco's <picturebox>.ImageBuffer for now (would that work?) but I still can't test my program...
The compiler stops at AddressOf MouseProc, saying it expects a closing bracket )
What am I doing wrong? Is AddressOf not supported?
Thanks for any help you can give me.
I just downloaded Jabaco, and to try it out I started with converting a (relatively simple) program from VB6 (a small tool that was first written in VB3, and that I've been updating and whenever necessary).
I hit quite a lot of errors.
unimportant:
- had to remove DefLNG (and declare all my variables as Long) -> is there a Jabaco equivalent for DefLNG, DefINT
things I couldn't solve:
- <picturebox>.hDC wasn't recognized. In VB6 (and lower) a picturebox has a handle to its own Device Context. In Jabaco a picturebox doesn't seem to have a DC?
Anyway - I replaced <picturebox>.hDC with Jabaco's <picturebox>.ImageBuffer for now (would that work?) but I still can't test my program...
- ... because the next error occured in my mousehook-module:
|
|
Source code |
1 |
hHook = SetWindowsHookEx(WH_MOUSE_LL, AddressOf MouseProc, App.hInstance, 0) |
The compiler stops at AddressOf MouseProc, saying it expects a closing bracket )
What am I doing wrong? Is AddressOf not supported?
- also, App.Instance doesn't seem to be recognized anymore?
Thanks for any help you can give me.
Hello Mark,
welcome at Jabaco.
Your questions are not easy to answer, because they are very Windows specific and also the topic is very complicated. I will try to give you a DC answer:
The hDC of a PictureBox in VB is very easy to find out. VB create a PictureBox as a window with CreateWindowEx and the class ThunderPictureBox. So you can use the API functions GetDC and GetWindowDC. The device context is Windows specific, look here for further explanation. It is in Jabaco (Java) not the same. Java use an abstraction layer between his language - AWT - and the OS. So far, so good. I think one way is, if you want to use the block transfer functions of the GDI, to create your own PictureBox. Another (better) way is - for OS indenpendency -, to use equivalent Java functions. So far I know, Jabaco does not support DC, now it is necessary to help yourself. I do not know a solution.
I think you do nothing wrong. It is a difference to use VB or Java - in Jabaco disguise.
Your questions give an interesting perspective: Where is the frontier to convert VB projects with Jabaco to Java? Under which circumstances is a conversion still be worth? How many amd which Windows specific commands can be use until a conversion is to extensive and complex? What is an equivalent from a WinAPI command to a Java command?
I am so sorry that I cannot say more, but hope that helps a little.
Cheers
Stefan
welcome at Jabaco.
Your questions are not easy to answer, because they are very Windows specific and also the topic is very complicated. I will try to give you a DC answer:
The hDC of a PictureBox in VB is very easy to find out. VB create a PictureBox as a window with CreateWindowEx and the class ThunderPictureBox. So you can use the API functions GetDC and GetWindowDC. The device context is Windows specific, look here for further explanation. It is in Jabaco (Java) not the same. Java use an abstraction layer between his language - AWT - and the OS. So far, so good. I think one way is, if you want to use the block transfer functions of the GDI, to create your own PictureBox. Another (better) way is - for OS indenpendency -, to use equivalent Java functions. So far I know, Jabaco does not support DC, now it is necessary to help yourself. I do not know a solution.
I think you do nothing wrong. It is a difference to use VB or Java - in Jabaco disguise.
Your questions give an interesting perspective: Where is the frontier to convert VB projects with Jabaco to Java? Under which circumstances is a conversion still be worth? How many amd which Windows specific commands can be use until a conversion is to extensive and complex? What is an equivalent from a WinAPI command to a Java command?
I am so sorry that I cannot say more, but hope that helps a little.
Cheers
Stefan
Hello Mark,
here is a small solution to get the hInstance and a little bit more:
Cheers
Stefan
here is a small solution to get the hInstance and a little bit more:
|
|
Jabaco Source |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
'-Begin----------------------------------------------------------------- '-External functions-------------------------------------------------- Private WinAPI Function GetWindowLong Lib "user32.dll" _ Alias "GetWindowLongA" (ByVal hwnd As Long, _ ByVal nIndex As Long) As Long Private WinAPI Function GetCurrentThreadId Lib "kernel32.dll" _ () As Long Private WinAPI Function GetCurrentProcessId Lib "kernel32.dll" _ () As Long Private WinAPI Function FindWindow Lib "user32.dll" _ Alias "FindWindowA" (ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long '-Constants----------------------------------------------------------- Private Const GWL_HINSTANCE As Long = -6 '-Function hInstance-------------------------------------------------- Public Function hInstance() As Long Dim hWnd As Long If LCase(Left(java#lang#System.getProperty("os.name"), 3)) = "win" Then hWnd = FindWindow("SunAWTFrame", Form1.Caption) If hWnd Then hInstance = GetWindowLong(hWnd, GWL_HINSTANCE) Else hInstance = vbNull End If Else hInstance = vbNull End If End Function '-Function ProcessID-------------------------------------------------- Public Function ProcessID() As Long If LCase(Left(java#lang#System.getProperty("os.name"), 3)) = "win" Then ProcessID = GetCurrentProcessId() Else ProcessID = vbNull End If End Function '-Function ThreadID--------------------------------------------------- Public Function ThreadID() As Long If LCase(Left(java#lang#System.getProperty("os.name"), 3)) = "win" Then ThreadID = GetCurrentThreadId() Else ThreadID = vbNull End If End Function '-End------------------------------------------------------------------- |
Cheers
Stefan
Almost Bitblt
Hi guys,
These work quite well for me...
picDest.PaintPicture picSrc.Image,X1,Y2,OpCode
OR
picDest.PaintPicture picSrc.Image,X1,Y2,Width,Height,X2,Y2,Width2,Height2
This mimics Bitblt, and since its an built in 'function/method' in Jabaco, I would hope to assume its OS independent?
Thanks,
Jason
These work quite well for me...
picDest.PaintPicture picSrc.Image,X1,Y2,OpCode
OR
picDest.PaintPicture picSrc.Image,X1,Y2,Width,Height,X2,Y2,Width2,Height2
This mimics Bitblt, and since its an built in 'function/method' in Jabaco, I would hope to assume its OS independent?
Thanks,
Jason
This post has been edited 1 times, last edit by "jayess" (Feb 18th 2010, 12:14am)
Answers
Hi,
Is there really anybody that can answer this questions except oneself?
The answer could be short: we do not know until we try.
Another question that should be added:
What shifts the frontier?
The more needs you will have to make your program independent from the operating system the more you are willing to try it.
How many Operating systems do exist?
* MacOS-X
* Linux (SUSE, Ubuntu...)
* Windows (..., XP, Vista, 7)
(sorry for the short lists
And how many solutions do exist to create programs that dance on all the worlds?
JavaVM, Qt, .Net+Mono
These somewhat big frameworks give you a layer above the operating system.
More or less they are a kind of operating system themselves.
regards
OlimilO
excellent!
Quoted
* Where is the frontier to convert VB projects to Jabaco/Java?
* Under which circumstances is a conversion still be worth?
* How many and which Windows specific commands can be use until a conversion is to extensive and complex?
* What is an equivalent from a WinAPI command to a Java command?
Is there really anybody that can answer this questions except oneself?
The answer could be short: we do not know until we try.
Another question that should be added:
What shifts the frontier?
The more needs you will have to make your program independent from the operating system the more you are willing to try it.
How many Operating systems do exist?
* MacOS-X
* Linux (SUSE, Ubuntu...)
* Windows (..., XP, Vista, 7)
(sorry for the short lists
And how many solutions do exist to create programs that dance on all the worlds?
JavaVM, Qt, .Net+Mono
These somewhat big frameworks give you a layer above the operating system.
More or less they are a kind of operating system themselves.
It would be great to have AddressOf and it could be possible if the compiler would support it.
Quoted
The compiler stops at AddressOf MouseProc, saying it expects a closing bracket )
What am I doing wrong? Is AddressOf not supported?
regards
OlimilO
Similar threads
-
Tips, Tricks, Samples & Tutorials »-
Resources
(Mar 11th 2009, 2:57pm)
-
History & News »-
RELEASE: Jabaco 1.4.2 BETA - 2009-06-21
(Jun 21st 2009, 7:28pm)
-
General topics, questions and discussions »-
Help with VB5 Module
(May 4th 2009, 2:54pm)
-
General topics, questions and discussions »-
Loadpicture
(Dec 22nd 2008, 2:47am)
