We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Archicad C++ API
About Archicad add-on development using the C++ API.

DG User Control

Anonymous
Not applicable
Hello,

I want to make a help control in ArchiCAD which displays HTML files. I currently have an app which uses the microsoft web browers object and my goal is to put it onto a modeless palette in ArchiCAD.

I have added an entry into my grc file:

'GDLG' 32422 Palette | TopCaption | NoClose 0 0 140 650 "Help" {
UserControl 0 0 140 650 512
}

In my initialise funciton I register a window class with
memset(&wClass, 0, sizeof(WNDCLASS));
wClass.lpszClassName = "CDEF512"
wClass.hInstance = ACAPI_GetExtensionInstance();
wClass.lpfnWndProc = &HelpFileWindowProc;
RegisterClass(&wClass);


At the moment my HelpFileWindowProc just returns 1. So I don't expect this control to do anything just yet but the palette its on should still load.

My problem is that the dialog never gets initialised.
ie. DGModelessInit returns 0

As soon as I remove the usercontrol from the form it works fine.

Any help would be apreciated.

Thanks,
Adam
2 REPLIES 2
Oleg
Expert
I remember, I did attempts with custom control for curiosity and finally it worked. But unfortunately, I have removed source texts and I do not remember exactly what issues I had.

It seems, that the class name should prefixed not CDEF but UC.
Try use UC512 window class name.
Anonymous
Not applicable
Does anyone have more information on this topic? I too get NULL returning from DGModelessInit() with wc.lpszClassName equal to either "CDEFxxx" or "UCXXX"

The one thing I noticed from adambutler's code is that you have to make sure that the class registration does not return NULL (mine doesn't). Also, I'm putting the class registration code in the CheckEnvironment() method--should it be going somewhere else?

thanks in advance, Chuck