|
-
Feb 19th, 2007, 05:49 AM
#1
Re: How to create VB form?
why did it crash? because you did something wrong.
is there an easier way? yes, using the IDE - that's the point of using VB, it's RAD
-
Feb 19th, 2007, 07:35 AM
#2
Re: How to create VB form?
What, in your module, do you need to use that is related to your form?
-
Feb 19th, 2007, 09:10 AM
#3
Thread Starter
Addicted Member
Re: How to create VB form?
is there an easier way? yes, using the IDE - that's the point of using VB, it's RAD
Well I continue to search every solution while I haven't one that is satisfied me. I don't want to add another file for a form only to use it as a virgin one to support GDI+ operations. I want to create one dynamicaly. One solution is to make an instance of one existing, but I want a virgin one with no controls inside it (in reason of loading); I imagined that I could do a form object from VB librairies but it seems you can't do that easier than creating an instance of an common object !
I have some troubles of VB as soon as VB is reading the line with createwindowex api. I may did something wrong, I don't often use this particular api ; I only paste this part of code from a standard module to an object module. For me, I've respected all syntax. VB don't show debug dialog, and only Xp shows the standard stop application window.
I suppose that there's something wrong with getmodulehandle (in bold), and my feeling is that VB is overbooked or something like that in memory/handle operations... But how to run perfectly this code in my object module?
I post the function extracted from TheBigB's link :
VB Code:
Public Function WinCreate(winClassInfo As String, winAppInfo As String, ByRef winProcAddress As Long) As Boolean
Dim hh As Long
'store class name
winClassName = winClassInfo
'create class info
With winClass
.style = 0&
.lpfnwndproc = winProcAddress
.hInstance = App.hInstance
'default icon
.hIcon = LoadIconByNum(0&, IDI_APPLICATION)
'arrow-style mouse cursor
.hCursor = LoadCursorByNum(0&, IDC_ARROW)
.hbrBackground = COLOR_WINDOW
.lpszClassName = winClassName
.lpszMenuName = vbNullString
.cbClsextra = 0&
.cbWndExtra2 = 0&
End With
'register our class
winRegResult = RegisterClass(winClass)
'ok?
If Not winRegResult = 0 Then
'create window
WinHandle = CreateWindowEx(WS_EX_ACCEPTFILES, winClassName, winAppInfo, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0&, 0&, [B]GetModuleHandle(vbNullString)[/B], ByVal 0&)
If Not WinHandle = 0 Then
'show
'' ShowWindow winHandle, SW_SHOWNORMAL
'bring to front
'' SetForegroundWindow winHandle
'refresh
'' UpdateWindow winHandle
'done
WinCreate = True
Else
'create failed
WinCreate = False
End If
Else
'can not register class
WinCreate = False
End If
End Function
What, in your module, do you need to use that is related to your form?
Sorry I don't understand what you mean? Please could you reformulate?
Last edited by IsWorking; Feb 19th, 2007 at 09:16 AM.
-
Feb 19th, 2007, 09:15 AM
#4
Re: How to create VB form?
It is not clear to me why you need to do this.
 Originally Posted by IsWorking
Well, I'm searching for creating a standard VB form with only code and without make an instance of another form designed in VB development interface.
-
Feb 19th, 2007, 09:48 AM
#5
Thread Starter
Addicted Member
Re: How to create VB form?
I don't know if you have posted your message when I posted mine.
Two major reasons to search that : the challenge to perform it, and the wish to reduce the number of source files. I only need a visible form without title, buttons, border or other controls that it could have.
-
Feb 19th, 2007, 01:43 PM
#6
Re: How to create VB form?
 Originally Posted by IsWorking
I don't want to add another file for a form only to use it as a virgin one to support GDI+ operations
Why not?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|