There are three issues here, I think: Keywords, the two different kinds of proficiency, and permission by omission.
But before I go into those, a word: As always there are explicit features/feats/enchantments which break the rules, and that's why we call D&D an "exception-based" system: it deals in rules which apply universally unless (until) exceptions are made, so there is no need to enumerate the possible exceptions. We simply assume the rule unless told otherwise in a particular instance.
Keywords
If a power has the weapon
keyword, and only if the power has the weapon
keyword, does a weapon enchantment (enhancement bonuses and other features) apply to that power. Ditto with the implement
keyword and implement enchantments.
Proficiency and the Proficiency Bonus
"Proficiency" means that you've had training in the use of a weapon or implement, but mechanically it means totally different things whether you're talking about a weapon or an implement.
Weapon Proficiency and the Proficiency Bonus
Proficiency with a weapon means that you can add that weapon's "proficiency bonus" to attack rolls. Only weapons have proficiency bonuses, they only apply to powers with the weapon
keyword, and they have nothing to do with whether enhancement bonuses can be applied (see below for that bit).
Implements, Enhancement Bonuses, and Permission by Omission
You need to be proficient with an implement in order to add its enhancement bonus to attacks and damage with implement powers. You do not need to be proficient with a weapon in order to add its enhancement bonus to attacks and damage with weapon powers, but you don't get its proficiency bonus to the attack roll. (In either case, you can only add the enhancement bonus of one item at a time to an attack unless you have a rules exception which says otherwise.)
I arrived at this conclusion because the magic implement rules say you need to be proficient for the enhancement bonus, but the magic weapon rules don't. Permission by omission is sloppy, but has solid precedent.
The effect will not happen until the trigger does.
Announcing that an ally is an enemy will not cause the effect to trigger unless you do so as the former ally is now moving into an affected square. If the ally is now an enemy she would be such until declared otherwise. And as such would be affected by any and all effects that effect enemies.
4e doesn't really have rules stating when an ally becomes an enemy so the conditions at which time this changes is entirely up to you as the DM. However, if there is a dispute between you and your players over this, it might be a good idea to develop a rule within your social contract (written or unwritten) that defines how you guys treat PVP and ally/enemy relations.
Note: be mindful of the mechanical implications of this, this is not a situation covered by the rules and a such, any house rule you make may come at the expense of system balance. Attacking allies is something that is used to great effect in certain optimization circles, allowing powers that target enemies to target former allies may have unpredictable results.
Best Answer
Yes
If you find yourself in the unenviable position of flanking while holding a ranged weapon, you may indeed flank. The only requirements in this instance are:
As flanking with a ranged weapon is generally a painful choice, I'm not sure why this situation would naturally arise, but when it does, you certainly are able to.
The wording is a bit looser in 3.5
Quoth d20srd:
...
Given that the ranged weapon could certainly be used as an improvised melee weapon, there's no inherent reason why they wouldn't count as threatening. However, a GM could rule otherwise.