1. A communication apparatus to which a user can log in, comprising:a wireless communication interface having a direct wireless communication function of performing wireless communication with an external device without using an external relay device therebetween;
a display device;
at least one memory that stores a set of instructions; and
at least one processor that executes the instructions, the instructions, when executed, causing the communication apparatus to perform operations comprising:
displaying an operation screen for allowing a user having logged in to use a function of the communication apparatus on the display device of the communication apparatus in a case where the user has logged in to the communication apparatus, wherein a login waiting screen is displayed on the display device while the user has not logged in to the communication apparatus;
determining, based on a number of wireless connections established by the direct wireless communication function, whether to stop the direct wireless communication function in response to the user's logging out from the communication apparatus; and
controlling the wireless communication interface to stop the direct wireless communication function in response to determining to stop the direct wireless communication function,
wherein if it is determined, in the determining, that the number of wireless connections is zero, the direct wireless communication function is stopped.