Have you ever met a function or a procedure that has even more parameters than CreateWindowEx does ?
QuoteHWND CreateWindowEx
(
DWORD dwExStyle,
LPCTSTR lpClassName,
LPCTSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam
);
Interesting discussion on Stackoverflow:How many parameters are too many? (http://stackoverflow.com/questions/174968/how-many-parameters-are-too-many)
What's your opinion?
I think CreateFont() would have to come close.
CreateFont - i count 14 parms
if you don't run out of gas typing the function name...
BOOL WINAPI AccessCheckByTypeResultListAndAuditAlarmByHandle(
_In_ LPCTSTR SubsystemName,
_In_ LPVOID HandleId,
_In_ HANDLE ClientToken,
_In_ LPCTSTR ObjectTypeName,
_In_opt_ LPCTSTR ObjectName,
_In_ PSECURITY_DESCRIPTOR pSecurityDescriptor,
_In_opt_ PSID PrincipalSelfSid,
_In_ DWORD DesiredAccess,
_In_ AUDIT_EVENT_TYPE AuditType,
_In_ DWORD Flags,
_Inout_opt_ POBJECT_TYPE_LIST ObjectTypeList,
_In_ DWORD ObjectTypeListLength,
_In_ PGENERIC_MAPPING GenericMapping,
_In_ BOOL ObjectCreation,
_Out_ LPDWORD GrantedAccess,
_Out_ LPDWORD AccessStatusList,
_Out_ LPBOOL pfGenerateOnClose
);
seems to me, if you were going to call a function many times, a structure might be better :P
17 parameters looks like an absolute champion + name length like a poem :biggrin: :t
But look at this little func :
RtlWriteDecodedUcsDataIntoSmartLBlobUcsWritingContext (http://ashutoshmehra.net/blog/2010/02/long-function-names/)
... and this
"Best" method names ever... (http://blogs.msdn.com/b/brada/archive/2005/01/09/349678.aspx)
Next nominations are : the biggest structure, structure name ... what else?
one of the hardest to get what you want - lol
GetOpenFileName / GetSaveFileName
the OPENFILENAME structure has so many caveats, it's a little hard to use
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646839%28v=vs.85%29.aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/ms646839%28v=vs.85%29.aspx)
of course, fonts are just a pain in the ass, no matter what
creating modal or modeless dialog boxes from in-memory templates can be hairy
(DialogBoxIndirect or CreateDialogIndirect)
a good learning experience, though
i'm sure the worst are somehow COM related, though :lol:
some are passed VARIANT structures - so one parameter is actually several
Not the longest but in one of the prerelease versions of XP, there was a dll containing a function called RegisterTheFrigginEventServiceAfterSetup. You don't feel too bad when even the guys on the inside are being left exasperated by it all.
Quote from: dedndave on January 14, 2015, 05:55:54 AMseems to me, if you were going to call a function many times, a structure might be better :P
Of course - compare CreateFont and LOGFONT (as used in CreateFontIndirect).
You can do the same with CreateWindowEx, just use
mov esi, offset CWEX ; struct
lea edx, [esi+sizeof CWEX]
.Repeat
lodsd
push eax
.Until esi>edx
call CreateWindowEx
Quote from: adeyblue on January 14, 2015, 07:25:44 AMthere was a dll containing a function called RegisterTheFrigginEventServiceAfterSetup.
Nice but sooooo short... msvcp60.dll and msvcp71.dll have more to offer:
?AddRulesToStyleSheet@DUIXmlParser@DirectUI@@IAEJPAUIXmlReader@@PAVStyleSheet@2@PBGPAV?$DynamicArray@UXMLParserCond@DirectUI@@$0A@@2@PAV?$DynamicArray@PAG$0A@@2@@Z
?_Fput@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_WPBDIIII@Z
?_Getfmt@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHPAUtm@@PBD@Z
?_Getfmt@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHPAUtm@@PBD@Z
?do_get_date@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHPAUtm@@@Z
?do_get_monthname@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHPAUtm@@@Z
?_Getmfld@?$money_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@AAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@0_NAAVios_base@2@@Z
?_Putmfld@?$money_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@_NAAVios_base@2@D1V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z
?do_get@?$money_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0_NAAVios_base@2@AAHAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z
?_Getmfld@?$money_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@AAV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@0_NAAVios_base@2@@Z
?_Putmfld@?$money_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@_NAAVios_base@2@_W1V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z
?do_get@?$money_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0_NAAVios_base@2@AAHAAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z
I like this func:
Quote?do_get@?$money_get@...
What How much does it return? ;)