Results 1 to 20 of 20

Thread: How to create VB form?

Hybrid View

  1. #1
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    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

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to create VB form?

    What, in your module, do you need to use that is related to your form?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    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:
    1. Public Function WinCreate(winClassInfo As String, winAppInfo As String, ByRef winProcAddress As Long) As Boolean
    2.   Dim hh As Long
    3.   'store class name
    4.   winClassName = winClassInfo
    5.   'create class info
    6.   With winClass
    7.     .style = 0&
    8.     .lpfnwndproc = winProcAddress
    9.     .hInstance = App.hInstance
    10.     'default icon
    11.     .hIcon = LoadIconByNum(0&, IDI_APPLICATION)
    12.     'arrow-style mouse cursor
    13.     .hCursor = LoadCursorByNum(0&, IDC_ARROW)
    14.     .hbrBackground = COLOR_WINDOW
    15.     .lpszClassName = winClassName
    16.     .lpszMenuName = vbNullString
    17.     .cbClsextra = 0&
    18.     .cbWndExtra2 = 0&
    19.   End With
    20.   'register our class
    21.   winRegResult = RegisterClass(winClass)
    22.   'ok?
    23.   If Not winRegResult = 0 Then
    24.     'create window
    25.      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&)
    26.     If Not WinHandle = 0 Then
    27.       'show
    28.     ''  ShowWindow winHandle, SW_SHOWNORMAL
    29.       'bring to front
    30.      '' SetForegroundWindow winHandle
    31.       'refresh
    32.     ''  UpdateWindow winHandle
    33.       'done
    34.       WinCreate = True
    35.     Else
    36.       'create failed
    37.       WinCreate = False
    38.     End If
    39.   Else
    40.     'can not register class
    41.     WinCreate = False
    42.   End If
    43. 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.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to create VB form?

    It is not clear to me why you need to do this.
    Quote 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.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    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.

  6. #6
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: How to create VB form?

    Quote 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
  •  



Click Here to Expand Forum to Full Width