Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




How Do I Use SetPixel Of Win32API


Hi Gurus!

I'm using SetPixel of Win32API.

First, Load image on Picture control or Image control.
And I'd like to set red color on some area.
How can I do it?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
About Win32api
Declare Function WNetEnumCachedPasswords Lib "mpr.dll" -- how does this api work? ive tried searching for it in msdn but it was not icluded in their library...

Win32api.txt
Hello there guys and gals

I've got a favour to ask, i'm doing a Windows API for a college task,

I need a copy of WIN32API.TXT to view in the API Text Viewer
i'm running win2k so i dont have one, can anyone running 98
copy the above .txt and upload

would be grateful, cant complete task with out it

Win32API
I am able to create a process and send commandline parameters by using Win32 API Visual Basic.But,after creating setup file for the same application and install on another machine only the first charecter of the command line parameter is appended to the command.
Anybody can give the solution for it.

DCB Win32API
Hi,

I know the fxxx of the DCB make up a DWORD data type therefore in my DCB structure in VB I have a type created by the API Viewer in Addins where all the fxx of the DCB structure are represented by one long type call fBitFields. I just need to know if I would be correct in the following:

If I wanted fBinary ON and DTR_CONTROL_ENABLE then I would set fBitFields as follows:
fBitfields = (1 Or DTR_CONTROL_ENABLE)

Is this correct?

Thanks in Advance

KnNeeded

Win32api
how do i use the shellexecute method to open a existing word document. the first parameter it expects is handle to window. pls explain how to use the getwindowhandle fun to get the windows handle.
thanks

Serial Com In Vb With Win32Api
Hi ,

I'm working on a project using the serial com.

Until now I use the Mscomm32 come with VB6, but I don't wanne use this control , I wan't my code to be pure commands - win32Api (what the mscomm use!).

I am trying to find a place I can get material on all the serial communication commands of win32api in visual basic.

Thanks , Moyalt.

Need FULL Win32api.txt
I've got the win32api.txt file that comes with VB6.
However, it's not complete.

I really don't want the full SDK.

Can someone email the complete API text so I can get constants for the VB6 missing items?

whoit@cfl.rr.com

New Version Of WIN32API.TXT
Hello Does any one know where i could download WIN32API.TXT the new verison ?

Files LIKE Win32api.txt
does anyone know where i can get the text files for use with the API viewer that comes with visual studio

all i have is:-

mapi32
win32api

i would like to get info on other useful dll's

any help appreciated!!

If somethings hard to do, its not worth doing - Homer Simpson

Win32API & ActiveX
Is there any way to use the Win32API library in an ActiveX Document EXE (to be used in a web page). When I try to load the page without using the API calls, it works fine. As soon as I attempt to use the API functions, the Windows "Open With" dialog box appears. Any help on this would be appreciated.


-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy

Is Win32API What I Need To Learn?
I have an interrupt driven application to develop which will need to: log in to a secure site, retrieve current data, do math, then enter a different secure site and enter values, then log into another site to send a text message to notify success.

I'm pretty fluent with C/C++ and assembly. I'm presently learning htm/html. Does Win32API have the tools I will need? Should I look into another lang such as PHP, javascript, etc...

Any advise is greatly appreciated.

Thank you,

Where 2 Get Win32api Guide
hi
can anybody tell me from where i can download win32api complete guide(??? of course free)

WIN32API Error Trapping
I wonder if there is an all-purpose question I may pose to the system after a VB API-call to determine SUCCESS of the call (to error-handle in the 'else'-case).

The doc's are confusing: On the one hand they state each .dll has its own way of saying "I succeeded", on the other hand the list of Win32 Error Codes in MSDN Lib. states "0" (zero) ALWAYS INDICATES SUCCESS (Constant name: ERROR_SUCCESS). The list is found in MSDN: Win32API/Reference/Error Codes/Win32 Error Codes.

Thus, is asking -


VB Code:
if not Err.lastDllError = 0 then   'Do some dll-specific err-handlingelse   'Charge ahead with whateverend if

- a working method after ANY api-call?

regards everybody /lumen

Win32API.txt - Upgarde Availability?
Where can I get the latest win32api.txt. A search in Microsoft's MSDN website has resulted only in a never ending cycle of hyperlinks to other hyperlinks!

Win32api / Change Background
Dear All,
It's been terrific feeling posting questions and getting prompt reply. have one more question. hope you guys dont mind and will reply to this one also.

Please tell me as to
1) how to change the background colour for date picker control?
(using some win32api but do not know which one to use)

2) how to change the background colour of the scroll bar in a tree view/list box controls.

Thanking you in advance.

regards,
Sanjhu.

Getting Corresponding Datatype For Win32api Datatypes In VB
I want to know what is the datatype to be used to get a handle for window.

  win32 api function have their own datatype.
eg. SC_HANDLE,LPCSTR,TChar
In general i want to know where or how can i get corresponding VB datatype and how to use that in VB coding in calling win32 api function.

Thanx in advance.

CGI, Win32API, Visual Basic
I need help regarding using CGI to spawn an outside process in Visual Basic using Win32 APIs.  Basically I am web enabling utility programs that are run from the DOS prompt.  To capture parameters entered by users at the DOS prompt, I display an HTML form.  CGI stores the information in the STDIN and STDOut.  I know that I have to use Win32 APIs to retrieve and parse the information entered by the user.  I have been using the Readfile function to retrieve information from the buffer and using the writefile function to write to the buffer to provide a response to the client.  It's not working.  My browser is timing out.  I suspect the problem is how I'm using the Readfile function to retrieve information from the buffer.  

Also, once I capture and parse the data in order to spawn the utility program, using the Win32 function, Createprocess, how do I redirect error messages captured by the utility program to a log file and how do I capure errors actually generated from the Createprocess function and write it to a log file.  My approach was to use the Win32 CreatePipe function to redirect captured error messages and to use the readfile function to read the error messages generated by the createprocess function, which are stored in stderror.

I am running out of time, I really need an answer regarding the first part of my question.  Is my approach correct as far as retrieving information using the readfile function?

sade08

Paragraph Numbering With WIN32API
Since VB doesn't have built-in function for applying numbering to paragraphs like SELBULLET does for bullets, is there a way to use WIN32API to simulate such a function?

Any suggestions will be appreciated.

Thanks

Window Positioning: VB6, Win32API
Hi everybody,

I am trying to create a program (in VB6) which talks to a C dll to set a system wide hook. The purpose of hooking is to intercept all window creation / destruction messages...so that I can position the window (which may belong to any application), at whatever position I want. This includes dialog boxes, message/error dialogs, DOS/command windows and every visible window...

I have successfully managed to set the system-wide hook in the C dll using the CBT hook, and I can intercept window creation and destruction messages. I have figured out that the window class name #32770 is the one which refers to a common dialog: such as the file-open / save-as dialogs.

I am successfully able to retrieve the window positioning details, and store them to a database, when a window is destroyed. The next time the window is created, I detect it. and retrieve the details of the window from the dB. If the details are found, then I try to set the window positioning, using SetWindowPlacement, SetWindowPos...(both work for me).

Now the main problem is: this approach detects dialog windows with class #32770, but cannot "set" the position for those dialogs. It doesnt detect the DOS window. And for some weird reason, the position and size attributes for Explorer.exe and IExplore.exe are always wrong...I get a size of something like 10000 x 10000 always...

Can someone please help me...?
I have done quite a bit of searching online..., but no use

Please point me in the right direction...

Thanks a lot!

Cheers
Krishna

SetPixel
Hello,

Is there an easy way to draw a circle using setpixel?

Thanks,
Subs

SetPixel
I've written code to scan a PictureBox (Picture1) from top left to bottom right pixel by pixel. I have used a loop with GetPixel for this an logged RGB values in an array.

I then want to paint another PictureBox (Picture2) with those values using SetPixel in the same loop based fasion, reading from the array.

I may modify the values between these two stages, but my problem is with SetPixel - I don't know how to define the pixel I want to set or to set it.

What I therefore need is a simple bit of code on how to paint a PictureBox using SetPixel with a value from a variable (E.g ColorVAL).

Any ideas?

Api Setpixel?
I am useing the api setpixel. I have it putting pixels on the screen, but they are too small, how can i make them bigger?

Using SetPixel API
Here's the deal, I am using the setPixel API to draw a pixel, but the pixel is the size of an actual pixel. How can I enlarge the pixel drawn?

in module:
Code:
Public Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, _
    ByVal x As Long, ByVal y As Long, _
    ByVal crColor As Long) As Long


in form:
Code:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim lng as long
    Int = SetPixel(Form1.hdc, x, y, c)
End Sub

[/code]

Grabbing IE Address Bar Contents With Win32API
I have created an application that performs an HTTPS HTML scrape by fetching the contents of the address bar contents in an IE window. I wrote this for my department at work and it works great. The only problem is that most of the users are using the Google search bar.
For some reason, if the google search bar is active, the application will grab the contents of it rather than the address bar.

I am using the EnumChildWindows and then GetWindowText and GetClassName API calls to search for the Address bar handle. First I search for the ComboBoxEx32 class and from that handle, the ComboLBox and then the Edit class. Apparently, the Google bar has the same class information as the address bar.

I was able to list some of the class information about the object:

Top level Class = IEFrame, Title = Email - Microsoft Internet Explorer
Child Class = WorkerW, Title =
Child Class = ReBarWindow32, Title =
Child Class = ToolbarWindow32, Title = Google
Child Class = N:c:winntgoogletoolbar.dll, Title =
Child Class = ComboBoxEx32, Title =
Child Class = ComboBox, Title =
Child Class = Edit, Title =

Any Ideas?? Suggestions?


Oh yeah......anyone know of a good (Free) API spy tool, that I could use to get handle and class information of any windows controls? I tried WinPeek but it kept crashing out.....
Thanx!!

Setpixel/getpixel
setpixel/getpixel ??

how do you use setpixel/getpixel iv herd it pritty cool.

mabey i could use it for my game

EEK SetPixel Not Working!
Ok, here's the deal, i'm using SetPixel in a program to TRY to make * * * * work, and it wont show up, i dont get an error return from the function call, but nothing's showing up! please, tell me what the hell is wrong!!!!


Private Sub Form_Load()
Dim DC As Long
DC = GetDC(Form1.hWnd)
Dim Result As Long
Result = SetPixelV(DC, 25, 25, RGB(0, 0, 0))
End Sub

Opaque SetPixel
I made a procedure that will draw a pixel with a opaque value to make it appear translucent. The proceudure works, but it draws it incredibly slow. Does anyone know how I could speed it up to a more suitable speed.

Setpixel Faster
Ok, I have two bmps loaded into memory one is myBackBuffer and the other backImage. What i'm doing is randomly selecting pixels from backImage and placing them into the corresponding places in myBackBuffer producing a morph like effect. This works fine. The problem is i need to do this 20 - 50 times faster, heres my code.

Code:
Public Function Morph()
Dim rndX As Long
Dim rndY As Long
Dim rndPixel As Long

rndX = rnd * 100
rndY = rnd * 100

rndPixel = GetPixel(backImage, rndX, rndY)
SetPixel myBackBuffer, rndX, rndY, rndPixel


End Function

SetPixel On Form
Hi,

does anyone know how to SetPixel on Form1 ? It works in a picturebox...

SetPixel Picture1.hdc, 50,50,vbwhite

but

SetPixel Form1.hdc, 50,50,vbwhite

wont work.. any ideas why?

Getpixel And Setpixel
Sorry, I have been looking around and could not find any tutorials on getpixel and setpixel. Here is what im trying to do:

gorillaClient.gameArea.PSet (x + xLoop, y + yloop),vbGreen

Setpixel Flicker
Hello

I'am having a problem working on my cod2 rcon tool agian
I'am using setpixel to draw some text and arrows onscreen.
But when I bootup cod2 the pixels I set flicker!
Anyone know how to fix this problem

Thanks in advance

Subs

SetPixel Question...
I'm using the SetPixel API function to draw a picturebox with data from a very large file. (This file has a very special non-standard format so, forget about the LoadPicture method). My surprise comes from the fact that the pixels are only plotted if I set the picturebox autoredraw property to false. How come?

SetPixel() : An Interesting Example
Enclosed is an example of using SetPixel().
This example, which I like to call 'flies', creates a black picturebox.
Then once you click inside the PictureBox, it will create what looks like lots of flies.
When you move the mouse cursor around they try to get away from the cursor.
I think it looks quite nice

If you have any queries or comments, just let me know.

Why Do I Wait 2 Sec After SetPixel ?
Hi Guys, i'm using the following function to darken an existing picture, it's not that slow (acceptable), but hte problem i'm facing is that after the proces is finished, i have to wait 2 secs at least to get control back, can you test it yourself and feed me back. here's the code i'm using :

Dim R As Long, G As Long, B As Long
Dim i As Long, j As Long, pixelColor As Long
For i = 0 To Picture5.ScaleWidth
For j = 0 To Picture5.ScaleHeight
pixelColor = GetPixel(Picture5.hdc, j, i)
R = (pixelColor And 255) 2
G = (pixelColor 256 And 255) 2
B = (pixelColor 65536 And 255) 2
SetPixelV Picture5.hdc, j, i, RGB(R, G, B)
Next
Next

SetPixel Question - Help Please
I have learned how to use the SetPixel which works well for what I need. But I have found it only works when the image is visible and on top. In otherwords, if I try setting pixels to part of an image that is not shown or covered up by another control, it does not work. Is there any way around this?

Thanks!

SetPixel And GetPixel How Do You Use Them?
How do I use SetPixel and GetPixel?

SavePicture And Setpixel
1) I am plotting a graph onto a picture box using the SetPixel API. I am trying to save the picture box using the savepicture command, however when I save all I get is a blank picture box (no plots)

Any ideas? Heres the code

Private Sub cmdSave_Click()

SavePicture Picture1.Image, InputBox("Save Graph as..", "Save As..", "C:Cropped.bmp")

End Sub

(I`ve tried .picture but this does`nt work either)

2) I also have a problem with AutoRedraw, when enabled (for the picturebox) setpixel does`nt seem to work (the picture box remains blank) if I turn AutoRedraw off setpixel works fine.


Cheers for any help

RESOLVED// Capture Win32API-Call Success
Would like a 'generic' sample of how to robustly capture an API-call success-state. What should I look for that must be present? I do not mean specific error numbers, only the "success state"?


VB Code:
'call itselflngRetVal = SomeCall(etc. etc.)'Then what do I look for to determine success?If Not lngRetVal = WHAT Then'handle call's specific errorsEnd If


I've found conflicting info. in the doc's: 1) 0 (zero) is always returned upon success, 2) anything <= 32 is an error... etc.

Since my API-calls work like a dream, error testing has become difficult (!). It feels a bit hairy if I were to leave the calls without proper trapping.

Regards everybody /lumen

VB6, Win32API, Windows Hooks, Window Positioning
Hi everybody,

I am trying to create a program (in VB6) which talks to a C dll to set a system wide hook. The purpose of hooking is to intercept all window creation / destruction messages...so that I can position the window (which may belong to any application), at whatever position I want. This includes dialog boxes, message/error dialogs, DOS/command windows and every visible window...

I have successfully managed to set the system-wide hook in the C dll using the CBT hook, and I can intercept window creation and destruction messages. I have figured out that the window class name #32770 is the one which refers to a common dialog: such as the file-open / save-as dialogs.

I am successfully able to retrieve the window positioning details, and store them to a database, when a window is destroyed. The next time the window is created, I detect it. and retrieve the details of the window from the dB. If the details are found, then I try to set the window positioning, using SetWindowPlacement, SetWindowPos...(both work for me).

Now the main problem is: this approach detects dialog windows with class #32770, but cannot "set" the position for those dialogs. It doesnt detect the DOS window. And for some weird reason, the position and size attributes for Explorer.exe and IExplore.exe are always wrong...I get a size of something like 10000 x 10000 always...

Can someone please help me...?
I have dont quite a bit of searching online...including the API section here on XtremeVBTalk.com, but no use :(

Please point me in the right direction...

Thanks a lot!

Cheers
Krishna

GetPixel/SetPixel With DDSurface7's
I have my default grey-scale surfaces, and I want to colorize them several different ways (see the attached picture). Is there an easy way to do this with DirectDraw7, or would I be better off using GetBitmapBits etc. and doing a per-pixel color replacement before loading my bitmaps onto the surfaces?

Transparent Pixels With SetPixel
Is it possible to set transpartent pixels with the API SetPixel?

Removing SetPixel Drawn On DC
Well I did something like this to draw on my desktop.

Dim lDC as long
lDC = GetDC(0)
SetPixel lDC, x, y, RGB(0,0,255)

The problem is whatever I drew stays there and it gets really messy. I don't know how to do a clear screen for it. Because I'm drawing on the DC itself and not a picturebox, I cannot do a picturebox.Cls
My question is how do I clear screen?

SetPixel With System Colors
Hi. Im trying to use set pixel to draw a dot on a form and the color im giving it is me.forecolor. The forecolor has been changed to highight text (one of the system colors) yet the pixel is still drawn black.

Does SetPixel not accept system colors or do i have a problem somewhere else?

Could Sombody Help Me Please With Setpixel,GetPixel
Hello,

I had a look over the forum but i coundnt find what im looking for. im trying to use setpixel,getpixel to take a screenshot and send it over winsock to another pc but the only way i can find of doing this is taking a screen shot then geting the pixels and sending them, this would work but it doesnt seem to work if the forum in not cureently on the screen so i need away of geting the pixels of the screen and not of the hDC of a form.

Could Sombody Please Help

Best Regards

Getpixel - Setpixel Question
I am creating a 'mean' image using getpixel and setpixel from 5 images. The images are in jpg format. I'm using an array with 2 loops to go through every pixel on the image. When I use an array on just one image getpixel and then setpixel on another image it turns out fine.

BUT, when I use the getpixel on multiple images creating mean pixels and putting these on a new image, I get a bunch of different colors on my image and it isn't clear... Even though there is no color on my 5 images which I am using to create the mean.

The images that I'm using for this are in gray scale. I'm using a long for the getpixel and it looks like it is reading this in from the jpg in 24 bit, I think?? When I check the program the mean pixel is being computed correctly.

Any ideas on what I need to change? Should these images read in as 256 scale? That is what I thought they would be, but they are reading in values in the millions. When I try to convert this long to grey scale I get the images in red only. Not sure what is going on, any help appreciated. Sorry I don't have the code at home, just trying to figure out what needs to be done. can post sample code tomorrow if that helps.

GetPixel() &amp; SetPixel() : A Simple Example
Enclosed is a simple example of using GetPixel() & SetPixel().
This example will create a random image in one PictureBox, and then using a combination of GetPixel() & SetPixel(), it will make a copy of the image into a second PictureBox.

If you have any queries or comments, just let me know.

SetPixel And Autoredraw On PictureBox
Why cant i have autoredraw set to true when i use SetPixel in a PictureBox?
The new prixels dissapears!

I can't save a picture that i've used SetPixel on either!
The new prixels dissapears!

Why?
How can i fix it?

Please help!

SetPixel API &amp; Picture Box Autoredraw
When I use the SetPixel API with a picture box and the picture box redraws, (via autoredraw or just minimizing and maximizing the form), the pixels that was drawn on the picturebox by the setpixel api disappears.

Why does it do it and how do I stop it from happening?
Might it have something to do with the fact that the api draws on a different graphic level?

Using Windows API SetPixel With VB, How To Import?
I am trying to use the SetPixel method from the windows API in VB.

So far I have:


Code:

Call SetPixel(form.hDC, 20, 20, RGB(255, 0, 754))



I need to import the part of windows which handles this into VB but i dont know how.

The error at the moment is: Sub of function not defined.

How do I import the function?
Are there any good websites which cover using graphics like this in VB?

Thanks

Copyright 2005-08 www.BigResource.com, All rights reserved