Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to ease searching in Internet by using Visual Foxpro 3

Status
Not open for further replies.

german12

Programmer
Nov 12, 2001
563
DE
The insights from thread184-1814041 can also be used to find something much faster on the internet.
Since I like to paint, I often search for a motif on the Internet in Google.

As an example this:
I would like to paint a red cat in watercolor and am looking for a motif.
In Google this would be the input:

Horse blue watercolor

That means 21 times typing a letter for the search string.
With 3 listboxes it means only 4 clicks to generate a search string
see following picture

Animals_xjlbpc.jpg


Unfortunately I forgot how this string can be used to search with it Google and then back to VFP for a another search.



and then as an example this can be found:

katze_bil0r5.jpg



Any advice?

Thanks Klaus





Peace worldwide - it starts here...
 
I found:
*Function ShellExec described by Rick Strahl in his book "Internet Applications with Visual Foxpro 6.0 - Page 194
*leads to a "data-type mismatch" error


Code:
ShellExec("[URL unfurl="true"]http://www.west-wind.com/")[/URL]

[b]FUNCTION ShellExec[/b]
LPARAMETERS lcLink, lcAction, lcParms

lcAction = IIF(EMPTY(lcAction), "Open", lcAction)
lcParms = IIF(EMPTY(lcParms),"",lcParms)

DECLARE INTEGER ShellExecute;
IN Shell32.DLL ;
INTEGER nWindhandle, ;
STRING cOperation, ;[URL unfurl="true"]https://www.tek-tips.com/postedit.cfm?id=7519975&action=edit[/URL]
STRING cFilename, ;
STRING cParameters, ;
STRING cDirectory, ;
[s]STRING nShowWindow[/s]
[b]INTEGER nShowindow[/b]      *Correction

DECLARE INTEGER FindWindow ;
IN WIN32API ;
STRING cNull, STRING cWinName

RETURN ShellExecute(FindWindow(0,_SCREEN.caption), ;
lcAction,lcLink, ;
lcParms, SYS(2023), 1)

ENDFUNC
*mystring = "



Peace worldwide - it starts here...
 
STRING nShowWindow?

The n of nShowWindow points out this parameter is numeric.
And in the last line of the ShellExecute it's 1: lcParms, SYS(2023), [highlight #FCE94F]1[/highlight])

So you have two hint it has to be INTEGER nShowWindow, not STRING nShowWindow. And then it works.





Chriss
 
If you want to use this for creative brainstorming, like described here:
Then go to and look for a random words API that will allow you to get words for your search instead of picking them from a list.

By the way, a listbox with some predefined words can be very easily filled with just the RowSourceType 1 (Value) and then RowSource="Pick,From,These,Words", there's no need to go through many hoops to build a cursor or array. The several RowSourceTypes existing all have their uses, many experts here teach you best only use some, as you can always convert anything into an array or table. But I don't like this kind of rejection of options. And in this case I think it also would be easy to fill in a word list you get from an API as comma separated list into the RowSource.

Then you combine random words with the ability to pick some combination that's having a better chance to find images. To give an example a word generator I used generated "spanish high-jump bible" and you can see for yourself what you get when you make an image search for "spanish high-jump bible watercolor".

You surely will find APIs that allow you to get random adjectives only or nouns and then can fill some of them into your picklist. Or you find a dictionary that has a word list with word types and can populate listboxes from them.

Chriss
 
Chriss
many thanks for the help.
Then I made a typo on my part. I didn't want to type the word "STRING" every time - and then I accidentally copied it once too many.

Everything was right in Rick Strahl's book.
The ShellExec function now works correctly here as well.


Topic Creativity:
When I was still working, I read a lot of German books about creativity techniques - and very often that helped me to see (and solve) private or business problems from an unfamiliar side.

My literature was almost always written by the same german author:
Helmut Schlicksupp:
From 1970 to 1976 he worked at the Battelle Institute in Frankfurt am Main. In 1975 he received his doctorate (Dr. re. pole. at the Technical University of Darmstadt with Wolfgang H. Staehle.

(Translated with Google:)

Helmut Schlicksupp (November 4, 1943 – February 25, 2010 in Heidelberg) was a German creativity researcher. He developed numerous creativity techniques that have become well-known.[1]
Life

After studying industrial engineering at the Technical University of Darmstadt, Schlicksupp worked at the Battelle Institute in Frankfurt am Main from 1970 to 1976. In 1975 he received his doctorate (Dr. re. pole. at the Technical University of Darmstadt with Wolfgang H. Staehle.

Schlicksupp pioneered the exploration, development and application of methods to foster innovation and creativity in industry. He developed numerous creativity techniques at the Battelle Institute (brainwriting pool, TILMAG method, semantic intuition, SIL method, secondary field integration, sequential morphology, hypothesis matrix) and was involved in the development of other creativity techniques at the institute (force-fit game, Visual synectics, Idea Delphi, BBB method, stimulus word analysis).[2]

Other focal points of his work at the Battelle Institute were the implementation of projects for product innovation and product diversification. From 1976 he worked as an independent management consultant and wrote numerous publications in the fields of creativity and innovation.


Topic Wordlist:
Thanks for the interesting resources on word lists and creativity.
Word lists have advantages and disadvantages.
The advantages are also correctly described in your links - and it is a great advantage if you can adopt them somewhere - this eliminates any manual work of recording.

The downside is of course the large amount of data required for a listbox could be if you just scroll.
In the German language one can still distinguish between noun and adjective - one could separate the list between upper and lower case - in other languages ​​it might not be the case.

But - something like this can only be determined by trying it out.

Maybe you can also construct a list box in such a way that
If it lets the cursor continue into a list box next right on top when it has reached the bottom of the screen before, then much more information would be visible at a glance.

Another possibility might be to split the list boxes according to the first letter of their content. I.e. alphabetical list boxes from A-Z.

I'll think about it.

Klaus





Peace worldwide - it starts here...
 
german12 said:
The downside is of course the large amount of data required for a listbox could be if you just scroll.

Well, I gave an example of 3 random words. You don't need to populate the listboxes you pick from with the whole dictionary. You may make 1 listbox with adjectives, one with nouns and onw with a drawing or painting technique. The first two you populate with 6 random words from all you have categorized or can get as categorized rando words from web APIs.

And then your picking doesn't mean scrolling through all words, nor using intellisense or incremental seek on the controls, no, that would just mean more work than simply writing the words thaat come to your mind. No, I sketched my idea a bit clearer already, I thought at least. You take just 6 adjectives and 6 nouns, have your fixed list of techniques like pencil drawing, watercolor, oil painting, whatever and then the final pick is from you. You don't pick from 1000 adjectives and 1000 nouns, you pick from 6 and 6, for example. And these change every time by coming from a word randomizer API.

As you're such a fan of Helmut Schlicksupp, I'll have a look at his books.

Chriss
 
Thanks again. Chriss.
[/b]
I understand your idea better now.
Of course, the random function also has the element of surprise or coincidence, which definitely increases intuition when looking for a motif.
coincidence:
something that was not foreseen, that was not intended, that happened unexpectedly
"a strange, happy, silly, annoying, strange coincidence"


keyword creativity
Chriss said:
As you're such a fan of Helmut Schlicksupp, I'll have a look at his books.

The author unfortunately passed away in 2010 - so far I have only found books in German.
Despite the age of the books, the idea hasn't changed.
You can also buy them used. (Booklooker and Ebay)



Klaus

Peace worldwide - it starts here...
 
Thank you Mike Yearwood,

That's definitely a valuable tip I wasn't aware of.
I'm happy every day when I've learned something new.
Thanks.

Klaus


Peace worldwide - it starts here...
 
Klaus,

Just in case it's not obvious, the tip that Mike Y gave you is not specific to ShellExecute(). In general, you can apply it to any DLL call, to avoid having to worry about whether the DLL is already declared or not.

To give another example, Beep() is a function which plays a sound of a specific frequency and duration. Normally, you could use it like this:

Code:
DECLARE INTEGER Beep IN WIN32API INTEGER Freq, INTEGER Dur
Beep(500, 1000)

The alternative is to write a VFP function with the same name as the DLL function, and with the same parameters, like this:

Code:
Beep(500,1000)
FUNCTION Beep(nFreq, nDur)
DECLARE INTEGER Beep IN WIN32API INTEGER Freq, INTEGER Dur
Beep(nFreq, nDur)
ENDFUNC

This allows you to call the function from anywhere in your program, without having to worry about whether or not the DLL call has already been declared. If you call it before it has been declared, VFP will execute your function, which then proceeds to do the DECLARE and then execute the DLL function. On subsequent calls, the DLL will have priority over the VFP function, so it is the DLL that will be executed.

Several developers I know always treat their API calls in this way.

(By the way, the Beep() function here is just an example. The function does exist within the API, but I am not completely sure it actually does anything useful on a modern sound card-quipped computer.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top