Problem with Custom control container

Started by Elias Montoya, December 24, 2008, 05:37:25 PM

Previous topic - Next topic

Elias Montoya

 My App was crashing inmediately when started. No main dialog ever appeared.
i tracked doen the problem to a custom control container. If i use this:

   hWndControl = CreateWindowEx(ExStyles, _
                                ClassName, _
                                Caption, _
                                Styles Or %WS_CLIPCHILDREN Or %WS_VISIBLE, _
                                nLeft, nTop, nWidth, nHeight, _
                                hWndParent, IDC_MAINFORMSERVER_VISTAPC, _
                                App.hInstance, _
                                ByVal 0)


The App never started (crashed before main dialog appeared). But when i use this:

   hWndControl = CreateWindowEx(ExStyles, _
                                ClassName, _
                                Caption, _
                                Styles Or %WS_CLIPCHILDREN Or %WS_VISIBLE, _
                                nLeft, nTop, nWidth, nHeight, _
                                0, IDC_MAINFORMSERVER_VISTAPC, _
                                App.hInstance, _
                                ByVal 0)


Edited:
Program Opens but no custom control appears. What can i do?

Elias Montoya

It also runs if i do the following but still no control appears:

   hWndControl = CreateWindowEx(ExStyles, _
                                ClassName, _
                                Caption, _
                                0, _
                                nLeft, nTop, nWidth, nHeight, _
                                HWND_MAINFORMSERVER, IDC_MAINFORMSERVER_VISTAPC, _
                                App.hInstance, _
                                ByVal 0)

TechSupport

Hi Elias,

In the FireFly PropertyList did you fill in values for the "ClassName" and "Caption", etc... What Custom Control are you trying to use? Did you include the source code for the custom control in your program using "Project", "Add Module"??


TechSupport

Elias,

Did you accidently delete these lines from the Custom Control handler:

   'It is important that this function return the Windows Handle to the newly created Control *** Do not delete this ***.
   Function = hWndControl


Elias Montoya

 Hello Paul, Yes, i added the class "SysPCView32" and the caption was "List of Available PCs", although it shouldnt be visible.

I was registering the class in the same function (INIT), but there was no way i could make it work.

I didnt delete this part.
   'It is important that this function return the Windows Handle to the newly created Control *** Do not delete this ***.
   Function = hWndControl


In fact, there was no way i could create the control, hWndControl was always null.

I didnt include any source code for the custom control via "Project", "Add Module" because what i wanted was just to create a skinned window with couple child windows which would just stand there and do nothing, so it was pretty simple, but didnt work.

The good news is that I found a better way to achieve what i wanted to do: I added a label to the dialog, then i created a second form which reads the position and size of the label in my first dialog, and places iutself in there as a child of the first dialog. From there it was even easier to add the child controls in the second form because i could do it visually.

Still, i wonder why it didnt work the way i wanted to do it...  ???