×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

CreateWindowEx

CreateWindowEx

CreateWindowEx

(OP)
This is a vb6 slash win api problem:

I am creating a win32 dll in vb6 (which *is* possible btw: http://windowsdevcenter.com/pub/a/windows/2005/04/26/create_dll.html).

Basically the dll's purose is to paint a control on screen:
1) initiate common control (initcommoncontrolsex)
2) create window (createwindowex)
NB: i send the window handle of the vb form as a parameter

I want the dll to draw the window/control on my vb form...
* I can directly call 1) and 2) from my vb app and paint a control
* I can directly call 1) and 2) from my vb app and paint a control to another form
* I CAN'T call 1) and 2) from dll (with my vb app handle) to paint the control

(I don't have the code available on me so i will post that later today maybe)

RE: CreateWindowEx

(OP)
Correction: I can actually initialize the common control (1) with the dll; it returns true... but createwindowex(2) only returns 0... as in DIDN'T WORK!

RE: CreateWindowEx

And what did GetLastError tell you?

RE: CreateWindowEx

(OP)
This is the code in the dll:

CODE

Public Function CreateWindow(oControl As icc, oClass As String, oName As String, oHwnd As Long, oDWStyle As Long) As Long
   InitCommonControlsEx oControl
   CreateWindow=CreateWindowExA(0,oClass,oName,oDWStyle,0,0,10,10,oHwnd,0,0,0)
   MsgBox GetLastError()
End Function

This is the code to call it:

CODE

Private Type icc
   osize As Long
   oicc As Long
End Type
dim t as icc
t.osize = 8
t.oicc = 2
CreateWindow(t, "SysTreeView32", "TV", Me.hWnd, WS_VISIBLE + WS_BORDER + WS_CHILD)

The getlasterror returns 0.

Ashthud

RE: CreateWindowEx

>The getlasterror returns 0.
GetLastError won't tell anything. You need to check Err.LastDllError property.

RE: CreateWindowEx

(OP)
Error number is 1407... im going to have quick google around and see what i can find

Ashthud

RE: CreateWindowEx

(OP)
Ok, apparently the 1407 error is related to an incorrect class name...
the value i sent to the dll was "SysTreeView32", but ends up being something stupid like: "??????2". Do dlls have a problem handling strings?

Ashthud

RE: CreateWindowEx

(OP)
I solved the problem; because my dll has no advanced string handling technique, i have to pass any string values using the strconv() function and convert a string value to unicode string value:

CODE

StrConv("SysTreeView32", vbUnicode)

Ashthud

RE: CreateWindowEx

(OP)
Is there any reason why i can use my dll in VB6 but cannot use it in FOXPRO (2.6)?  I get a "ACCESS VIOLATION ERROR"

Ashthud

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close