How to distinguish between activating a program as default tool and by shift-clicking?

2 posts / 0 new
Last post
OldFart
OldFart's picture
Offline
Last seen: 1 day 3 hours ago
Joined: 2010-11-30 14:09
How to distinguish between activating a program as default tool and by shift-clicking?

Hi,

I stumbled upon the question when doing some maintainance.

From WB a program can be started in one of these three ways:
1): the common method of double-clicking its icon in which case ((struct WBStartup *)argv)->sm_NumArgs == 1

2:) an equally common method is by specifying a tool as default tool for a project and then double-clicking that project's icon. In this case ((struct WBStartup *)argv)->sm_NumArgs == 2

3:) 'elastic banding' one or more files and clicking the program's icon WHILE HOLDING LShift. In this case ((struct WBStartup *)argv)->sm_NumArgs == the number of files selected + 1.

The question now is that how can I distinguish between the 2nd and the 3rd way when in the latter only one file has been selected? In both cases ((struct WBStartup *)argv)->sm_NumArgs == 2.

Please enlighten my dimlit mind.

OldFart

Rigo
Rigo's picture
Offline
Last seen: 1 year 10 months ago
Joined: 2011-01-24 21:55
Basically, you don't. The

Basically, you don't. The idea is that the first argument is the program itself (name in wa_Name, and path in wa_Lock).

After that you should keep checking for further arguments and process each one appropriately. Your program should handle no arguments or loads of aruments if it is intended that args can be passed this way.

An example would be an editor. It should show it's GUI, then check for arguments opening each one as it finds them.

Simon

Log in or register to post comments