Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need unique identifier for open forms

5 views
Skip to first unread message

Carsten

unread,
Jul 15, 2010, 10:38:15 AM7/15/10
to
Hi there,

I'm building a kind of session-handling. Every time the form "planned
orders" will be opened AX will make a note in a new created session table.
Closing the "planned order" form will kill the note. To do so I'm using the
init() and close()-method of the form. This works pretty fine. Finetuning is
able to make use of UserId, DateTime, and so on...

BUT:

I have to differ between instances of the same form. The "kill"-method of my
open-session-functionality kills all sessions for the "planned order"-form.
Every time the form is closed. This causes problems if more than one form is
opened. First open the form will make a new session entry. Opening the same
form a second time will make another session entry. Closing one of this two
forms will kill EACH session entry concerning the "planned order" form - no
matter, that one form is still open!

So I need to figure out an unique identifier for each form instance.

Any suggestions?

Carsten

Jonas

unread,
Jul 15, 2010, 11:25:49 AM7/15/10
to
Check if this.hWnd() could be useful. I think that it is a unique window
handle, but I am not sure...

/Jonas

"Carsten" <Car...@discussions.microsoft.com> skrev i meddelandet
news:A774F91A-3A2C-4164...@microsoft.com...

Carsten

unread,
Jul 16, 2010, 2:45:09 AM7/16/10
to
Hi Jonas,

Wow, great! This works :)

Thank you very much!
Carsten


"Jonas" wrote:

> .
>

Michal

unread,
Jul 16, 2010, 4:41:02 AM7/16/10
to
"Carsten"

> Hi Jonas,
>
> Wow, great! This works :)
>

You just have to remember that hWnd is unique at the time the window is
open, and therefore:
1) Another window on different machine can get same hWnd
2) Another window on same machine can get same hWnd, once your window is
closed.

Universal identification of every window in the system can be made of:
Recid of UserLog (one per session) +form's hWnd+counter(incremented if hWnd
repeats in the session).

Instead of hWnd I would be keen to customise the SysSetupFormRun to return
it's number (which generated from variable held in global cache)

--
Michal
AXImprove | www.AXImprove.co.uk | Solutions for AX performance and
storage management.

0 new messages