473,598 Members | 3,252 Online
Bytes | Software Development & Data Engineering Community
+ 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 = CreateSolidBrus h(65280)
hobj = SelectObject(hD C, hBrush)
ret = FloodFill(hDC, 50, 50, 0)
ret = GetLastError()
ret = DeleteObject(hB rush)
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 4173
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 = CreateSolidBrus h(65280)
hobj = SelectObject(hD C, hBrush)
ret = FloodFill(hDC, 50, 50, 0)
ret = GetLastError()
ret = DeleteObject(hB rush)
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******@sympa tico.caa écrit dans le message de news:
11************* *********@v33g2 00...legr oups.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 = CreateSolidBrus h(65280)
hobj = SelectObject(hD C, hBrush)
ret = FloodFill(hDC, 50, 50, 0)
ret = GetLastError()
ret = DeleteObject(hB rush)
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******@sympa tico.caa écrit dans le message de news:
11************* *********@v33g2 00...legr oups.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 = CreateSolidBrus h(65280)
hobj = SelectObject(hD C, hBrush)
ret = FloodFill(hDC, 50, 50, 0)
ret = GetLastError()
ret = DeleteObject(hB rush)
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...@vi deotron.cawrote :
No hint at all: it's zero. And return code from floodfill is zero too, which
means "failure".

"storrboy" <storr...@sympa tico.caa écrit dans le message de news:
1171941364.1497 01.305...@v33g2 000cwv.googlegr oups.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 = CreateSolidBrus h(65280)
hobj = SelectObject(hD C, hBrush)
ret = FloodFill(hDC, 50, 50, 0)
ret = GetLastError()
ret = DeleteObject(hB rush)
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******** ***********@wag ner.videotron.n et...
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 = CreateSolidBrus h(65280)
hobj = SelectObject(hD C, hBrush)
ret = FloodFill(hDC, 50, 50, 0)
ret = GetLastError()
ret = DeleteObject(hB rush)
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
1140
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
2074
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 vDriverVersion;
2
9815
by: Patrick Blackman | last post by:
Need example of using WinAPI "CreateWindowEx" in c# any help would be appreciated.
3
5487
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 _CTL_USAGE. I keep getting a "This type can not be marshalled as a structure field." Does anyone have any ideas as to what I'm doing wrong? Here's the code: namespace CertSignTest { using System;
6
1552
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 several more that have come up over the last few months, and it has raised a couple of questions the answers to which could plug a few holes in my knowledge. First, I'm uncomfortable using API calls purely because I don't fully understand the...
3
9003
by: TBoon | last post by:
How do i read and write ini file using vb.net?
4
3627
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 data from the registry and how to display it as hex in a way I'm showing below. Let's say I use this key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion \Prefetcher The value of LastDiskLayoutTime is: 6A C7 49 ED 50 5F C7 01
11
2692
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 receiving a char buffer into a string? Reason I ask is otherwise I have to guess at what size buffer to create? And then copy buffer to a string. Doesn't seem ideal.
3
3323
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
7987
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7899
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8050
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6718
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5438
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3939
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2412
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 we have to send another system
1
1504
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1250
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.