Using Paintdesktop (user32.dll) in PowerBuilder 11.5

Dear all,

Is'it posible using API PaintDesktop in PB, once it works in VB, how to make 
it work in PB?
The purpose of this API is to copy wallpaper into a form-VB(window-PB).

Private Declare Function PaintDesktop Lib "user32" (ByVal hdc As Long) As
Long

in Form_Paint() event:
Private Sub Form_Paint()
PaintDesktop Me.hdc
End Sub

it works fine in VB, how to make it works in PB?
TIA 


0
ekologi
3/19/2009 1:51:40 AM
sybase.powerbuilder.general 62418 articles. 17 followers. Follow

5 Replies
1088 Views

Similar Articles

[PageSpeed] 8

PowerBuilder windows don't have hdc as a property, you need to get it using 
an API function.

Function long GetDC ( long hWnd ) Library "user32.dll"
Function boolean PaintDesktop ( long hdc ) Library "user32.dll"

Long ll_hDC

ll_hDC = GetDC(Handle(This))
PaintDesktop(ll_hDC)


I tried this and it does work, assuming that 'This' refers to the window. 
One problem it has, if another window crosses in front of yours, the image 
gets wiped out.

I mapped the pbm_paint event to my window and put the code in there. It took 
care of repainting when other windows wiped out portions of the window.


0
Roland
3/19/2009 1:25:24 PM
I did this in PB10, should be the same.

Somethimes when I moved the window really quickly, it would paint the image 
outside the window boundary or on it's own title bar. Not sure what the 
cause of that is. You can play around with it to see if you can get it to 
work smoothly. Perhaps you can put the GetDC in the window open event and 
store the hdc in an instance var. Then the paint event would just have the 
PaintDesktop function.

"Roland Smith [TeamSybase]" <rsmith_at_trusthss_dot_com> wrote in message 
news:49c247c4@forums-1-dub...
> PowerBuilder windows don't have hdc as a property, you need to get it 
> using an API function.
>
> Function long GetDC ( long hWnd ) Library "user32.dll"
> Function boolean PaintDesktop ( long hdc ) Library "user32.dll"
>
> Long ll_hDC
>
> ll_hDC = GetDC(Handle(This))
> PaintDesktop(ll_hDC)
>
>
> I tried this and it does work, assuming that 'This' refers to the window. 
> One problem it has, if another window crosses in front of yours, the image 
> gets wiped out.
>
> I mapped the pbm_paint event to my window and put the code in there. It 
> took care of repainting when other windows wiped out portions of the 
> window.
>
> 


0
Roland
3/19/2009 1:50:10 PM
I seem to remember from my Petzold days that you

GetDC
....use DC...
ReleaseDC

in WM_PAINT or you run out of DCs. I could be wrong; it's not a place I want 
to go back to...

Regards
Clive

"Roland Smith [TeamSybase]" <rsmith_at_trusthss_dot_com> wrote in message 
news:49c24d92$1@forums-1-dub...
>I did this in PB10, should be the same.
>
> Somethimes when I moved the window really quickly, it would paint the 
> image outside the window boundary or on it's own title bar. Not sure what 
> the cause of that is. You can play around with it to see if you can get it 
> to work smoothly. Perhaps you can put the GetDC in the window open event 
> and store the hdc in an instance var. Then the paint event would just have 
> the PaintDesktop function.
>
> "Roland Smith [TeamSybase]" <rsmith_at_trusthss_dot_com> wrote in message 
> news:49c247c4@forums-1-dub...
>> PowerBuilder windows don't have hdc as a property, you need to get it 
>> using an API function.
>>
>> Function long GetDC ( long hWnd ) Library "user32.dll"
>> Function boolean PaintDesktop ( long hdc ) Library "user32.dll"
>>
>> Long ll_hDC
>>
>> ll_hDC = GetDC(Handle(This))
>> PaintDesktop(ll_hDC)
>>
>>
>> I tried this and it does work, assuming that 'This' refers to the window. 
>> One problem it has, if another window crosses in front of yours, the 
>> image gets wiped out.
>>
>> I mapped the pbm_paint event to my window and put the code in there. It 
>> took care of repainting when other windows wiped out portions of the 
>> window.
>>
>>
>
> 


0
Clive
3/19/2009 5:03:28 PM
Thanks alot, it works
"Roland Smith [TeamSybase]" <rsmith_at_trusthss_dot_com> wrote in message 
news:49c24d92$1@forums-1-dub...
>I did this in PB10, should be the same.
>
> Somethimes when I moved the window really quickly, it would paint the 
> image outside the window boundary or on it's own title bar. Not sure what 
> the cause of that is. You can play around with it to see if you can get it 
> to work smoothly. Perhaps you can put the GetDC in the window open event 
> and store the hdc in an instance var. Then the paint event would just have 
> the PaintDesktop function.
>
> "Roland Smith [TeamSybase]" <rsmith_at_trusthss_dot_com> wrote in message 
> news:49c247c4@forums-1-dub...
>> PowerBuilder windows don't have hdc as a property, you need to get it 
>> using an API function.
>>
>> Function long GetDC ( long hWnd ) Library "user32.dll"
>> Function boolean PaintDesktop ( long hdc ) Library "user32.dll"
>>
>> Long ll_hDC
>>
>> ll_hDC = GetDC(Handle(This))
>> PaintDesktop(ll_hDC)
>>
>>
>> I tried this and it does work, assuming that 'This' refers to the window. 
>> One problem it has, if another window crosses in front of yours, the 
>> image gets wiped out.
>>
>> I mapped the pbm_paint event to my window and put the code in there. It 
>> took care of repainting when other windows wiped out portions of the 
>> window.
>>
>>
>
> 

0
ekologi
3/19/2009 5:31:08 PM
At first I had ReleaseDC but I noticed this in the documentation:

Class and private device contexts do not have to be released.

So I went on the assumption that it would be a class context. I could be 
wrong.


"Clive Collie" <clive_doesnt_like_spam@dillistone.com> wrote in message 
news:49c27ae0$1@forums-1-dub...
>I seem to remember from my Petzold days that you
>
> GetDC
> ...use DC...
> ReleaseDC
>
> in WM_PAINT or you run out of DCs. I could be wrong; it's not a place I 
> want to go back to...
>
> Regards
> Clive
>
> "Roland Smith [TeamSybase]" <rsmith_at_trusthss_dot_com> wrote in message 
> news:49c24d92$1@forums-1-dub...
>>I did this in PB10, should be the same.
>>
>> Somethimes when I moved the window really quickly, it would paint the 
>> image outside the window boundary or on it's own title bar. Not sure what 
>> the cause of that is. You can play around with it to see if you can get 
>> it to work smoothly. Perhaps you can put the GetDC in the window open 
>> event and store the hdc in an instance var. Then the paint event would 
>> just have the PaintDesktop function.
>>
>> "Roland Smith [TeamSybase]" <rsmith_at_trusthss_dot_com> wrote in message 
>> news:49c247c4@forums-1-dub...
>>> PowerBuilder windows don't have hdc as a property, you need to get it 
>>> using an API function.
>>>
>>> Function long GetDC ( long hWnd ) Library "user32.dll"
>>> Function boolean PaintDesktop ( long hdc ) Library "user32.dll"
>>>
>>> Long ll_hDC
>>>
>>> ll_hDC = GetDC(Handle(This))
>>> PaintDesktop(ll_hDC)
>>>
>>>
>>> I tried this and it does work, assuming that 'This' refers to the 
>>> window. One problem it has, if another window crosses in front of yours, 
>>> the image gets wiped out.
>>>
>>> I mapped the pbm_paint event to my window and put the code in there. It 
>>> took care of repainting when other windows wiped out portions of the 
>>> window.
>>>
>>>
>>
>>
>
> 


0
Roland
3/20/2009 11:51:39 AM
Reply:

Similar Artilces:

Use PowerBuilder DLL in PowerBuilder
We use PB6.5. We would want to use a DLL create from PB in a PB application. We compiled an a PBL as DLL. After we tried to use DLL in a user object external, but without success. How can we do to use DLL create from PB or use in a new PB application some object (visual and no) before compiled with PB? Any help will be appreciated. Saul.Convalle@mail.cec.it Thanks When you create a DLL from a PB library it is not really a standard Windows DLL. I'm not sure what the difference is. If you are making calls from PB then just use the standard PB calling syntax the ...

using c# generated dll inside powerbuilder 11.5
HI there BAckground> I building my dll inside c# in VS2010 using .net 2.0. I would like to use this simple dll which gets Outlook data from the clipboard and generates a file inside my powerbuilder application. So nothing too fancy. Please help. I have seen some examples of how this should work, but having followed a lot of them i still can not get this to do the job. Basically I created a simple c# class and I have the dll. IN the options I set cominterop and under the namespace in the class I entered > [ComVisible(true)] [ClassInterface(ClassInterfaceTy...

PowerBuilder 10.5.2 Build 7826 differs from PowerBuilder 11.5.1 Build 4675
Apparently there's some data conversion issues that differ from PowerBuilder 10.5.2 and 11.5.1 (builds listed in subject). The following mini scrip results in different returned values: Byte lb_test Decimal ld_test lb_test = 48 ld_test = Dec(lb_test) MessageBox("Test", String(ld_test)) In PowerBuilder 10.5.2, the messagebox displays the value "48". In PowerBuilder 11.5.1 the messagebox displays the value "0.48". It appears that in PB 11.5.1, it's dividing the result by 100 for some reason. It appears to be a bug, just wanted to ve...

Problem registering dll created in Powerbuilder 8 and migrated to Powerbuilder 11
Hi, We have created a dll in Powerbuilder 8 as a com/mts application. This dll was then migrated to powerbuilder 11.1 build 8204. I am able to build the dll on my development machine and properly register the dll on my development machine on windows 7. When i deploy my dll and test application to a clean windows xp box, i am unable to register my dll using regsvr32. No error is displayed and the message box identifing that the registration was successful is never displayed. I have deployed all Powerbuilder 11 runtime using the powerbuilder runtime packager. I also deployed...

How to dial-up a modem using powerbuilder 11.5
Dear all, I want to dial a modem to connect to the internet from powerbuilder 11.5, Is it posible to do this with powerbuilder. TIA I found http://www.rgagnon.com/pbdetails/pb-0021.html but it's pretty sparse - you'd have to look up that module in the Microsoft web site to figure out how to set up the "YourConnection". http://www.pbdr.com/software/comp/rasdial.zip sounds interesting but I haven't looked inside it. -- Report Bugs to Sybase: http://case-express.sybase.com/cx/welcome.do Product Enhancement Requests: http://my.isug.com/cgi-bin/1/c...

Powerbuilder 5 to Powerbuilder 10
Hi all We have migrated our application from powerbuilder 5 to powerbuilder 10. after migration to version 10, alignment in most of reports disturbed. please advice me some solution. On Fri, 29 Feb 2008 12:45:01 +0100, Adnan Jamil <adnanjamil@nji.com.pk> wrote: > Hi all > > We have migrated our application from powerbuilder 5 to powerbuilder 10. > after migration to version 10, alignment in most of reports disturbed. > please advice me some solution. Adnan, Is this a SQL Anywhere question? If not, you have posted to the wrong forum. If yes,...

Help - About external function from PowerBuilder 11.5
I am trying to call a windows wrapper getusername in advapi32.dll from my powerbuilder source code, but failing. This is because the active directory is either not installed or is not enabled.Is my understanding right? How do i check if active directory is enabled or not? And can anyone pls confirm that active directory should be enabled for functios in advapi32.dll to work? Pls help ...its urgent need Hi Sap; I would not even bother ... just wrap the GetUserName ( ) method call in a TRY...CATCH and issue an error if the command fails. Food for thought. Regards ... Chris ...

Using Intersolv 3.01 ODBC Drivers with PowerBuilder 11.5
Hi, Does anyone know if it possible to use the Intersolv 3.01 ODBC drivers with PowerBuilder 11.5? We are upgrading our apps from PB10.5 to PB11.5. The Intersolv ODBC drivers were okay in PB10.5 but no longer works in PB11.5. We got the Intersolv ODBC drivers with PB5 and have been using them with all the PB upgrades without any problems until PB11.5. When I try to use the Intersolv ODBC drivers with PB11.5 I get the following message =93[INTERSOLV][ODBC dBase driver]You are not licensed to use this INTERSOLV ODBC Driver under the license you have purchased. If you wish ...

How do I call a com dll written in c++ using PowerBuilder 6.5???
Environment : Win Nt Wks 4.0 SP4 PowerBuilder 6.5 hi, I have written a com dll using c++ (ATL dev studio 6.0) and I now have to call the dll form a powerbuilder app. How do I call my com dll from my powerbuilder app??? Thanks Sunit On Tue, 9 Feb 1999 20:37:50 -0600, "Senna" <puto@execpc.com> wrote: I believe you use the ConnectToNewRemoteObject function to do this. You will have to make sure your COM object is registered, however. HTH Jon Credit[TeamPS] CPD Professional PB6 JCredit@Sprynet.com http://home.sprynet.com/sprynet/jcredit >E...

Powerbuilder 11.1 using WebServices .net 3.5 Framework
Hi All, I've created a "Hello World" web service using Visual Studio 2008 with 3.5 .net Framework, tested the web service and it works fine. Deployed the web service to a IIS 5.0 Web server on Windows XP Pro; now I'm trying to generate the WebService proxy in PB 11.1. I've set the WSDL engine to ".Net", point to the IIS server for the ".asmx" file for the WSDL location. When I try to deploy the project, I keep getting the following error. "Cannot access the WSDL or the WSDL file is invalid. (file://bla bla bla) Is PB compatiable wi...

Powerbuilder 11.5/EAServer5.5 ConnectToServer
OK, I don't have to configure development stations every day in fact the last time was 4+ years ago. I know this is simple but it's not coming to me at the moment. I've installed Powerbuilder 11.5. I've installed EAServer 5.5. I can connect to my server through EAServer manager. I can deploy objects from PB into EAServer. When I run my application, I'm getting a connecttoserver error 57, not connected to the server. application = 'PACKAGE01' /* Package on EAServer connectstring = '' location = 'laptop:9000' /* EAserver locat...

Upgrade from powerbuilder 10.5 to 11.5
Hi, were are investigating the process of upgrading powerbuilder 105 to powerbuilder 11.5. are there any steps to watch out for. my initial plan is to backup the current source. Copy the source to a temp location. Perform an upgrade of PB10.5 to 11.5 and 'upgrade' the source. Does this sound about right at all? Many Thanks Anish, although I'm not a [TeamSybase] member, we have converted over 25 applications (most very large) from PB 10.5 to PB 11.5 without any problems (no additional steps or changes to objects or code was required, for us at least). The only cav...

PowerBuilder 11.5 does not disconnect from SQL Server 2005 using ADO.Net
Hi. I'm work with PowerBuilder 11.5 Build 4566 and SQLServer 2005 SP2 and try to disconnect using sqlca; but don`t work using ADO.Net driver. Help me please. Thanks Marcelo Pe´┐Żailillo ...

Oracle 10g Database connectivity in PowerBuilder 11.5 Desktop Version using ODBC
This is a multi-part message in MIME format. ---=_forums-1-dub4940f6b1 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Hi, I have installed PB 11.5 Desktop version with all the EBF`s. I created a DSN for the Oracle 10g default ('Orcl') database through ODBC Administrator. I was successfully able to connect to the database through the DSN. Now I created a Database Profile in PowerBuilder 11.5 Desktop version for the DSN created above. When I tried testing the database connection I got the errors present in attached in document...

Web resources about - Using Paintdesktop (user32.dll) in PowerBuilder 11.5 - sybase.powerbuilder.general

Resources last updated: 12/29/2015 2:51:04 AM