![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|
Q: Change the window class name of a formAnswerOverride the CreateParams method of your form, and copy your window class name into the WinClassName member of the TCreateParams structure. //--------------------------------------------------------------- // header file private: virtual void __fastcall CreateParams(TCreateParams & Params); //--------------------------------------------------------------- // cpp file void __fastcall TForm1::CreateParams(TCreateParams & Params) { TForm::CreateParams(Params); strcpy(Params.WinClassName,"MotherPumpkin"); } Note: The WinClassName member of the TCreateParams structure is an array of char. The array size is 64. You need to copy your window class name into this variable using strcpy. Do not attempt to assign the character string like this: void __fastcall TForm1::CreateParams(TCreateParams & Params) { TForm::CreateParams(Params); Params.WinClassName = "MotherPumpkin"; // Error! } Note: The TCreateParams structure also contains a WindowClass member. This member is the WNDCLASS structure that you would normally see in an API program. The WNDCLASS structure contains a member called lpszClassName that would normally contain the class name in a standard API program. However, in the VCL, lpszClassName conflicts with the WinClassName character array. I tried to use lpszClassName to assign the class name, but it didn't have any effect. I recommend that you use WinClassName instead. | ||||||
All rights reserved. |