Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
translating win32API C tutorial to fB ::New question::
#11
Yes it is a macro. Use DialogBoxParam() instead, just add a 0 for the extra parameter.

DialogBoxParam(GetModuleHandle(NULL), IDD_ABOUT, hwnd, @aboutdialogproc, 0)

Note that you need @ in front of the dialog function name.

Garvan
Reply
#12
It works with that now, but how would I retrieve the return value?

(and of course it is '@' :oops: )

EDIT:: is it perhaps posted in the parent window's message queue?
/post]
Reply
#13
Quote:It works with that now, but how would I retrieve the return value?

(and of course it is '@' :oops: )

EDIT:: is it perhaps posted in the parent window's message queue?

Hi:

The dialogboxparam() is declared as a SUB in FreeBASIC which I suspect is technically incorrect (small bug?). It should return an integer.

If you want to send values to a dialog procedure use the final parameter that I said to set to zero. If you send a variable by reference, you can modify it in the dialog and read the results when the dialog returns. If you need to modify more than one variable, the idea is that you can send a pointer to a structure containing the variables that you want to set in the dialog.

I do not bother with this; I just use global variables instead to store the results of a dialogbox. Some programmers do not like global variables and go to all kinds of length to avoid their use, and the final parameter is for them.

Have fun

Garvan
Reply
#14
Hi

red_Marvin, I don't mean to take over your post in any way,but, I noticed it was Win32 related.

I just downloaded the FB compiler yesterday and I see "next to no " posts on this subject. If there are answers to my questions then maybe it will help both of us.

With that said, I can't seem to make the FB compiler understand the following wgl statements from msdn:

hRC = wglCreateContext hDC

wglMakeCurrent hDC, hRC

wglMakeCurrent NULL, NULL

wglDeleteContext hRC

The compiler does'nt seem to understand them and it says "variables not declared " when it encounters them.


I need to create a Rendering context with the Device context and then make them current.

Also, on exit , I need to null them both as well as delete the Rendering context.


I'm trying to see a way of setting updirectly OpenGL thru the Win32 API. But, the above and maybe just a couple of other things are getting in the way.


My next question is about the pixelformatdescriptor. I can compile one but without setting size of to PIXELFORMATDESCRIPTOR..
Can this be taken care of by FB memeory management itself?




Thanks in advance and for your patience


Glu
Reply
#15
here's a tip:
to see which api functions you can use from freebasic and their parameters, go to your inc/win directory and look through the .bi files kernel32.bi, user32.bi, and gdi32.bi. they have all the structs, defines, and function prototypes that the compiler will recognize. (because that's what it's using to compile)
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Reply
#16
dumbledore

Okay, thanks for the tip.


I took a quick look at those win bi's( there's several thouisand lines of code), but I don't see any reference to :

hRC = wglCreateContext (hDC)
wglMakeCurrent (hDC, hRC)

In fact, I did'nt see any reference to a Rencering Context (hRC) either.


PIXELFORMATDESCRIPTOR is in there as a MYTYPE and it's memebers can be defined thru that with pfd ....end with.... mechanism. But, I did'nt see an implementation of sizeof in the examples.


I see references to GLYPHS and to GLYPHMETRICS but, as to the font buffer GLYPHMETRICSFLOAT, I did'nt see that either.

2d and 3d font could be created easily with that: wglUseFontOutlines
wglUseFontBitmaps

and more......But, I did'nt see them either.

I'm sure I missed some. Just took a quick peek in there and there's several thousand lines of code.

It's not a big deal to set up OpenGL thru the Win32 Api. In fact, most of what is needed to do it is allready there. Just a few "key" functions seem to be missing.

But, like I said......It was a quick peek in there after all.


Glu
Reply
#17
wglCreateContext doesn't even exist in the C headers...I found some info about it on the MSDN but frankly, I have no clue where the hell it's defined. Could be a macro for all we know...where's the 3D genuises when you need them?
I'd knock on wood, but my desk is particle board.
Reply
#18
I tested and edited the declaration of dialogboxparam()
in user32.bi to function instead of sub, and all worked well
and it returned the correct value. Who should I notify of
this?
/post]
Reply
#19
Double post because of new question.
If I find a win32API function (in this case createdialog) that is not
declared in the correct bi file (in this case usert32.bi) is it enough
that I add the declaration after looking it up on msdn or something,
=Is all functions there in the library files and they are just not declared?
/post]
Reply
#20
Hi:

You will need to check with some reference to see what versions of windows the function is supported in, and what are its parameters, and check to see if all the parameter types used by the function are declared correctly, and usable in FreeBASIC.

If you do not have a good reference, then download the Programmers Software Development Kit (PSDK) from Microsoft.

Have fun

Garvan
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)