Home All Groups Group Topic Archive Search About
Post Other interesting topics
Author
13 May 2009 12:42 PM
gerryR
Hi

I'm working on a fairly simple app comprising of 4 forms.

On the 1st form it shows some stats from 2 txt file it links too (how many
lines etc).

On Form 2 it allows you to add info to one of the txt files.

I open Form 2 when wanting to add another record using Form2.ShowDialog()
When I've added the link and clicked save I close form2 with Close().  The
the focus is back on form 1

Is there anything I can do to automatically refresh form1 so that the stats
update once I close form 2?

Thanks
Gerry

Author
13 May 2009 7:51 PM
dgm
From what I've read, clipboard formats are supposed to coincide with dragdrop
formats. I can enumerate clipboard formats and find two that have been
registered. But the two I found registered do not work with dragdrop. To find
what works with dragdrop I must test everything from -32768 to 32767 and use
what's found. Enumerating clipboard formats returns long values which must be
converted to integers ranging from -32768 to 32767. Using the converted
values works with clipboard.getformat(x). They do not however work with
data.getformat(x), with data supplied by the OLEDragDrop event.

I'm trying to drag attachments from GroupWise 6.5 into an Access 97
application. Because Access 97 does not have that functionality I must use an
ActiveX. I'm able to discover the dragdrop formats by iterating when the
application loads and use what's found. I was able to figure out what's in
the byte arrays returned using the two formats, and the application works.
But I'd like to find a better way to discover the dragdrop formats instead of
iterating through all possibilities.

The application is still in Access 97 because no project has been approved
for new development and only what the users have installed can be used. Thanks
Author
13 May 2009 11:09 PM
Karl E. Peterson
dgm wrote:
> From what I've read, clipboard formats are supposed to coincide with dragdrop
> formats.

I've never ran into that correlation before, but that certainly doesn't mean it
isn't so.

> I can enumerate clipboard formats and find two that have been
> registered. But the two I found registered do not work with dragdrop. To find
> what works with dragdrop I must test everything from -32768 to 32767 and use
> what's found.

Clipboard formats, and lots of other things, exist in a string table with indices
between &hC000& and &hFFFF&.  If you loop that range, using GetClipboardFormatName,
you'll see lots of interesting stuff.

   http://vb.mvps.org/articles/qa200203.asp

> Enumerating clipboard formats returns long values which must be
> converted to integers ranging from -32768 to 32767. Using the converted
> values works with clipboard.getformat(x). They do not however work with
> data.getformat(x), with data supplied by the OLEDragDrop event.

Unfortunately, the rest of this I really know nothing about.  Just wanted to inject
the range I was familiar with.

Good luck...
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
13 May 2009 12:56 PM
Ralph
Show quote Hide quote
"gerryR" <gerryr@noSPAM.com> wrote in message
news:eC0Wih80JHA.5556@TK2MSFTNGP03.phx.gbl...
> Hi
>
> I'm working on a fairly simple app comprising of 4 forms.
>
> On the 1st form it shows some stats from 2 txt file it links too (how many
> lines etc).
>
> On Form 2 it allows you to add info to one of the txt files.
>
> I open Form 2 when wanting to add another record using Form2.ShowDialog()
> When I've added the link and clicked save I close form2 with Close().  The
> the focus is back on form 1
>
> Is there anything I can do to automatically refresh form1 so that the
stats
> update once I close form 2?
>

[Hope I got the direction right... <g>]


In Form2 provide a Event to send back the information

In Form1 declare your Form2 reference using
     Private WithEvents frmTwo As Form2
Add the Event to Form1
In Form2 when ever you want to update Form1 raise the event

-ralph
Author
13 May 2009 11:48 PM
Kevin Provance
"Karl E. Peterson" <k***@exmvps.org> wrote in message
news:%23dYql$B1JHA.3988@TK2MSFTNGP05.phx.gbl...
| dgm wrote:
| > From what I've read, clipboard formats are supposed to coincide with
dragdrop
| > formats.
|
| Clipboard formats, and lots of other things, exist in a string table with
indices
| between &hC000& and &hFFFF&.  If you loop that range, using
GetClipboardFormatName,
| you'll see lots of interesting stuff.

Indeed.  BadApplicationNotificationClassWindow has me thinking unhappy
things.

--
2025
If you do not believe in time travel,
your beliefs are about to be tempered.

http://www.facebook.com/group.php?gid=43606237254
Author
14 May 2009 1:58 PM
dgm
Show quote Hide quote
"Karl E. Peterson" wrote:

> dgm wrote:
> > From what I've read, clipboard formats are supposed to coincide with dragdrop
> > formats.
>
> I've never ran into that correlation before, but that certainly doesn't mean it
> isn't so.
>
> > I can enumerate clipboard formats and find two that have been
> > registered. But the two I found registered do not work with dragdrop. To find
> > what works with dragdrop I must test everything from -32768 to 32767 and use
> > what's found.
>
> Clipboard formats, and lots of other things, exist in a string table with indices
> between &hC000& and &hFFFF&.  If you loop that range, using GetClipboardFormatName,
> you'll see lots of interesting stuff.
>
>    http://vb.mvps.org/articles/qa200203.asp
>
> > Enumerating clipboard formats returns long values which must be
> > converted to integers ranging from -32768 to 32767. Using the converted
> > values works with clipboard.getformat(x). They do not however work with
> > data.getformat(x), with data supplied by the OLEDragDrop event.
>
> Unfortunately, the rest of this I really know nothing about.  Just wanted to inject
> the range I was familiar with.

Thanks Karl. I can get a byte array from the OLEDragDrop data object, for a
GroupWise attachment, if I happen to know what format value to use. This is
not published anywhere. Documentation at the Novell site doesn't mention it.
I can't find anything through internet searches. There are two possible
values that return different information, both of which I need. I can find
the values by looping through data.GetFormat or data.GetData with all
possible integer values. When I find them I can then use them and they work.
Unforunately, each time the machine boots these values change.

When the application loads I could start a background process to do the
testing and find the values, but that won't work because someone must drag an
email attachment and drop into the application at least one time to get a
data object. Of course, once I have looped and discovered the values one time
I can continue using them, so the first drag and drop will always have a big
delay.

Attachments can be dragged from GroupWise and dropped into Windows Explorer,
or an open folder, with no problem. How does Windows know how to handle the
drop event? The GetData method does not return a file but a formatted packet.

What process does GroupWise go through to register this functionality?
Surely there's a way to look this up. Also, there should be an API available
providing the same functionality as Explorer, when an attachment is dropped
into an open folder window.

I'm surprized it's so difficult to find documentation or examples for this.
Novell went a long way to facilitate VB, providing many DLLs and coding
examples.
Author
14 May 2009 6:50 PM
Karl E. Peterson
dgm wrote:
> What process does GroupWise go through to register this functionality?
> Surely there's a way to look this up. Also, there should be an API available
> providing the same functionality as Explorer, when an attachment is dropped
> into an open folder window.
>
> I'm surprized it's so difficult to find documentation or examples for this.
> Novell went a long way to facilitate VB, providing many DLLs and coding
> examples.

Ugh.  Well, I worked with Edanmo once, to accept OLEDragDrops from Outlook and OE.
Or, more accurately, he provided a method for it, for which I have virtually no
recollection how "we" did it.  I /think/ there's an example on his web page, though.
Have you looked there?  I'd have to guess that GroupWise would be, at least
surficially, similar?
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
14 May 2009 8:04 PM
dgm
Show quote Hide quote
"Karl E. Peterson" wrote:

> dgm wrote:
> > What process does GroupWise go through to register this functionality?
> > Surely there's a way to look this up. Also, there should be an API available
> > providing the same functionality as Explorer, when an attachment is dropped
> > into an open folder window.
> >
> > I'm surprized it's so difficult to find documentation or examples for this.
> > Novell went a long way to facilitate VB, providing many DLLs and coding
> > examples.
>
> Ugh.  Well, I worked with Edanmo once, to accept OLEDragDrops from Outlook and OE.
> Or, more accurately, he provided a method for it, for which I have virtually no
> recollection how "we" did it.  I /think/ there's an example on his web page, though.
> Have you looked there?  I'd have to guess that GroupWise would be, at least
> surficially, similar?


I have two solutions going. I wrote a list of string values found with
GetClipboardFormatName going from 0 to 65535. Values were only returned above
&hc000. Converting those to integers in the range -32768 to 32767, which must
be used with data.GetFormat and data.GetData, I found text strings associated
with values that were found to work. It takes almost no time to scan value
string pairs in the range and find the two spellings I need. Plugging those
into data.GetFormat and data.GetData works perfectly. However, scanning for
the strings must be done after the file is dropped otherwise both will not be
there. Once scanned, the values can be reused over and over. Thank you for
saying I can use GetClipboardFormatName to read through that string space.

The second solution might be better. Edanmo has a hack that converts the
data object provided by the OLEDragDrop method, into an IDataObject object.
From what I've read I should be able to make that work. Unfortunately I can't
find what reference (dll, library, etc) to add to the project that has the
IDataObject interface. Do you know what that is? Thanks again.
Author
14 May 2009 8:21 PM
Karl E. Peterson
dgm wrote:
> there. Once scanned, the values can be reused over and over. Thank you for
> saying I can use GetClipboardFormatName to read through that string space.

Cool.

> The second solution might be better. Edanmo has a hack that converts the
> data object provided by the OLEDragDrop method, into an IDataObject object.
> From what I've read I should be able to make that work. Unfortunately I can't
> find what reference (dll, library, etc) to add to the project that has the
> IDataObject interface. Do you know what that is? Thanks again.

That's in his olelib.tlb
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
13 May 2009 1:14 PM
Ralph
Here are two other ways to implement communication:

In Form1 create one or more properties for the information you would like
updated.
In Form2 create a reference to Form1, and then when you want to update Form1
simply call that property.

or...

If there is a specific control on Form1 you would like updated, then create
a reference to that control in Form1.
Set the reference before calling Form2.
Then in Form2 chew on Form1's control.

You can also chew on specific controls in Form1 from Form2 vie a Form1
reference (using the controls collection,etc).

This latter scheme, while efficient is generally frowned upon as it is a
flagrant violation of encapsulation and more tightly binds the two forms.

-ralph
Author
13 May 2009 2:20 PM
DanS
Show quote Hide quote
"Ralph" <nt_consultin***@yahoo.com> wrote in
news:uheacz80JHA.3700@TK2MSFTNGP06.phx.gbl:

> Here are two other ways to implement communication:
>
> In Form1 create one or more properties for the information you would
> like updated.
> In Form2 create a reference to Form1, and then when you want to update
> Form1 simply call that property.
>
> or...
>
> If there is a specific control on Form1 you would like updated, then
> create a reference to that control in Form1.
> Set the reference before calling Form2.
> Then in Form2 chew on Form1's control.
>
> You can also chew on specific controls in Form1 from Form2 vie a Form1
> reference (using the controls collection,etc).
>
> This latter scheme, while efficient is generally frowned upon as it is
> a flagrant violation of encapsulation and more tightly binds the two
> forms.
>
> -ralph

Or......in Form1, can't you declare the Sub that refreshes the Form1 data
as Public, and then in the Form2 unload event, just call Form1.sub ?
Author
13 May 2009 3:11 PM
Ralph
Show quote Hide quote
"DanS" <t.h.i.s.n.t.h.a.t@r.o.a.d.r.u.n.n.e.r.c.o.m> wrote in message
news:Xns9C0A6938D9E21thisnthatroadrunnern@85.214.105.209...
> "Ralph" <nt_consultin***@yahoo.com> wrote in
> news:uheacz80JHA.3700@TK2MSFTNGP06.phx.gbl:
>
> > Here are two other ways to implement communication:
> >
> > In Form1 create one or more properties for the information you would
> > like updated.
> > In Form2 create a reference to Form1, and then when you want to update
> > Form1 simply call that property.
> >
> > or...
> >
> > If there is a specific control on Form1 you would like updated, then
> > create a reference to that control in Form1.
> > Set the reference before calling Form2.
> > Then in Form2 chew on Form1's control.
> >
> > You can also chew on specific controls in Form1 from Form2 vie a Form1
> > reference (using the controls collection,etc).
> >
> > This latter scheme, while efficient is generally frowned upon as it is
> > a flagrant violation of encapsulation and more tightly binds the two
> > forms.
> >
> > -ralph
>
> Or......in Form1, can't you declare the Sub that refreshes the Form1 data
> as Public, and then in the Form2 unload event, just call Form1.sub ?

Yes. Which is more or less what I assumed would be performed by setting a
Property. ie, the Property would manage what ever updating needed to be
done.

If you already have a Sub that does the updating then making it Public would
be a simple fix.

Publishing an Interface with Methods and/or Properties is fine. But my
comfort level goes down with your comment "... *the* Sub that refreshes the
Form1 data ...". (The emphasis is mine.)

If this Sub is used within the context of performing Form1 tasks it places
the extra burden on the developer (and latter maintainers) to be aware *the*
Sub might be called "out of context". I like to keep the two separated. But
that's drawing a fine line and certainly nothing to go to the mat over. :-)

-ralph
Author
13 May 2009 4:23 PM
Stan Weiss
Ralph wrote:
Show quoteHide quote
>
> "DanS" <t.h.i.s.n.t.h.a.t@r.o.a.d.r.u.n.n.e.r.c.o.m> wrote in message
> news:Xns9C0A6938D9E21thisnthatroadrunnern@85.214.105.209...
> > "Ralph" <nt_consultin***@yahoo.com> wrote in
> > news:uheacz80JHA.3700@TK2MSFTNGP06.phx.gbl:
> >
> > > Here are two other ways to implement communication:
> > >
> > > In Form1 create one or more properties for the information you would
> > > like updated.
> > > In Form2 create a reference to Form1, and then when you want to update
> > > Form1 simply call that property.
> > >
> > > or...
> > >
> > > If there is a specific control on Form1 you would like updated, then
> > > create a reference to that control in Form1.
> > > Set the reference before calling Form2.
> > > Then in Form2 chew on Form1's control.
> > >
> > > You can also chew on specific controls in Form1 from Form2 vie a Form1
> > > reference (using the controls collection,etc).
> > >
> > > This latter scheme, while efficient is generally frowned upon as it is
> > > a flagrant violation of encapsulation and more tightly binds the two
> > > forms.
> > >
> > > -ralph
> >
> > Or......in Form1, can't you declare the Sub that refreshes the Form1 data
> > as Public, and then in the Form2 unload event, just call Form1.sub ?
>
> Yes. Which is more or less what I assumed would be performed by setting a
> Property. ie, the Property would manage what ever updating needed to be
> done.
>
> If you already have a Sub that does the updating then making it Public would
> be a simple fix.
>
> Publishing an Interface with Methods and/or Properties is fine. But my
> comfort level goes down with your comment "... *the* Sub that refreshes the
> Form1 data ...". (The emphasis is mine.)
>
> If this Sub is used within the context of performing Form1 tasks it places
> the extra burden on the developer (and latter maintainers) to be aware *the*
> Sub might be called "out of context". I like to keep the two separated. But
> that's drawing a fine line and certainly nothing to go to the mat over. :-)
>
> -ralph

And if the data shown in form1 refresh changes they need to know this
for the form2 routine. I would put the sub in a module and have one
place to maintain the code.
Author
13 May 2009 2:20 PM
Ralph
Show quote Hide quote
"gerryR" <gerryr@noSPAM.com> wrote in message
news:eC0Wih80JHA.5556@TK2MSFTNGP03.phx.gbl...
> Hi
>
> I'm working on a fairly simple app comprising of 4 forms.
>
> On the 1st form it shows some stats from 2 txt file it links too (how many
> lines etc).
>
> On Form 2 it allows you to add info to one of the txt files.
>
> I open Form 2 when wanting to add another record using Form2.ShowDialog()
> When I've added the link and clicked save I close form2 with Close().  The
> the focus is back on form 1
>
> Is there anything I can do to automatically refresh form1 so that the
stats
> update once I close form 2?
>

Dang!

I completely skipped right over ".ShowDialog()".

You're using VB.Net, correct?

While my suggestions will work in the general, for specific code you need to
post to a dotNet group. Perhaps
    microsoft.public.dotnet.languages.vb

-ralph
Author
13 May 2009 4:07 PM
gerryR
Sorry, my mistake, posted in the wrong group!

Thanks.

Gerry


Show quoteHide quote
"Ralph" <nt_consultin***@yahoo.com> wrote in message
news:uvLOBY90JHA.4416@TK2MSFTNGP05.phx.gbl...
>
> "gerryR" <gerryr@noSPAM.com> wrote in message
> news:eC0Wih80JHA.5556@TK2MSFTNGP03.phx.gbl...
>> Hi
>>
>> I'm working on a fairly simple app comprising of 4 forms.
>>
>> On the 1st form it shows some stats from 2 txt file it links too (how
>> many
>> lines etc).
>>
>> On Form 2 it allows you to add info to one of the txt files.
>>
>> I open Form 2 when wanting to add another record using Form2.ShowDialog()
>> When I've added the link and clicked save I close form2 with Close().
>> The
>> the focus is back on form 1
>>
>> Is there anything I can do to automatically refresh form1 so that the
> stats
>> update once I close form 2?
>>
>
> Dang!
>
> I completely skipped right over ".ShowDialog()".
>
> You're using VB.Net, correct?
>
> While my suggestions will work in the general, for specific code you need
> to
> post to a dotNet group. Perhaps
>    microsoft.public.dotnet.languages.vb
>
> -ralph
>
>
>
Author
14 May 2009 11:13 PM
James Hahn
Since you didn't re-post, you may not have noticed that you didn't get the
full range of options.

If you build that second form using the Dialog template (instead of a
standard form) then you can get a return value from .ShowDialog that
indicates the dialog result. Use that value to determine how the form needs
to be updated.

Show quoteHide quote
"gerryR" <gerryr@noSPAM.com> wrote in message
news:ejVPQU%230JHA.3780@TK2MSFTNGP04.phx.gbl...
> Sorry, my mistake, posted in the wrong group!
>
> Thanks.
>
> Gerry
>