473,480 Members | 1,871 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Using Winapi

Hi,

I tried to use Winapi floodfill function with an Access Form. Here is the
code in a click-button sub :

Dim hDC As Long
Dim hBrush As Long
Dim hobj As Long
Dim ret As Long

hDC = GetDC(Me.hwnd)
hBrush = CreateSolidBrush(65280)
hobj = SelectObject(hDC, hBrush)
ret = FloodFill(hDC, 50, 50, 0)
ret = GetLastError()
ret = DeleteObject(hBrush)
ret = ReleaseDC(hwnd, hDC)

When I click the button, the sub executes but nothing happens. I got the
same result using Winapi fillrect function.

What's wrong?
Feb 19 '07 #1
5 4163
On Feb 19, 6:19 pm, "Michel" <michelpara...@yahoo.cawrote:
Hi,

I tried to use Winapi floodfill function with an Access Form. Here is the
code in a click-button sub :

Dim hDC As Long
Dim hBrush As Long
Dim hobj As Long
Dim ret As Long

hDC = GetDC(Me.hwnd)
hBrush = CreateSolidBrush(65280)
hobj = SelectObject(hDC, hBrush)
ret = FloodFill(hDC, 50, 50, 0)
ret = GetLastError()
ret = DeleteObject(hBrush)
ret = ReleaseDC(hwnd, hDC)

When I click the button, the sub executes but nothing happens. I got the
same result using Winapi fillrect function.

What's wrong?

I see you included GetLastError().
Did you check the result and see what (if any) the last error was?
It may give you a hint.

Feb 20 '07 #2
No hint at all: it's zero. And return code from floodfill is zero too, which
means "failure".

"storrboy" <st******@sympatico.caa écrit dans le message de news:
11**********************@v33g2000cwv.googlegroups. com...
On Feb 19, 6:19 pm, "Michel" <michelpara...@yahoo.cawrote:
Hi,

I tried to use Winapi floodfill function with an Access Form. Here is
the
code in a click-button sub :

Dim hDC As Long
Dim hBrush As Long
Dim hobj As Long
Dim ret As Long

hDC = GetDC(Me.hwnd)
hBrush = CreateSolidBrush(65280)
hobj = SelectObject(hDC, hBrush)
ret = FloodFill(hDC, 50, 50, 0)
ret = GetLastError()
ret = DeleteObject(hBrush)
ret = ReleaseDC(hwnd, hDC)

When I click the button, the sub executes but nothing happens. I got the
same result using Winapi fillrect function.

What's wrong?


I see you included GetLastError().
Did you check the result and see what (if any) the last error was?
It may give you a hint.

Feb 21 '07 #3
No hint at all: it's zero. And return code from floodfill is zero too, which
means "failure".

"storrboy" <st******@sympatico.caa écrit dans le message de news:
11**********************@v33g2000cwv.googlegroups. com...
On Feb 19, 6:19 pm, "Michel" <michelpara...@yahoo.cawrote:
Hi,

I tried to use Winapi floodfill function with an Access Form. Here is
the
code in a click-button sub :

Dim hDC As Long
Dim hBrush As Long
Dim hobj As Long
Dim ret As Long

hDC = GetDC(Me.hwnd)
hBrush = CreateSolidBrush(65280)
hobj = SelectObject(hDC, hBrush)
ret = FloodFill(hDC, 50, 50, 0)
ret = GetLastError()
ret = DeleteObject(hBrush)
ret = ReleaseDC(hwnd, hDC)

When I click the button, the sub executes but nothing happens. I got the
same result using Winapi fillrect function.

What's wrong?


I see you included GetLastError().
Did you check the result and see what (if any) the last error was?
It may give you a hint.

Feb 21 '07 #4
On Feb 21, 12:00 am, "Lise France" <lise.fra...@videotron.cawrote:
No hint at all: it's zero. And return code from floodfill is zero too, which
means "failure".

"storrboy" <storr...@sympatico.caa écrit dans le message de news:
1171941364.149701.305...@v33g2000cwv.googlegroups. com...
On Feb 19, 6:19 pm, "Michel" <michelpara...@yahoo.cawrote:
Hi,
I tried to use Winapi floodfill function with an Access Form. Here is
the
code in a click-button sub :
Dim hDC As Long
Dim hBrush As Long
Dim hobj As Long
Dim ret As Long
hDC = GetDC(Me.hwnd)
hBrush = CreateSolidBrush(65280)
hobj = SelectObject(hDC, hBrush)
ret = FloodFill(hDC, 50, 50, 0)
ret = GetLastError()
ret = DeleteObject(hBrush)
ret = ReleaseDC(hwnd, hDC)
When I click the button, the sub executes but nothing happens. I got the
same result using Winapi fillrect function.
What's wrong?
I see you included GetLastError().
Did you check the result and see what (if any) the last error was?
It may give you a hint.

Found this article on the Access Web and it probably applies to
filling regions.
http://www.mvps.org/access/api/api0053.htm

Feb 21 '07 #5
It's not possible to properly draw and repaint on an Access form without
subclassing. Instead, create a bitmap at runtime containing the desired
rendering and set this as the Picture prop of the form. See:
http://www.lebans.com/gradientfill.htm

If you want to color the MDI window background see:
http://www.lebans.com/changemdibackground.htm

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Michel" <mi***********@yahoo.cawrote in message
news:vk*******************@wagner.videotron.net...
Hi,

I tried to use Winapi floodfill function with an Access Form. Here is the
code in a click-button sub :

Dim hDC As Long
Dim hBrush As Long
Dim hobj As Long
Dim ret As Long

hDC = GetDC(Me.hwnd)
hBrush = CreateSolidBrush(65280)
hobj = SelectObject(hDC, hBrush)
ret = FloodFill(hDC, 50, 50, 0)
ret = GetLastError()
ret = DeleteObject(hBrush)
ret = ReleaseDC(hwnd, hDC)

When I click the button, the sub executes but nothing happens. I got the
same result using Winapi fillrect function.

What's wrong?


Feb 24 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1137
by: sayoyo | last post by:
Hi, Are there any WINAPI or C/C++ functions which allow user to know if a file is using by another application??? Thanks you very much sayoyo
1
2067
by: MuZZy | last post by:
HI, I would really appreciate some hwlp with this: Here is the WinAPI struct used in call to winapi function wavInGetDevCaps: typedef struct { WORD wMid; WORD wPid; MMVERSION...
2
9802
by: Patrick Blackman | last post by:
Need example of using WinAPI "CreateWindowEx" in c# any help would be appreciated.
3
5464
by: Charles Denny | last post by:
I'm trying to call CertFindCertificateInStore to find all certificates in the store that have the Code Signing enhanced key usage. I'm running into problems marshalling the array of OIDs in...
6
1547
by: ian | last post by:
Hi, I keep resorting to com interop calls, for example I needed the location of the carot in a text box and I had to use a win32API call (GetCarotPos??) to do that. It's one example, I could give...
3
8999
by: TBoon | last post by:
How do i read and write ini file using vb.net?
4
3613
by: RhavoX | last post by:
Hi. This may be a very stupid question but I'll leave you to judge it ;) I know there were lots of questions about this but none of the answers suits me. I'm wondering how to get the BINARY type...
11
2668
by: Angus | last post by:
I am working with a C API which often requires a char* or char buffer. If a C function returns a char* I can't use string? Or can I? I realise I can pass a char* using c_str() but what about...
3
3311
by: tw | last post by:
Could someone explain me how to get signal from microphone to program in winapi, (than i want put tone into it) and send to speakers?
0
7046
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7048
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7088
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
6956
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5342
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
2986
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
183
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.